proteus  1.8.1
C/C++/Fortran libraries
MeshSmoothing.cpp
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 __cplusplus
307  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
308 #endif
309 #ifndef CYTHON_INLINE
310  #if defined(__clang__)
311  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
312  #else
313  #define CYTHON_INLINE inline
314  #endif
315 #endif
316 template<typename T>
317 void __Pyx_call_destructor(T& x) {
318  x.~T();
319 }
320 template<typename T>
321 class __Pyx_FakeReference {
322  public:
323  __Pyx_FakeReference() : ptr(NULL) { }
324  __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
325  T *operator->() { return ptr; }
326  T *operator&() { return ptr; }
327  operator T&() { return *ptr; }
328  template<typename U> bool operator ==(U other) { return *ptr == other; }
329  template<typename U> bool operator !=(U other) { return *ptr != other; }
330  private:
331  T *ptr;
332 };
333 
334 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
335  #define Py_OptimizeFlag 0
336 #endif
337 #define __PYX_BUILD_PY_SSIZE_T "n"
338 #define CYTHON_FORMAT_SSIZE_T "z"
339 #if PY_MAJOR_VERSION < 3
340  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
341  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
342  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
343  #define __Pyx_DefaultClassType PyClass_Type
344 #else
345  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
346  #define __Pyx_DefaultClassType PyType_Type
347 #if PY_VERSION_HEX >= 0x030B00A1
348  static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
349  PyObject *code, PyObject *c, PyObject* n, PyObject *v,
350  PyObject *fv, PyObject *cell, PyObject* fn,
351  PyObject *name, int fline, PyObject *lnos) {
352  PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
353  PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
354  const char *fn_cstr=NULL;
355  const char *name_cstr=NULL;
356  PyCodeObject* co=NULL;
357  PyObject *type, *value, *traceback;
358  PyErr_Fetch(&type, &value, &traceback);
359  if (!(kwds=PyDict_New())) goto end;
360  if (!(argcount=PyLong_FromLong(a))) goto end;
361  if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
362  if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
363  if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
364  if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
365  if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
366  if (!(nlocals=PyLong_FromLong(l))) goto end;
367  if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
368  if (!(stacksize=PyLong_FromLong(s))) goto end;
369  if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
370  if (!(flags=PyLong_FromLong(f))) goto end;
371  if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
372  if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
373  if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
374  if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
375  if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
376  if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
377  if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
378  if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
379  if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
380  if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
381  if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
382  if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
383  if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
384  if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
385  Py_XDECREF((PyObject*)co);
386  co = (PyCodeObject*)call_result;
387  call_result = NULL;
388  if (0) {
389  cleanup_code_too:
390  Py_XDECREF((PyObject*)co);
391  co = NULL;
392  }
393  end:
394  Py_XDECREF(kwds);
395  Py_XDECREF(argcount);
396  Py_XDECREF(posonlyargcount);
397  Py_XDECREF(kwonlyargcount);
398  Py_XDECREF(nlocals);
399  Py_XDECREF(stacksize);
400  Py_XDECREF(replace);
401  Py_XDECREF(call_result);
402  Py_XDECREF(empty);
403  if (type) {
404  PyErr_Restore(type, value, traceback);
405  }
406  return co;
407  }
408 #else
409  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
410  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
411 #endif
412  #define __Pyx_DefaultClassType PyType_Type
413 #endif
414 #ifndef Py_TPFLAGS_CHECKTYPES
415  #define Py_TPFLAGS_CHECKTYPES 0
416 #endif
417 #ifndef Py_TPFLAGS_HAVE_INDEX
418  #define Py_TPFLAGS_HAVE_INDEX 0
419 #endif
420 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
421  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
422 #endif
423 #ifndef Py_TPFLAGS_HAVE_FINALIZE
424  #define Py_TPFLAGS_HAVE_FINALIZE 0
425 #endif
426 #ifndef METH_STACKLESS
427  #define METH_STACKLESS 0
428 #endif
429 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
430  #ifndef METH_FASTCALL
431  #define METH_FASTCALL 0x80
432  #endif
433  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
434  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
435  Py_ssize_t nargs, PyObject *kwnames);
436 #else
437  #define __Pyx_PyCFunctionFast _PyCFunctionFast
438  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
439 #endif
440 #if CYTHON_FAST_PYCCALL
441 #define __Pyx_PyFastCFunction_Check(func)\
442  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
443 #else
444 #define __Pyx_PyFastCFunction_Check(func) 0
445 #endif
446 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
447  #define PyObject_Malloc(s) PyMem_Malloc(s)
448  #define PyObject_Free(p) PyMem_Free(p)
449  #define PyObject_Realloc(p) PyMem_Realloc(p)
450 #endif
451 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
452  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
453  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
454  #define PyMem_RawFree(p) PyMem_Free(p)
455 #endif
456 #if CYTHON_COMPILING_IN_PYSTON
457  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
458  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
459 #else
460  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
461  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
462 #endif
463 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
464  #define __Pyx_PyThreadState_Current PyThreadState_GET()
465 #elif PY_VERSION_HEX >= 0x03060000
466  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
467 #elif PY_VERSION_HEX >= 0x03000000
468  #define __Pyx_PyThreadState_Current PyThreadState_GET()
469 #else
470  #define __Pyx_PyThreadState_Current _PyThreadState_Current
471 #endif
472 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
473 #include "pythread.h"
474 #define Py_tss_NEEDS_INIT 0
475 typedef int Py_tss_t;
476 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
477  *key = PyThread_create_key();
478  return 0;
479 }
480 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
481  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
482  *key = Py_tss_NEEDS_INIT;
483  return key;
484 }
485 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
486  PyObject_Free(key);
487 }
488 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
489  return *key != Py_tss_NEEDS_INIT;
490 }
491 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
492  PyThread_delete_key(*key);
493  *key = Py_tss_NEEDS_INIT;
494 }
495 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
496  return PyThread_set_key_value(*key, value);
497 }
498 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
499  return PyThread_get_key_value(*key);
500 }
501 #endif
502 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
503 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
504 #else
505 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
506 #endif
507 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
508  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
509  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
510 #else
511  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
512  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
513 #endif
514 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
515 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
516 #else
517 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
518 #endif
519 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
520  #define CYTHON_PEP393_ENABLED 1
521  #if defined(PyUnicode_IS_READY)
522  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
523  0 : _PyUnicode_Ready((PyObject *)(op)))
524  #else
525  #define __Pyx_PyUnicode_READY(op) (0)
526  #endif
527  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
528  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
529  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
530  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
531  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
532  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
533  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
534  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
535  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
536  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
537  #else
538  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
539  #endif
540  #else
541  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
542  #endif
543 #else
544  #define CYTHON_PEP393_ENABLED 0
545  #define PyUnicode_1BYTE_KIND 1
546  #define PyUnicode_2BYTE_KIND 2
547  #define PyUnicode_4BYTE_KIND 4
548  #define __Pyx_PyUnicode_READY(op) (0)
549  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
550  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
551  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
552  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
553  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
554  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
555  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
556  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
557 #endif
558 #if CYTHON_COMPILING_IN_PYPY
559  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
560  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
561 #else
562  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
563  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
564  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
565 #endif
566 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
567  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
568 #endif
569 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
570  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
571 #endif
572 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
573  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
574 #endif
575 #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))
576 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
577 #if PY_MAJOR_VERSION >= 3
578  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
579 #else
580  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
581 #endif
582 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
583  #define PyObject_ASCII(o) PyObject_Repr(o)
584 #endif
585 #if PY_MAJOR_VERSION >= 3
586  #define PyBaseString_Type PyUnicode_Type
587  #define PyStringObject PyUnicodeObject
588  #define PyString_Type PyUnicode_Type
589  #define PyString_Check PyUnicode_Check
590  #define PyString_CheckExact PyUnicode_CheckExact
591 #ifndef PyObject_Unicode
592  #define PyObject_Unicode PyObject_Str
593 #endif
594 #endif
595 #if PY_MAJOR_VERSION >= 3
596  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
597  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
598 #else
599  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
600  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
601 #endif
602 #ifndef PySet_CheckExact
603  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
604 #endif
605 #if PY_VERSION_HEX >= 0x030900A4
606  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
607  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
608 #else
609  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
610  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
611 #endif
612 #if CYTHON_ASSUME_SAFE_MACROS
613  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
614 #else
615  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
616 #endif
617 #if PY_MAJOR_VERSION >= 3
618  #define PyIntObject PyLongObject
619  #define PyInt_Type PyLong_Type
620  #define PyInt_Check(op) PyLong_Check(op)
621  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
622  #define PyInt_FromString PyLong_FromString
623  #define PyInt_FromUnicode PyLong_FromUnicode
624  #define PyInt_FromLong PyLong_FromLong
625  #define PyInt_FromSize_t PyLong_FromSize_t
626  #define PyInt_FromSsize_t PyLong_FromSsize_t
627  #define PyInt_AsLong PyLong_AsLong
628  #define PyInt_AS_LONG PyLong_AS_LONG
629  #define PyInt_AsSsize_t PyLong_AsSsize_t
630  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
631  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
632  #define PyNumber_Int PyNumber_Long
633 #endif
634 #if PY_MAJOR_VERSION >= 3
635  #define PyBoolObject PyLongObject
636 #endif
637 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
638  #ifndef PyUnicode_InternFromString
639  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
640  #endif
641 #endif
642 #if PY_VERSION_HEX < 0x030200A4
643  typedef long Py_hash_t;
644  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
645  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
646 #else
647  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
648  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
649 #endif
650 #if PY_MAJOR_VERSION >= 3
651  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
652 #else
653  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
654 #endif
655 #if CYTHON_USE_ASYNC_SLOTS
656  #if PY_VERSION_HEX >= 0x030500B1
657  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
658  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
659  #else
660  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
661  #endif
662 #else
663  #define __Pyx_PyType_AsAsync(obj) NULL
664 #endif
665 #ifndef __Pyx_PyAsyncMethodsStruct
666  typedef struct {
667  unaryfunc am_await;
668  unaryfunc am_aiter;
669  unaryfunc am_anext;
670  } __Pyx_PyAsyncMethodsStruct;
671 #endif
672 
673 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
674  #if !defined(_USE_MATH_DEFINES)
675  #define _USE_MATH_DEFINES
676  #endif
677 #endif
678 #include <math.h>
679 #ifdef NAN
680 #define __PYX_NAN() ((float) NAN)
681 #else
682 static CYTHON_INLINE float __PYX_NAN() {
683  float value;
684  memset(&value, 0xFF, sizeof(value));
685  return value;
686 }
687 #endif
688 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
689 #define __Pyx_truncl trunc
690 #else
691 #define __Pyx_truncl truncl
692 #endif
693 
694 #define __PYX_MARK_ERR_POS(f_index, lineno) \
695  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
696 #define __PYX_ERR(f_index, lineno, Ln_error) \
697  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
698 
699 #ifndef __PYX_EXTERN_C
700  #ifdef __cplusplus
701  #define __PYX_EXTERN_C extern "C"
702  #else
703  #define __PYX_EXTERN_C extern
704  #endif
705 #endif
706 
707 #define __PYX_HAVE__mprans__MeshSmoothing
708 #define __PYX_HAVE_API__mprans__MeshSmoothing
709 /* Early includes */
710 #include <string.h>
711 #include <stdio.h>
712 #include "numpy/arrayobject.h"
713 #include "numpy/ndarrayobject.h"
714 #include "numpy/ndarraytypes.h"
715 #include "numpy/arrayscalars.h"
716 #include "numpy/ufuncobject.h"
717 
718  /* NumPy API declarations from "numpy/__init__.pxd" */
719 
720 #include <math.h>
721 #include "pythread.h"
722 #include <stdlib.h>
723 #include "pystate.h"
724 #ifdef _OPENMP
725 #include <omp.h>
726 #endif /* _OPENMP */
727 
728 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
729 #define CYTHON_WITHOUT_ASSERTIONS
730 #endif
731 
732 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
733  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
734 
735 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
736 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
737 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
738 #define __PYX_DEFAULT_STRING_ENCODING ""
739 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
740 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
741 #define __Pyx_uchar_cast(c) ((unsigned char)c)
742 #define __Pyx_long_cast(x) ((long)x)
743 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
744  (sizeof(type) < sizeof(Py_ssize_t)) ||\
745  (sizeof(type) > sizeof(Py_ssize_t) &&\
746  likely(v < (type)PY_SSIZE_T_MAX ||\
747  v == (type)PY_SSIZE_T_MAX) &&\
748  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
749  v == (type)PY_SSIZE_T_MIN))) ||\
750  (sizeof(type) == sizeof(Py_ssize_t) &&\
751  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
752  v == (type)PY_SSIZE_T_MAX))) )
753 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
754  return (size_t) i < (size_t) limit;
755 }
756 #if defined (__cplusplus) && __cplusplus >= 201103L
757  #include <cstdlib>
758  #define __Pyx_sst_abs(value) std::abs(value)
759 #elif SIZEOF_INT >= SIZEOF_SIZE_T
760  #define __Pyx_sst_abs(value) abs(value)
761 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
762  #define __Pyx_sst_abs(value) labs(value)
763 #elif defined (_MSC_VER)
764  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
765 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
766  #define __Pyx_sst_abs(value) llabs(value)
767 #elif defined (__GNUC__)
768  #define __Pyx_sst_abs(value) __builtin_llabs(value)
769 #else
770  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
771 #endif
772 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
773 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
774 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
775 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
776 #define __Pyx_PyBytes_FromString PyBytes_FromString
777 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
778 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
779 #if PY_MAJOR_VERSION < 3
780  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
781  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
782 #else
783  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
784  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
785 #endif
786 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
787 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
788 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
789 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
790 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
791 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
792 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
793 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
794 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
795 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
796 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
797 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
798 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
799 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
800 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
801 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
802 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
803  const Py_UNICODE *u_end = u;
804  while (*u_end++) ;
805  return (size_t)(u_end - u - 1);
806 }
807 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
808 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
809 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
810 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
811 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
812 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
813 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
814 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
815 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
816 #define __Pyx_PySequence_Tuple(obj)\
817  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
818 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
819 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
820 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
821 #if CYTHON_ASSUME_SAFE_MACROS
822 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
823 #else
824 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
825 #endif
826 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
827 #if PY_MAJOR_VERSION >= 3
828 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
829 #else
830 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
831 #endif
832 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
833 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
834 static int __Pyx_sys_getdefaultencoding_not_ascii;
835 static int __Pyx_init_sys_getdefaultencoding_params(void) {
836  PyObject* sys;
837  PyObject* default_encoding = NULL;
838  PyObject* ascii_chars_u = NULL;
839  PyObject* ascii_chars_b = NULL;
840  const char* default_encoding_c;
841  sys = PyImport_ImportModule("sys");
842  if (!sys) goto bad;
843  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
844  Py_DECREF(sys);
845  if (!default_encoding) goto bad;
846  default_encoding_c = PyBytes_AsString(default_encoding);
847  if (!default_encoding_c) goto bad;
848  if (strcmp(default_encoding_c, "ascii") == 0) {
849  __Pyx_sys_getdefaultencoding_not_ascii = 0;
850  } else {
851  char ascii_chars[128];
852  int c;
853  for (c = 0; c < 128; c++) {
854  ascii_chars[c] = c;
855  }
856  __Pyx_sys_getdefaultencoding_not_ascii = 1;
857  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
858  if (!ascii_chars_u) goto bad;
859  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
860  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
861  PyErr_Format(
862  PyExc_ValueError,
863  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
864  default_encoding_c);
865  goto bad;
866  }
867  Py_DECREF(ascii_chars_u);
868  Py_DECREF(ascii_chars_b);
869  }
870  Py_DECREF(default_encoding);
871  return 0;
872 bad:
873  Py_XDECREF(default_encoding);
874  Py_XDECREF(ascii_chars_u);
875  Py_XDECREF(ascii_chars_b);
876  return -1;
877 }
878 #endif
879 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
880 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
881 #else
882 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
883 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
884 static char* __PYX_DEFAULT_STRING_ENCODING;
885 static int __Pyx_init_sys_getdefaultencoding_params(void) {
886  PyObject* sys;
887  PyObject* default_encoding = NULL;
888  char* default_encoding_c;
889  sys = PyImport_ImportModule("sys");
890  if (!sys) goto bad;
891  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
892  Py_DECREF(sys);
893  if (!default_encoding) goto bad;
894  default_encoding_c = PyBytes_AsString(default_encoding);
895  if (!default_encoding_c) goto bad;
896  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
897  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
898  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
899  Py_DECREF(default_encoding);
900  return 0;
901 bad:
902  Py_XDECREF(default_encoding);
903  return -1;
904 }
905 #endif
906 #endif
907 
908 
909 /* Test for GCC > 2.95 */
910 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
911  #define likely(x) __builtin_expect(!!(x), 1)
912  #define unlikely(x) __builtin_expect(!!(x), 0)
913 #else /* !__GNUC__ or GCC < 2.95 */
914  #define likely(x) (x)
915  #define unlikely(x) (x)
916 #endif /* __GNUC__ */
917 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
918 
919 static PyObject *__pyx_m = NULL;
920 static PyObject *__pyx_d;
921 static PyObject *__pyx_b;
922 static PyObject *__pyx_cython_runtime = NULL;
923 static PyObject *__pyx_empty_tuple;
924 static PyObject *__pyx_empty_bytes;
925 static PyObject *__pyx_empty_unicode;
926 static int __pyx_lineno;
927 static int __pyx_clineno = 0;
928 static const char * __pyx_cfilenm= __FILE__;
929 static const char *__pyx_filename;
930 
931 /* Header.proto */
932 #if !defined(CYTHON_CCOMPLEX)
933  #if defined(__cplusplus)
934  #define CYTHON_CCOMPLEX 1
935  #elif defined(_Complex_I)
936  #define CYTHON_CCOMPLEX 1
937  #else
938  #define CYTHON_CCOMPLEX 0
939  #endif
940 #endif
941 #if CYTHON_CCOMPLEX
942  #ifdef __cplusplus
943  #include <complex>
944  #else
945  #include <complex.h>
946  #endif
947 #endif
948 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
949  #undef _Complex_I
950  #define _Complex_I 1.0fj
951 #endif
952 
953 
954 static const char *__pyx_f[] = {
955  "proteus/mprans/MeshSmoothing.pyx",
956  "__init__.pxd",
957  "stringsource",
958  "type.pxd",
959 };
960 /* MemviewSliceStruct.proto */
961 struct __pyx_memoryview_obj;
962 typedef struct {
963  struct __pyx_memoryview_obj *memview;
964  char *data;
965  Py_ssize_t shape[8];
966  Py_ssize_t strides[8];
967  Py_ssize_t suboffsets[8];
968 } __Pyx_memviewslice;
969 #define __Pyx_MemoryView_Len(m) (m.shape[0])
970 
971 /* Atomics.proto */
972 #include <pythread.h>
973 #ifndef CYTHON_ATOMICS
974  #define CYTHON_ATOMICS 1
975 #endif
976 #define __pyx_atomic_int_type int
977 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
978  (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
979  !defined(__i386__)
980  #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
981  #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
982  #ifdef __PYX_DEBUG_ATOMICS
983  #warning "Using GNU atomics"
984  #endif
985 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
986  #include <Windows.h>
987  #undef __pyx_atomic_int_type
988  #define __pyx_atomic_int_type LONG
989  #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
990  #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
991  #ifdef __PYX_DEBUG_ATOMICS
992  #pragma message ("Using MSVC atomics")
993  #endif
994 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
995  #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
996  #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
997  #ifdef __PYX_DEBUG_ATOMICS
998  #warning "Using Intel atomics"
999  #endif
1000 #else
1001  #undef CYTHON_ATOMICS
1002  #define CYTHON_ATOMICS 0
1003  #ifdef __PYX_DEBUG_ATOMICS
1004  #warning "Not using atomics"
1005  #endif
1006 #endif
1007 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1008 #if CYTHON_ATOMICS
1009  #define __pyx_add_acquisition_count(memview)\
1010  __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
1011  #define __pyx_sub_acquisition_count(memview)\
1012  __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
1013 #else
1014  #define __pyx_add_acquisition_count(memview)\
1015  __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1016  #define __pyx_sub_acquisition_count(memview)\
1017  __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1018 #endif
1019 
1020 /* ForceInitThreads.proto */
1021 #ifndef __PYX_FORCE_INIT_THREADS
1022  #define __PYX_FORCE_INIT_THREADS 0
1023 #endif
1024 
1025 /* NoFastGil.proto */
1026 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1027 #define __Pyx_PyGILState_Release PyGILState_Release
1028 #define __Pyx_FastGIL_Remember()
1029 #define __Pyx_FastGIL_Forget()
1030 #define __Pyx_FastGilFuncInit()
1031 
1032 /* BufferFormatStructs.proto */
1033 #define IS_UNSIGNED(type) (((type) -1) > 0)
1034 struct __Pyx_StructField_;
1035 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1036 typedef struct {
1037  const char* name;
1038  struct __Pyx_StructField_* fields;
1039  size_t size;
1040  size_t arraysize[8];
1041  int ndim;
1042  char typegroup;
1043  char is_unsigned;
1044  int flags;
1045 } __Pyx_TypeInfo;
1046 typedef struct __Pyx_StructField_ {
1047  __Pyx_TypeInfo* type;
1048  const char* name;
1049  size_t offset;
1050 } __Pyx_StructField;
1051 typedef struct {
1052  __Pyx_StructField* field;
1053  size_t parent_offset;
1054 } __Pyx_BufFmt_StackElem;
1055 typedef struct {
1056  __Pyx_StructField root;
1057  __Pyx_BufFmt_StackElem* head;
1058  size_t fmt_offset;
1059  size_t new_count, enc_count;
1060  size_t struct_alignment;
1061  int is_complex;
1062  char enc_type;
1063  char new_packmode;
1064  char enc_packmode;
1065  char is_valid_array;
1066 } __Pyx_BufFmt_Context;
1067 
1068 
1069 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":690
1070  * # in Cython to enable them only on the right systems.
1071  *
1072  * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
1073  * ctypedef npy_int16 int16_t
1074  * ctypedef npy_int32 int32_t
1075  */
1076 typedef npy_int8 __pyx_t_5numpy_int8_t;
1077 
1078 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":691
1079  *
1080  * ctypedef npy_int8 int8_t
1081  * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
1082  * ctypedef npy_int32 int32_t
1083  * ctypedef npy_int64 int64_t
1084  */
1085 typedef npy_int16 __pyx_t_5numpy_int16_t;
1086 
1087 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":692
1088  * ctypedef npy_int8 int8_t
1089  * ctypedef npy_int16 int16_t
1090  * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
1091  * ctypedef npy_int64 int64_t
1092  * #ctypedef npy_int96 int96_t
1093  */
1094 typedef npy_int32 __pyx_t_5numpy_int32_t;
1095 
1096 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":693
1097  * ctypedef npy_int16 int16_t
1098  * ctypedef npy_int32 int32_t
1099  * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
1100  * #ctypedef npy_int96 int96_t
1101  * #ctypedef npy_int128 int128_t
1102  */
1103 typedef npy_int64 __pyx_t_5numpy_int64_t;
1104 
1105 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":697
1106  * #ctypedef npy_int128 int128_t
1107  *
1108  * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
1109  * ctypedef npy_uint16 uint16_t
1110  * ctypedef npy_uint32 uint32_t
1111  */
1112 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1113 
1114 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":698
1115  *
1116  * ctypedef npy_uint8 uint8_t
1117  * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
1118  * ctypedef npy_uint32 uint32_t
1119  * ctypedef npy_uint64 uint64_t
1120  */
1121 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1122 
1123 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":699
1124  * ctypedef npy_uint8 uint8_t
1125  * ctypedef npy_uint16 uint16_t
1126  * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
1127  * ctypedef npy_uint64 uint64_t
1128  * #ctypedef npy_uint96 uint96_t
1129  */
1130 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1131 
1132 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":700
1133  * ctypedef npy_uint16 uint16_t
1134  * ctypedef npy_uint32 uint32_t
1135  * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
1136  * #ctypedef npy_uint96 uint96_t
1137  * #ctypedef npy_uint128 uint128_t
1138  */
1139 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1140 
1141 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":704
1142  * #ctypedef npy_uint128 uint128_t
1143  *
1144  * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
1145  * ctypedef npy_float64 float64_t
1146  * #ctypedef npy_float80 float80_t
1147  */
1148 typedef npy_float32 __pyx_t_5numpy_float32_t;
1149 
1150 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":705
1151  *
1152  * ctypedef npy_float32 float32_t
1153  * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
1154  * #ctypedef npy_float80 float80_t
1155  * #ctypedef npy_float128 float128_t
1156  */
1157 typedef npy_float64 __pyx_t_5numpy_float64_t;
1158 
1159 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":714
1160  * # The int types are mapped a bit surprising --
1161  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1162  * ctypedef npy_long int_t # <<<<<<<<<<<<<<
1163  * ctypedef npy_longlong long_t
1164  * ctypedef npy_longlong longlong_t
1165  */
1166 typedef npy_long __pyx_t_5numpy_int_t;
1167 
1168 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":715
1169  * # numpy.int corresponds to 'l' and numpy.long to 'q'
1170  * ctypedef npy_long int_t
1171  * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
1172  * ctypedef npy_longlong longlong_t
1173  *
1174  */
1175 typedef npy_longlong __pyx_t_5numpy_long_t;
1176 
1177 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":716
1178  * ctypedef npy_long int_t
1179  * ctypedef npy_longlong long_t
1180  * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
1181  *
1182  * ctypedef npy_ulong uint_t
1183  */
1184 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1185 
1186 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":718
1187  * ctypedef npy_longlong longlong_t
1188  *
1189  * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
1190  * ctypedef npy_ulonglong ulong_t
1191  * ctypedef npy_ulonglong ulonglong_t
1192  */
1193 typedef npy_ulong __pyx_t_5numpy_uint_t;
1194 
1195 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":719
1196  *
1197  * ctypedef npy_ulong uint_t
1198  * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
1199  * ctypedef npy_ulonglong ulonglong_t
1200  *
1201  */
1202 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1203 
1204 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":720
1205  * ctypedef npy_ulong uint_t
1206  * ctypedef npy_ulonglong ulong_t
1207  * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
1208  *
1209  * ctypedef npy_intp intp_t
1210  */
1211 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1212 
1213 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":722
1214  * ctypedef npy_ulonglong ulonglong_t
1215  *
1216  * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
1217  * ctypedef npy_uintp uintp_t
1218  *
1219  */
1220 typedef npy_intp __pyx_t_5numpy_intp_t;
1221 
1222 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":723
1223  *
1224  * ctypedef npy_intp intp_t
1225  * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
1226  *
1227  * ctypedef npy_double float_t
1228  */
1229 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1230 
1231 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":725
1232  * ctypedef npy_uintp uintp_t
1233  *
1234  * ctypedef npy_double float_t # <<<<<<<<<<<<<<
1235  * ctypedef npy_double double_t
1236  * ctypedef npy_longdouble longdouble_t
1237  */
1238 typedef npy_double __pyx_t_5numpy_float_t;
1239 
1240 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":726
1241  *
1242  * ctypedef npy_double float_t
1243  * ctypedef npy_double double_t # <<<<<<<<<<<<<<
1244  * ctypedef npy_longdouble longdouble_t
1245  *
1246  */
1247 typedef npy_double __pyx_t_5numpy_double_t;
1248 
1249 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":727
1250  * ctypedef npy_double float_t
1251  * ctypedef npy_double double_t
1252  * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
1253  *
1254  * ctypedef npy_cfloat cfloat_t
1255  */
1256 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1257 /* Declarations.proto */
1258 #if CYTHON_CCOMPLEX
1259  #ifdef __cplusplus
1260  typedef ::std::complex< float > __pyx_t_float_complex;
1261  #else
1262  typedef float _Complex __pyx_t_float_complex;
1263  #endif
1264 #else
1265  typedef struct { float real, imag; } __pyx_t_float_complex;
1266 #endif
1267 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
1268 
1269 /* Declarations.proto */
1270 #if CYTHON_CCOMPLEX
1271  #ifdef __cplusplus
1272  typedef ::std::complex< double > __pyx_t_double_complex;
1273  #else
1274  typedef double _Complex __pyx_t_double_complex;
1275  #endif
1276 #else
1277  typedef struct { double real, imag; } __pyx_t_double_complex;
1278 #endif
1279 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
1280 
1281 
1282 /*--- Type declarations ---*/
1283 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues;
1284 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr;
1285 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr;
1286 struct __pyx_array_obj;
1287 struct __pyx_MemviewEnum_obj;
1288 struct __pyx_memoryview_obj;
1289 struct __pyx_memoryviewslice_obj;
1290 
1291 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":729
1292  * ctypedef npy_longdouble longdouble_t
1293  *
1294  * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
1295  * ctypedef npy_cdouble cdouble_t
1296  * ctypedef npy_clongdouble clongdouble_t
1297  */
1298 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1299 
1300 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":730
1301  *
1302  * ctypedef npy_cfloat cfloat_t
1303  * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
1304  * ctypedef npy_clongdouble clongdouble_t
1305  *
1306  */
1307 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1308 
1309 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":731
1310  * ctypedef npy_cfloat cfloat_t
1311  * ctypedef npy_cdouble cdouble_t
1312  * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
1313  *
1314  * ctypedef npy_cdouble complex_t
1315  */
1316 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1317 
1318 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":733
1319  * ctypedef npy_clongdouble clongdouble_t
1320  *
1321  * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
1322  *
1323  * cdef inline object PyArray_MultiIterNew1(a):
1324  */
1325 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1326 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace;
1327 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid;
1328 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes;
1329 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle;
1330 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality;
1331 
1332 /* "mprans/MeshSmoothing.pxd":6
1333  * from libcpp cimport bool
1334  *
1335  * cdef void cySmoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
1336  * int[:] nodeStarOffsets,
1337  * int[:] nodeStarArray,
1338  */
1339 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace {
1340  int __pyx_n;
1341  bool simultaneous;
1342  bool smoothBoundaries;
1343  __Pyx_memviewslice fixedNodesBoolArray;
1344  double alpha;
1345 };
1346 
1347 /* "mprans/MeshSmoothing.pxd":17
1348  * double alpha=*)
1349  *
1350  * cdef void cySmoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
1351  * int[:] nodeElementOffsets,
1352  * int[:] nodeElementsArray,
1353  */
1354 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid {
1355  int __pyx_n;
1356  bool simultaneous;
1357  bool smoothBoundaries;
1358  double alpha;
1359 };
1360 
1361 /* "mprans/MeshSmoothing.pxd":41
1362  * int nElements)
1363  *
1364  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
1365  * double[:,:] nodeArray,
1366  * int[:,:] elementNodesArray,
1367  */
1368 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes {
1369  int __pyx_n;
1370  bool el_average;
1371 };
1372 
1373 /* "mprans/MeshSmoothing.pxd":55
1374  * int nElements)
1375  *
1376  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
1377  * double[:,:] nodeArray,
1378  * int[:,:] elementNodesArray,
1379  */
1380 struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle {
1381  int __pyx_n;
1382  bool el_average;
1383 };
1384 
1385 /* "mprans/MeshSmoothing.pxd":62
1386  * bool el_average=*)
1387  *
1388  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
1389  * double[:] dilation,
1390  * double[:,:] nodeArray,
1391  */
1392 struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality {
1393  int __pyx_n;
1394  bool apply_directly;
1395 };
1396 
1397 /* "mprans/MeshSmoothing.pyx":559
1398  * nNodes=nNodes)
1399  *
1400  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
1401  * int nNodes_owned,
1402  * int nNodes_global,
1403  */
1404 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues {
1405  PyObject_HEAD
1406  int __pyx_v_comm_size;
1407 };
1408 
1409 
1410 /* "mprans/MeshSmoothing.pyx":625
1411  * comm.Gatherv(my_size,
1412  * [counts_in,
1413  * tuple(1 for i in range(comm_size)), # <<<<<<<<<<<<<<
1414  * tuple(i for i in range(comm_size)),
1415  * MPI.INT],
1416  */
1417 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr {
1418  PyObject_HEAD
1419  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_outer_scope;
1420  int __pyx_v_i;
1421  int __pyx_t_0;
1422  int __pyx_t_1;
1423  int __pyx_t_2;
1424 };
1425 
1426 
1427 /* "mprans/MeshSmoothing.pyx":626
1428  * [counts_in,
1429  * tuple(1 for i in range(comm_size)),
1430  * tuple(i for i in range(comm_size)), # <<<<<<<<<<<<<<
1431  * MPI.INT],
1432  * root=rank_recv
1433  */
1434 struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr {
1435  PyObject_HEAD
1436  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_outer_scope;
1437  int __pyx_v_i;
1438  int __pyx_t_0;
1439  int __pyx_t_1;
1440  int __pyx_t_2;
1441 };
1442 
1443 
1444 /* "View.MemoryView":105
1445  *
1446  * @cname("__pyx_array")
1447  * cdef class array: # <<<<<<<<<<<<<<
1448  *
1449  * cdef:
1450  */
1451 struct __pyx_array_obj {
1452  PyObject_HEAD
1453  struct __pyx_vtabstruct_array *__pyx_vtab;
1454  char *data;
1455  Py_ssize_t len;
1456  char *format;
1457  int ndim;
1458  Py_ssize_t *_shape;
1459  Py_ssize_t *_strides;
1460  Py_ssize_t itemsize;
1461  PyObject *mode;
1462  PyObject *_format;
1463  void (*callback_free_data)(void *);
1464  int free_data;
1465  int dtype_is_object;
1466 };
1467 
1468 
1469 /* "View.MemoryView":279
1470  *
1471  * @cname('__pyx_MemviewEnum')
1472  * cdef class Enum(object): # <<<<<<<<<<<<<<
1473  * cdef object name
1474  * def __init__(self, name):
1475  */
1476 struct __pyx_MemviewEnum_obj {
1477  PyObject_HEAD
1478  PyObject *name;
1479 };
1480 
1481 
1482 /* "View.MemoryView":330
1483  *
1484  * @cname('__pyx_memoryview')
1485  * cdef class memoryview(object): # <<<<<<<<<<<<<<
1486  *
1487  * cdef object obj
1488  */
1489 struct __pyx_memoryview_obj {
1490  PyObject_HEAD
1491  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1492  PyObject *obj;
1493  PyObject *_size;
1494  PyObject *_array_interface;
1495  PyThread_type_lock lock;
1496  __pyx_atomic_int acquisition_count[2];
1497  __pyx_atomic_int *acquisition_count_aligned_p;
1498  Py_buffer view;
1499  int flags;
1500  int dtype_is_object;
1501  __Pyx_TypeInfo *typeinfo;
1502 };
1503 
1504 
1505 /* "View.MemoryView":965
1506  *
1507  * @cname('__pyx_memoryviewslice')
1508  * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1509  * "Internal class for passing memoryview slices to Python"
1510  *
1511  */
1512 struct __pyx_memoryviewslice_obj {
1513  struct __pyx_memoryview_obj __pyx_base;
1514  __Pyx_memviewslice from_slice;
1515  PyObject *from_object;
1516  PyObject *(*to_object_func)(char *);
1517  int (*to_dtype_func)(char *, PyObject *);
1518 };
1519 
1520 
1521 
1522 /* "View.MemoryView":105
1523  *
1524  * @cname("__pyx_array")
1525  * cdef class array: # <<<<<<<<<<<<<<
1526  *
1527  * cdef:
1528  */
1529 
1530 struct __pyx_vtabstruct_array {
1531  PyObject *(*get_memview)(struct __pyx_array_obj *);
1532 };
1533 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1534 
1535 
1536 /* "View.MemoryView":330
1537  *
1538  * @cname('__pyx_memoryview')
1539  * cdef class memoryview(object): # <<<<<<<<<<<<<<
1540  *
1541  * cdef object obj
1542  */
1543 
1544 struct __pyx_vtabstruct_memoryview {
1545  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1546  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1547  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1548  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1549  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1550  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1551  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1552 };
1553 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1554 
1555 
1556 /* "View.MemoryView":965
1557  *
1558  * @cname('__pyx_memoryviewslice')
1559  * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1560  * "Internal class for passing memoryview slices to Python"
1561  *
1562  */
1563 
1564 struct __pyx_vtabstruct__memoryviewslice {
1565  struct __pyx_vtabstruct_memoryview __pyx_base;
1566 };
1567 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1568 
1569 /* --- Runtime support code (head) --- */
1570 /* Refnanny.proto */
1571 #ifndef CYTHON_REFNANNY
1572  #define CYTHON_REFNANNY 0
1573 #endif
1574 #if CYTHON_REFNANNY
1575  typedef struct {
1576  void (*INCREF)(void*, PyObject*, int);
1577  void (*DECREF)(void*, PyObject*, int);
1578  void (*GOTREF)(void*, PyObject*, int);
1579  void (*GIVEREF)(void*, PyObject*, int);
1580  void* (*SetupContext)(const char*, int, const char*);
1581  void (*FinishContext)(void**);
1582  } __Pyx_RefNannyAPIStruct;
1583  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1584  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1585  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1586 #ifdef WITH_THREAD
1587  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1588  if (acquire_gil) {\
1589  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1590  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1591  PyGILState_Release(__pyx_gilstate_save);\
1592  } else {\
1593  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1594  }
1595 #else
1596  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1597  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1598 #endif
1599  #define __Pyx_RefNannyFinishContext()\
1600  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1601  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1602  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1603  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1604  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1605  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1606  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1607  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1608  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1609 #else
1610  #define __Pyx_RefNannyDeclarations
1611  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1612  #define __Pyx_RefNannyFinishContext()
1613  #define __Pyx_INCREF(r) Py_INCREF(r)
1614  #define __Pyx_DECREF(r) Py_DECREF(r)
1615  #define __Pyx_GOTREF(r)
1616  #define __Pyx_GIVEREF(r)
1617  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1618  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1619  #define __Pyx_XGOTREF(r)
1620  #define __Pyx_XGIVEREF(r)
1621 #endif
1622 #define __Pyx_XDECREF_SET(r, v) do {\
1623  PyObject *tmp = (PyObject *) r;\
1624  r = v; __Pyx_XDECREF(tmp);\
1625  } while (0)
1626 #define __Pyx_DECREF_SET(r, v) do {\
1627  PyObject *tmp = (PyObject *) r;\
1628  r = v; __Pyx_DECREF(tmp);\
1629  } while (0)
1630 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1631 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1632 
1633 /* PyObjectGetAttrStr.proto */
1634 #if CYTHON_USE_TYPE_SLOTS
1635 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1636 #else
1637 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1638 #endif
1639 
1640 /* GetBuiltinName.proto */
1641 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1642 
1643 /* RaiseArgTupleInvalid.proto */
1644 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1645  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1646 
1647 /* RaiseDoubleKeywords.proto */
1648 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1649 
1650 /* ParseKeywords.proto */
1651 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1652  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1653  const char* function_name);
1654 
1655 /* MemviewSliceInit.proto */
1656 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1657 #define __Pyx_MEMVIEW_DIRECT 1
1658 #define __Pyx_MEMVIEW_PTR 2
1659 #define __Pyx_MEMVIEW_FULL 4
1660 #define __Pyx_MEMVIEW_CONTIG 8
1661 #define __Pyx_MEMVIEW_STRIDED 16
1662 #define __Pyx_MEMVIEW_FOLLOW 32
1663 #define __Pyx_IS_C_CONTIG 1
1664 #define __Pyx_IS_F_CONTIG 2
1665 static int __Pyx_init_memviewslice(
1666  struct __pyx_memoryview_obj *memview,
1667  int ndim,
1668  __Pyx_memviewslice *memviewslice,
1669  int memview_is_new_reference);
1670 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1671  __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1672 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1673  __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1674 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1675 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1676 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1677 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1678 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1679 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1680 
1681 /* PyDictVersioning.proto */
1682 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1683 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1684 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1685 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1686  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1687  (cache_var) = (value);
1688 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1689  static PY_UINT64_T __pyx_dict_version = 0;\
1690  static PyObject *__pyx_dict_cached_value = NULL;\
1691  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1692  (VAR) = __pyx_dict_cached_value;\
1693  } else {\
1694  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1695  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1696  }\
1697 }
1698 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1699 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1700 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1701 #else
1702 #define __PYX_GET_DICT_VERSION(dict) (0)
1703 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1704 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1705 #endif
1706 
1707 /* GetModuleGlobalName.proto */
1708 #if CYTHON_USE_DICT_VERSIONS
1709 #define __Pyx_GetModuleGlobalName(var, name) {\
1710  static PY_UINT64_T __pyx_dict_version = 0;\
1711  static PyObject *__pyx_dict_cached_value = NULL;\
1712  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1713  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1714  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1715 }
1716 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1717  PY_UINT64_T __pyx_dict_version;\
1718  PyObject *__pyx_dict_cached_value;\
1719  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1720 }
1721 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1722 #else
1723 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1724 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1725 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1726 #endif
1727 
1728 /* PyCFunctionFastCall.proto */
1729 #if CYTHON_FAST_PYCCALL
1730 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1731 #else
1732 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1733 #endif
1734 
1735 /* PyFunctionFastCall.proto */
1736 #if CYTHON_FAST_PYCALL
1737 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1738  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1739 #if 1 || PY_VERSION_HEX < 0x030600B1
1740 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1741 #else
1742 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1743 #endif
1744 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1745  (sizeof(char [1 - 2*!(cond)]) - 1)
1746 #ifndef Py_MEMBER_SIZE
1747 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1748 #endif
1749 #if CYTHON_FAST_PYCALL
1750  static size_t __pyx_pyframe_localsplus_offset = 0;
1751  #include "frameobject.h"
1752 #if PY_VERSION_HEX >= 0x030b00a6
1753  #ifndef Py_BUILD_CORE
1754  #define Py_BUILD_CORE 1
1755  #endif
1756  #include "internal/pycore_frame.h"
1757 #endif
1758  #define __Pxy_PyFrame_Initialize_Offsets()\
1759  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1760  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1761  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1762  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1763 #endif // CYTHON_FAST_PYCALL
1764 #endif
1765 
1766 /* PyObjectCall.proto */
1767 #if CYTHON_COMPILING_IN_CPYTHON
1768 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1769 #else
1770 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1771 #endif
1772 
1773 /* PyObjectCall2Args.proto */
1774 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1775 
1776 /* PyObjectCallMethO.proto */
1777 #if CYTHON_COMPILING_IN_CPYTHON
1778 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1779 #endif
1780 
1781 /* PyObjectCallOneArg.proto */
1782 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1783 
1784 /* PyIntBinop.proto */
1785 #if !CYTHON_COMPILING_IN_PYPY
1786 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
1787 #else
1788 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1789  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1790 #endif
1791 
1792 /* GetItemInt.proto */
1793 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1794  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1795  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1796  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1797  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1798 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1799  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1800  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1801  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1802 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1803  int wraparound, int boundscheck);
1804 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1805  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1806  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1807  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1808 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1809  int wraparound, int boundscheck);
1810 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1811 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1812  int is_list, int wraparound, int boundscheck);
1813 
1814 /* ObjectGetItem.proto */
1815 #if CYTHON_USE_TYPE_SLOTS
1816 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1817 #else
1818 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1819 #endif
1820 
1821 /* ListAppend.proto */
1822 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1823 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1824  PyListObject* L = (PyListObject*) list;
1825  Py_ssize_t len = Py_SIZE(list);
1826  if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1827  Py_INCREF(x);
1828  PyList_SET_ITEM(list, len, x);
1829  __Pyx_SET_SIZE(list, len + 1);
1830  return 0;
1831  }
1832  return PyList_Append(list, x);
1833 }
1834 #else
1835 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1836 #endif
1837 
1838 /* IterFinish.proto */
1839 static CYTHON_INLINE int __Pyx_IterFinish(void);
1840 
1841 /* set_iter.proto */
1842 static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
1843  Py_ssize_t* p_orig_length, int* p_source_is_set);
1844 static CYTHON_INLINE int __Pyx_set_iter_next(
1845  PyObject* iter_obj, Py_ssize_t orig_length,
1846  Py_ssize_t* ppos, PyObject **value,
1847  int source_is_set);
1848 
1849 /* PySequenceContains.proto */
1850 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1851  int result = PySequence_Contains(seq, item);
1852  return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1853 }
1854 
1855 /* Import.proto */
1856 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1857 
1858 /* ImportFrom.proto */
1859 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1860 
1861 /* PyObjectCallNoArg.proto */
1862 #if CYTHON_COMPILING_IN_CPYTHON
1863 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1864 #else
1865 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1866 #endif
1867 
1868 /* DictGetItem.proto */
1869 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1870 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1871 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
1872  (likely(PyDict_CheckExact(obj)) ?\
1873  __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1874 #else
1875 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1876 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1877 #endif
1878 
1879 /* SliceObject.proto */
1880 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
1881  PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
1882  PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1883  int has_cstart, int has_cstop, int wraparound);
1884 
1885 /* SetItemInt.proto */
1886 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1887  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1888  __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1889  (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1890  __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1891 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1892 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1893  int is_list, int wraparound, int boundscheck);
1894 
1895 /* PyThreadStateGet.proto */
1896 #if CYTHON_FAST_THREAD_STATE
1897 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1898 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1899 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1900 #else
1901 #define __Pyx_PyThreadState_declare
1902 #define __Pyx_PyThreadState_assign
1903 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1904 #endif
1905 
1906 /* PyErrFetchRestore.proto */
1907 #if CYTHON_FAST_THREAD_STATE
1908 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1909 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1910 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1911 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1912 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1913 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1914 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1915 #if CYTHON_COMPILING_IN_CPYTHON
1916 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1917 #else
1918 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1919 #endif
1920 #else
1921 #define __Pyx_PyErr_Clear() PyErr_Clear()
1922 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1923 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1924 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1925 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1926 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1927 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1928 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1929 #endif
1930 
1931 /* WriteUnraisableException.proto */
1932 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1933  int lineno, const char *filename,
1934  int full_traceback, int nogil);
1935 
1936 /* ExtTypeTest.proto */
1937 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1938 
1939 /* IncludeStringH.proto */
1940 #include <string.h>
1941 
1942 /* GetTopmostException.proto */
1943 #if CYTHON_USE_EXC_INFO_STACK
1944 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1945 #endif
1946 
1947 /* SaveResetException.proto */
1948 #if CYTHON_FAST_THREAD_STATE
1949 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1950 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1951 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1952 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1953 #else
1954 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1955 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1956 #endif
1957 
1958 /* PyErrExceptionMatches.proto */
1959 #if CYTHON_FAST_THREAD_STATE
1960 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1961 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1962 #else
1963 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1964 #endif
1965 
1966 /* GetException.proto */
1967 #if CYTHON_FAST_THREAD_STATE
1968 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1969 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1970 #else
1971 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1972 #endif
1973 
1974 /* RaiseException.proto */
1975 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1976 
1977 /* ArgTypeTest.proto */
1978 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1979  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1980  __Pyx__ArgTypeTest(obj, type, name, exact))
1981 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1982 
1983 /* BytesEquals.proto */
1984 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1985 
1986 /* UnicodeEquals.proto */
1987 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1988 
1989 /* StrEquals.proto */
1990 #if PY_MAJOR_VERSION >= 3
1991 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1992 #else
1993 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1994 #endif
1995 
1996 /* UnaryNegOverflows.proto */
1997 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1998  (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1999 
2000 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2001 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
2002 /* GetAttr.proto */
2003 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
2004 
2005 /* decode_c_string_utf16.proto */
2006 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
2007  int byteorder = 0;
2008  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2009 }
2010 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
2011  int byteorder = -1;
2012  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2013 }
2014 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
2015  int byteorder = 1;
2016  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2017 }
2018 
2019 /* decode_c_string.proto */
2020 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2021  const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2022  const char* encoding, const char* errors,
2023  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
2024 
2025 /* GetAttr3.proto */
2026 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
2027 
2028 /* RaiseTooManyValuesToUnpack.proto */
2029 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
2030 
2031 /* RaiseNeedMoreValuesToUnpack.proto */
2032 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
2033 
2034 /* RaiseNoneIterError.proto */
2035 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
2036 
2037 /* SwapException.proto */
2038 #if CYTHON_FAST_THREAD_STATE
2039 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2040 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2041 #else
2042 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2043 #endif
2044 
2045 /* FastTypeChecks.proto */
2046 #if CYTHON_COMPILING_IN_CPYTHON
2047 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2048 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2049 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2050 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2051 #else
2052 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2053 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2054 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2055 #endif
2056 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2057 
2058 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2059 /* ListCompAppend.proto */
2060 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2061 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2062  PyListObject* L = (PyListObject*) list;
2063  Py_ssize_t len = Py_SIZE(list);
2064  if (likely(L->allocated > len)) {
2065  Py_INCREF(x);
2066  PyList_SET_ITEM(list, len, x);
2067  __Pyx_SET_SIZE(list, len + 1);
2068  return 0;
2069  }
2070  return PyList_Append(list, x);
2071 }
2072 #else
2073 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2074 #endif
2075 
2076 /* ListExtend.proto */
2077 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2078 #if CYTHON_COMPILING_IN_CPYTHON
2079  PyObject* none = _PyList_Extend((PyListObject*)L, v);
2080  if (unlikely(!none))
2081  return -1;
2082  Py_DECREF(none);
2083  return 0;
2084 #else
2085  return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2086 #endif
2087 }
2088 
2089 /* None.proto */
2090 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
2091 
2092 /* HasAttr.proto */
2093 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
2094 
2095 /* StringJoin.proto */
2096 #if PY_MAJOR_VERSION < 3
2097 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
2098 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
2099 #else
2100 #define __Pyx_PyString_Join PyUnicode_Join
2101 #define __Pyx_PyBaseString_Join PyUnicode_Join
2102 #endif
2103 #if CYTHON_COMPILING_IN_CPYTHON
2104  #if PY_MAJOR_VERSION < 3
2105  #define __Pyx_PyBytes_Join _PyString_Join
2106  #else
2107  #define __Pyx_PyBytes_Join _PyBytes_Join
2108  #endif
2109 #else
2110 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
2111 #endif
2112 
2113 /* PyObject_Unicode.proto */
2114 #if PY_MAJOR_VERSION >= 3
2115 #define __Pyx_PyObject_Unicode(obj)\
2116  (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
2117 #else
2118 #define __Pyx_PyObject_Unicode(obj)\
2119  (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
2120 #endif
2121 
2122 /* PyObject_GenericGetAttrNoDict.proto */
2123 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2124 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2125 #else
2126 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2127 #endif
2128 
2129 /* PyObject_GenericGetAttr.proto */
2130 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2131 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2132 #else
2133 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2134 #endif
2135 
2136 /* SetVTable.proto */
2137 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2138 
2139 /* PyObjectGetAttrStrNoError.proto */
2140 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2141 
2142 /* SetupReduce.proto */
2143 static int __Pyx_setup_reduce(PyObject* type_obj);
2144 
2145 /* TypeImport.proto */
2146 #ifndef __PYX_HAVE_RT_ImportType_proto
2147 #define __PYX_HAVE_RT_ImportType_proto
2148 enum __Pyx_ImportType_CheckSize {
2149  __Pyx_ImportType_CheckSize_Error = 0,
2150  __Pyx_ImportType_CheckSize_Warn = 1,
2151  __Pyx_ImportType_CheckSize_Ignore = 2
2152 };
2153 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
2154 #endif
2155 
2156 /* CLineInTraceback.proto */
2157 #ifdef CYTHON_CLINE_IN_TRACEBACK
2158 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2159 #else
2160 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2161 #endif
2162 
2163 /* CodeObjectCache.proto */
2164 typedef struct {
2165  PyCodeObject* code_object;
2166  int code_line;
2167 } __Pyx_CodeObjectCacheEntry;
2168 struct __Pyx_CodeObjectCache {
2169  int count;
2170  int max_count;
2171  __Pyx_CodeObjectCacheEntry* entries;
2172 };
2173 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2174 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2175 static PyCodeObject *__pyx_find_code_object(int code_line);
2176 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2177 
2178 /* AddTraceback.proto */
2179 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2180  int py_line, const char *filename);
2181 
2182 #if PY_MAJOR_VERSION < 3
2183  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2184  static void __Pyx_ReleaseBuffer(Py_buffer *view);
2185 #else
2186  #define __Pyx_GetBuffer PyObject_GetBuffer
2187  #define __Pyx_ReleaseBuffer PyBuffer_Release
2188 #endif
2189 
2190 
2191 /* BufferStructDeclare.proto */
2192 typedef struct {
2193  Py_ssize_t shape, strides, suboffsets;
2194 } __Pyx_Buf_DimInfo;
2195 typedef struct {
2196  size_t refcount;
2197  Py_buffer pybuffer;
2198 } __Pyx_Buffer;
2199 typedef struct {
2200  __Pyx_Buffer *rcbuffer;
2201  char *data;
2202  __Pyx_Buf_DimInfo diminfo[8];
2203 } __Pyx_LocalBuf_ND;
2204 
2205 /* MemviewSliceIsContig.proto */
2206 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2207 
2208 /* OverlappingSlices.proto */
2209 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2210  __Pyx_memviewslice *slice2,
2211  int ndim, size_t itemsize);
2212 
2213 /* Capsule.proto */
2214 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2215 
2216 /* IsLittleEndian.proto */
2217 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2218 
2219 /* BufferFormatCheck.proto */
2220 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2221 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2222  __Pyx_BufFmt_StackElem* stack,
2223  __Pyx_TypeInfo* type);
2224 
2225 /* TypeInfoCompare.proto */
2226 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2227 
2228 /* MemviewSliceValidateAndInit.proto */
2229 static int __Pyx_ValidateAndInit_memviewslice(
2230  int *axes_specs,
2231  int c_or_f_flag,
2232  int buf_flags,
2233  int ndim,
2234  __Pyx_TypeInfo *dtype,
2235  __Pyx_BufFmt_StackElem stack[],
2236  __Pyx_memviewslice *memviewslice,
2237  PyObject *original_obj);
2238 
2239 /* ObjectToMemviewSlice.proto */
2240 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *, int writable_flag);
2241 
2242 /* ObjectToMemviewSlice.proto */
2243 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *, int writable_flag);
2244 
2245 /* GCCDiagnostics.proto */
2246 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2247 #define __Pyx_HAS_GCC_DIAGNOSTIC
2248 #endif
2249 
2250 /* ObjectToMemviewSlice.proto */
2251 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag);
2252 
2253 /* ObjectToMemviewSlice.proto */
2254 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *, int writable_flag);
2255 
2256 /* ObjectToMemviewSlice.proto */
2257 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *, int writable_flag);
2258 
2259 /* ObjectToMemviewSlice.proto */
2260 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *, int writable_flag);
2261 
2262 /* MemviewDtypeToObject.proto */
2263 static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
2264 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj);
2265 
2266 /* MemviewDtypeToObject.proto */
2267 static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp);
2268 static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj);
2269 
2270 /* RealImag.proto */
2271 #if CYTHON_CCOMPLEX
2272  #ifdef __cplusplus
2273  #define __Pyx_CREAL(z) ((z).real())
2274  #define __Pyx_CIMAG(z) ((z).imag())
2275  #else
2276  #define __Pyx_CREAL(z) (__real__(z))
2277  #define __Pyx_CIMAG(z) (__imag__(z))
2278  #endif
2279 #else
2280  #define __Pyx_CREAL(z) ((z).real)
2281  #define __Pyx_CIMAG(z) ((z).imag)
2282 #endif
2283 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2284  && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2285  #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2286  #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2287 #else
2288  #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2289  #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2290 #endif
2291 
2292 /* Arithmetic.proto */
2293 #if CYTHON_CCOMPLEX
2294  #define __Pyx_c_eq_float(a, b) ((a)==(b))
2295  #define __Pyx_c_sum_float(a, b) ((a)+(b))
2296  #define __Pyx_c_diff_float(a, b) ((a)-(b))
2297  #define __Pyx_c_prod_float(a, b) ((a)*(b))
2298  #define __Pyx_c_quot_float(a, b) ((a)/(b))
2299  #define __Pyx_c_neg_float(a) (-(a))
2300  #ifdef __cplusplus
2301  #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2302  #define __Pyx_c_conj_float(z) (::std::conj(z))
2303  #if 1
2304  #define __Pyx_c_abs_float(z) (::std::abs(z))
2305  #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2306  #endif
2307  #else
2308  #define __Pyx_c_is_zero_float(z) ((z)==0)
2309  #define __Pyx_c_conj_float(z) (conjf(z))
2310  #if 1
2311  #define __Pyx_c_abs_float(z) (cabsf(z))
2312  #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2313  #endif
2314  #endif
2315 #else
2316  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2317  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2318  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2319  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2320  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2321  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2322  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2323  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2324  #if 1
2325  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
2326  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2327  #endif
2328 #endif
2329 
2330 /* Arithmetic.proto */
2331 #if CYTHON_CCOMPLEX
2332  #define __Pyx_c_eq_double(a, b) ((a)==(b))
2333  #define __Pyx_c_sum_double(a, b) ((a)+(b))
2334  #define __Pyx_c_diff_double(a, b) ((a)-(b))
2335  #define __Pyx_c_prod_double(a, b) ((a)*(b))
2336  #define __Pyx_c_quot_double(a, b) ((a)/(b))
2337  #define __Pyx_c_neg_double(a) (-(a))
2338  #ifdef __cplusplus
2339  #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2340  #define __Pyx_c_conj_double(z) (::std::conj(z))
2341  #if 1
2342  #define __Pyx_c_abs_double(z) (::std::abs(z))
2343  #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2344  #endif
2345  #else
2346  #define __Pyx_c_is_zero_double(z) ((z)==0)
2347  #define __Pyx_c_conj_double(z) (conj(z))
2348  #if 1
2349  #define __Pyx_c_abs_double(z) (cabs(z))
2350  #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2351  #endif
2352  #endif
2353 #else
2354  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2355  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2356  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2357  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2358  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2359  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2360  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2361  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2362  #if 1
2363  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
2364  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2365  #endif
2366 #endif
2367 
2368 /* MemviewSliceCopyTemplate.proto */
2369 static __Pyx_memviewslice
2370 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2371  const char *mode, int ndim,
2372  size_t sizeof_dtype, int contig_flag,
2373  int dtype_is_object);
2374 
2375 /* CIntFromPy.proto */
2376 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2377 
2378 /* CIntToPy.proto */
2379 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2380 
2381 /* CIntFromPy.proto */
2382 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2383 
2384 /* TypeInfoToFormat.proto */
2385 struct __pyx_typeinfo_string {
2386  char string[3];
2387 };
2388 static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);
2389 
2390 /* CIntToPy.proto */
2391 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2392 
2393 /* CopyContentsUtility.proto */
2394 #define __pyx_memoryview_copy_slice_d_dc_double_c(slice)\
2395  __pyx_memoryview_copy_new_contig(&slice, "c", 2,\
2396  sizeof(double), (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT),\
2397  0)
2398 
2399 /* CopyContentsUtility.proto */
2400 #define __pyx_memoryview_copy_slice_dcd__double_f(slice)\
2401  __pyx_memoryview_copy_new_contig(&slice, "fortran", 2,\
2402  sizeof(double), (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT),\
2403  0)
2404 
2405 /* CIntFromPy.proto */
2406 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2407 
2408 /* FetchCommonType.proto */
2409 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2410 
2411 /* PyObjectGetMethod.proto */
2412 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
2413 
2414 /* PyObjectCallMethod1.proto */
2415 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
2416 
2417 /* CoroutineBase.proto */
2418 typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyThreadState *, PyObject *);
2419 #if CYTHON_USE_EXC_INFO_STACK
2420 #define __Pyx_ExcInfoStruct _PyErr_StackItem
2421 #else
2422 typedef struct {
2423  PyObject *exc_type;
2424  PyObject *exc_value;
2425  PyObject *exc_traceback;
2426 } __Pyx_ExcInfoStruct;
2427 #endif
2428 typedef struct {
2429  PyObject_HEAD
2430  __pyx_coroutine_body_t body;
2431  PyObject *closure;
2432  __Pyx_ExcInfoStruct gi_exc_state;
2433  PyObject *gi_weakreflist;
2434  PyObject *classobj;
2435  PyObject *yieldfrom;
2436  PyObject *gi_name;
2437  PyObject *gi_qualname;
2438  PyObject *gi_modulename;
2439  PyObject *gi_code;
2440  PyObject *gi_frame;
2441  int resume_label;
2442  char is_running;
2443 } __pyx_CoroutineObject;
2444 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
2445  PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2446  PyObject *name, PyObject *qualname, PyObject *module_name);
2447 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
2448  __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
2449  PyObject *name, PyObject *qualname, PyObject *module_name);
2450 static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *self);
2451 static int __Pyx_Coroutine_clear(PyObject *self);
2452 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value);
2453 static PyObject *__Pyx_Coroutine_Close(PyObject *self);
2454 static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args);
2455 #if CYTHON_USE_EXC_INFO_STACK
2456 #define __Pyx_Coroutine_SwapException(self)
2457 #define __Pyx_Coroutine_ResetAndClearException(self) __Pyx_Coroutine_ExceptionClear(&(self)->gi_exc_state)
2458 #else
2459 #define __Pyx_Coroutine_SwapException(self) {\
2460  __Pyx_ExceptionSwap(&(self)->gi_exc_state.exc_type, &(self)->gi_exc_state.exc_value, &(self)->gi_exc_state.exc_traceback);\
2461  __Pyx_Coroutine_ResetFrameBackpointer(&(self)->gi_exc_state);\
2462  }
2463 #define __Pyx_Coroutine_ResetAndClearException(self) {\
2464  __Pyx_ExceptionReset((self)->gi_exc_state.exc_type, (self)->gi_exc_state.exc_value, (self)->gi_exc_state.exc_traceback);\
2465  (self)->gi_exc_state.exc_type = (self)->gi_exc_state.exc_value = (self)->gi_exc_state.exc_traceback = NULL;\
2466  }
2467 #endif
2468 #if CYTHON_FAST_THREAD_STATE
2469 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2470  __Pyx_PyGen__FetchStopIterationValue(__pyx_tstate, pvalue)
2471 #else
2472 #define __Pyx_PyGen_FetchStopIterationValue(pvalue)\
2473  __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, pvalue)
2474 #endif
2475 static int __Pyx_PyGen__FetchStopIterationValue(PyThreadState *tstate, PyObject **pvalue);
2476 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state);
2477 
2478 /* PatchModuleWithCoroutine.proto */
2479 static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);
2480 
2481 /* PatchGeneratorABC.proto */
2482 static int __Pyx_patch_abc(void);
2483 
2484 /* Generator.proto */
2485 #define __Pyx_Generator_USED
2486 static PyTypeObject *__pyx_GeneratorType = 0;
2487 #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
2488 #define __Pyx_Generator_New(body, code, closure, name, qualname, module_name)\
2489  __Pyx__Coroutine_New(__pyx_GeneratorType, body, code, closure, name, qualname, module_name)
2490 static PyObject *__Pyx_Generator_Next(PyObject *self);
2491 static int __pyx_Generator_init(void);
2492 
2493 /* CheckBinaryVersion.proto */
2494 static int __Pyx_check_binary_version(void);
2495 
2496 /* FunctionExport.proto */
2497 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
2498 
2499 /* InitStrings.proto */
2500 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2501 
2502 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2503 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2504 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2505 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2506 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2507 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2508 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2509 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2510 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2511 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2512 
2513 /* Module declarations from 'cython.view' */
2514 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2515 
2516 /* Module declarations from 'cython' */
2517 
2518 /* Module declarations from 'cpython.buffer' */
2519 
2520 /* Module declarations from 'libc.string' */
2521 
2522 /* Module declarations from 'libc.stdio' */
2523 
2524 /* Module declarations from '__builtin__' */
2525 
2526 /* Module declarations from 'cpython.type' */
2527 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2528 
2529 /* Module declarations from 'cpython' */
2530 
2531 /* Module declarations from 'cpython.object' */
2532 
2533 /* Module declarations from 'cpython.ref' */
2534 
2535 /* Module declarations from 'cpython.mem' */
2536 
2537 /* Module declarations from 'numpy' */
2538 
2539 /* Module declarations from 'numpy' */
2540 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2541 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2542 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2543 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2544 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2545 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2546 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2547 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2548 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2549 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2550 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2551 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2552 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2553 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2554 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2555 
2556 /* Module declarations from 'libcpp' */
2557 
2558 /* Module declarations from 'libc.math' */
2559 
2560 /* Module declarations from 'mprans.MeshSmoothing' */
2561 static PyTypeObject *__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = 0;
2562 static PyTypeObject *__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = 0;
2563 static PyTypeObject *__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = 0;
2564 static PyTypeObject *__pyx_array_type = 0;
2565 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2566 static PyTypeObject *__pyx_memoryview_type = 0;
2567 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2568 static PyObject *generic = 0;
2569 static PyObject *strided = 0;
2570 static PyObject *indirect = 0;
2571 static PyObject *contiguous = 0;
2572 static PyObject *indirect_contiguous = 0;
2573 static int __pyx_memoryview_thread_locks_used;
2574 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2575 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace *__pyx_optional_args); /*proto*/
2576 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid *__pyx_optional_args); /*proto*/
2577 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2578 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int); /*proto*/
2579 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes *__pyx_optional_args); /*proto*/
2580 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2581 static double __pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle(int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle *__pyx_optional_args); /*proto*/
2582 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality *__pyx_optional_args); /*proto*/
2583 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2584 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2585 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2586 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2587 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2588 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2589 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2590 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2591 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2592 static PyArrayObject *__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2593 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(int, int, int, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2594 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2595 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2596 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2597 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int); /*proto*/
2598 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle(__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2599 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra(__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2600 static double __pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
2601 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2602 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2603 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2604 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2605 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2606 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2607 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2608 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2609 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2610 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2611 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2612 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2613 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2614 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2615 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2616 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2617 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2618 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2619 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2620 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2621 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2622 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2623 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2624 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2625 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2626 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2627 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2628 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2629 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2630 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2631 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2632 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2633 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2634 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *); /*proto*/
2635 static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
2636 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
2637 #define __Pyx_MODULE_NAME "mprans.MeshSmoothing"
2638 extern int __pyx_module_is_main_mprans__MeshSmoothing;
2639 int __pyx_module_is_main_mprans__MeshSmoothing = 0;
2640 
2641 /* Implementation of 'mprans.MeshSmoothing' */
2642 static PyObject *__pyx_builtin_range;
2643 static PyObject *__pyx_builtin_enumerate;
2644 static PyObject *__pyx_builtin_ImportError;
2645 static PyObject *__pyx_builtin_ValueError;
2646 static PyObject *__pyx_builtin_MemoryError;
2647 static PyObject *__pyx_builtin_TypeError;
2648 static PyObject *__pyx_builtin_Ellipsis;
2649 static PyObject *__pyx_builtin_id;
2650 static PyObject *__pyx_builtin_IndexError;
2651 static const char __pyx_k_O[] = "O";
2652 static const char __pyx_k_T[] = "T{";
2653  static const char __pyx_k_c[] = "c";
2654  static const char __pyx_k_i[] = "i";
2655  static const char __pyx_k_s[] = "(%s)";
2656  static const char __pyx_k_x[] = "x";
2657  static const char __pyx_k_y[] = "y";
2658  static const char __pyx_k_z[] = "z";
2659  static const char __pyx_k_eN[] = "eN";
2660  static const char __pyx_k_iN[] = "iN";
2661  static const char __pyx_k_id[] = "id";
2662  static const char __pyx_k_ii[] = "ii";
2663  static const char __pyx_k_ir[] = "ir";
2664  static const char __pyx_k_nA[] = "nA";
2665  static const char __pyx_k_nB[] = "nB";
2666  static const char __pyx_k_nC[] = "nC";
2667  static const char __pyx_k_nd[] = "nd";
2668  static const char __pyx_k_np[] = "np";
2669  static const char __pyx_k_op[] = "op";
2670  static const char __pyx_k_x2[] = "x2";
2671  static const char __pyx_k_xi[] = "xi";
2672  static const char __pyx_k_y2[] = "y2";
2673  static const char __pyx_k_z2[] = "z2";
2674  static const char __pyx_k_INT[] = "INT";
2675  static const char __pyx_k_MPI[] = "MPI";
2676  static const char __pyx_k_SUM[] = "SUM";
2677  static const char __pyx_k__27[] = "^";
2678  static const char __pyx_k__28[] = "";
2679  static const char __pyx_k__29[] = ":";
2680 static const char __pyx_k__30[] = "}";
2681 static const char __pyx_k__31[] = ",";
2682 static const char __pyx_k_dot[] = "dot";
2683 static const char __pyx_k_get[] = "get";
2684 static const char __pyx_k_inv[] = "inv";
2685 static const char __pyx_k_new[] = "__new__";
2686 static const char __pyx_k_obj[] = "obj";
2687 static const char __pyx_k_Comm[] = "Comm";
2688 static const char __pyx_k_args[] = "args_";
2689 static const char __pyx_k_base[] = "base";
2690 static const char __pyx_k_comm[] = "comm";
2691 static const char __pyx_k_dict[] = "__dict__";
2692 static const char __pyx_k_disp[] = "disp";
2693 static const char __pyx_k_join[] = "join";
2694 static const char __pyx_k_main[] = "__main__";
2695 static const char __pyx_k_mesh[] = "mesh";
2696 static const char __pyx_k_mode[] = "mode";
2697 static const char __pyx_k_name[] = "name";
2698 static const char __pyx_k_ndim[] = "ndim";
2699 static const char __pyx_k_node[] = "node";
2700 static const char __pyx_k_pack[] = "pack";
2701 static const char __pyx_k_rank[] = "rank";
2702 static const char __pyx_k_root[] = "root";
2703 static const char __pyx_k_send[] = "send";
2704 static const char __pyx_k_size[] = "size";
2705 static const char __pyx_k_step[] = "step";
2706 static const char __pyx_k_stop[] = "stop";
2707 static const char __pyx_k_test[] = "__test__";
2708 static const char __pyx_k_ASCII[] = "ASCII";
2709 static const char __pyx_k_alpha[] = "alpha";
2710 static const char __pyx_k_array[] = "array";
2711 static const char __pyx_k_class[] = "__class__";
2712 static const char __pyx_k_close[] = "close";
2713 static const char __pyx_k_dtype[] = "dtype";
2714 static const char __pyx_k_error[] = "error";
2715 static const char __pyx_k_flags[] = "flags";
2716 static const char __pyx_k_int32[] = "int32";
2717 static const char __pyx_k_maxit[] = "maxit";
2718 static const char __pyx_k_node0[] = "node0";
2719 static const char __pyx_k_numpy[] = "numpy";
2720 static const char __pyx_k_range[] = "range";
2721 static const char __pyx_k_shape[] = "shape";
2722 static const char __pyx_k_start[] = "start";
2723 static const char __pyx_k_throw[] = "throw";
2724 static const char __pyx_k_zeros[] = "zeros";
2725 static const char __pyx_k_Commit[] = "Commit";
2726 static const char __pyx_k_DOUBLE[] = "DOUBLE";
2727 static const char __pyx_k_append[] = "append";
2728 static const char __pyx_k_args_2[] = "args";
2729 static const char __pyx_k_astype[] = "astype";
2730 static const char __pyx_k_coords[] = "coords";
2731 static const char __pyx_k_double[] = "double";
2732 static const char __pyx_k_encode[] = "encode";
2733 static const char __pyx_k_format[] = "format";
2734 static const char __pyx_k_import[] = "__import__";
2735 static const char __pyx_k_linalg[] = "linalg";
2736 static const char __pyx_k_mpi4py[] = "mpi4py";
2737 static const char __pyx_k_nNodes[] = "nNodes";
2738 static const char __pyx_k_name_2[] = "__name__";
2739 static const char __pyx_k_pickle[] = "pickle";
2740 static const char __pyx_k_reduce[] = "__reduce__";
2741 static const char __pyx_k_result[] = "result";
2742 static const char __pyx_k_struct[] = "struct";
2743 static const char __pyx_k_sumtot[] = "sumtot";
2744 static const char __pyx_k_unpack[] = "unpack";
2745 static const char __pyx_k_update[] = "update";
2746 static const char __pyx_k_Gatherv[] = "Gatherv";
2747 static const char __pyx_k_J_array[] = "J_array";
2748 static const char __pyx_k_eOffset[] = "eOffset";
2749 static const char __pyx_k_fortran[] = "fortran";
2750 static const char __pyx_k_genexpr[] = "genexpr";
2751 static const char __pyx_k_memview[] = "memview";
2752 static const char __pyx_k_my_rank[] = "my_rank";
2753 static const char __pyx_k_my_size[] = "my_size";
2754 static const char __pyx_k_proteus[] = "proteus";
2755 static const char __pyx_k_scalars[] = "scalars";
2756 static const char __pyx_k_vectors[] = "vectors";
2757 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2758 static const char __pyx_k_datatype[] = "datatype";
2759 static const char __pyx_k_dilation[] = "dilation";
2760 static const char __pyx_k_femSpace[] = "femSpace";
2761 static const char __pyx_k_getstate[] = "__getstate__";
2762 static const char __pyx_k_itemsize[] = "itemsize";
2763 static const char __pyx_k_logEvent[] = "logEvent";
2764 static const char __pyx_k_new_rank[] = "new_rank";
2765 static const char __pyx_k_pyx_type[] = "__pyx_type";
2766 static const char __pyx_k_setstate[] = "__setstate__";
2767 static const char __pyx_k_tompi4py[] = "tompi4py";
2768 static const char __pyx_k_TypeError[] = "TypeError";
2769 static const char __pyx_k_allreduce[] = "allreduce";
2770 static const char __pyx_k_arg_2rank[] = "arg_2rank";
2771 static const char __pyx_k_arg_shape[] = "arg_shape";
2772 static const char __pyx_k_comm_size[] = "comm_size";
2773 static const char __pyx_k_counts_in[] = "counts_in";
2774 static const char __pyx_k_enumerate[] = "enumerate";
2775 static const char __pyx_k_nElements[] = "nElements";
2776 static const char __pyx_k_nodeArray[] = "nodeArray_";
2777 static const char __pyx_k_onElement[] = "onElement";
2778 static const char __pyx_k_pyx_state[] = "__pyx_state";
2779 static const char __pyx_k_rank_recv[] = "rank_recv";
2780 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2781 static const char __pyx_k_transpose[] = "transpose";
2782 static const char __pyx_k_IndexError[] = "IndexError";
2783 static const char __pyx_k_ValueError[] = "ValueError";
2784 static const char __pyx_k_array_size[] = "array_size";
2785 static const char __pyx_k_counts_out[] = "counts_out";
2786 static const char __pyx_k_detJ_array[] = "detJ_array";
2787 static const char __pyx_k_distortion[] = "distortion";
2788 static const char __pyx_k_el_average[] = "el_average";
2789 static const char __pyx_k_nearest_eN[] = "nearest_eN";
2790 static const char __pyx_k_pyx_result[] = "__pyx_result";
2791 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2792 static const char __pyx_k_zeros_like[] = "zeros_like";
2793 static const char __pyx_k_ImportError[] = "ImportError";
2794 static const char __pyx_k_MemoryError[] = "MemoryError";
2795 static const char __pyx_k_PickleError[] = "PickleError";
2796 static const char __pyx_k_elementMaps[] = "elementMaps";
2797 static const char __pyx_k_nodeArray_2[] = "nodeArray";
2798 static const char __pyx_k_nodes_2rank[] = "nodes_2rank";
2799 static const char __pyx_k_arg_2doArray[] = "arg_2doArray";
2800 static const char __pyx_k_nNodes_owned[] = "nNodes_owned";
2801 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2802 static const char __pyx_k_shape_factor[] = "shape_factor";
2803 static const char __pyx_k_simultaneous[] = "simultaneous";
2804 static const char __pyx_k_stringsource[] = "stringsource";
2805 static const char __pyx_k_IMRNodesArray[] = "IMRNodesArray_";
2806 static const char __pyx_k_arg_shape_len[] = "arg_shape_len";
2807 static const char __pyx_k_nNodes_global[] = "nNodes_global";
2808 static const char __pyx_k_nodeStarArray[] = "nodeStarArray";
2809 static const char __pyx_k_node_new_rank[] = "node_new_rank";
2810 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2811 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2812 static const char __pyx_k_apply_directly[] = "apply_directly";
2813 static const char __pyx_k_arg_shape_copy[] = "arg_shape_copy";
2814 static const char __pyx_k_nodes_2doArray[] = "nodes_2doArray";
2815 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2816 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2817 static const char __pyx_k_checkedElements[] = "checkedElements";
2818 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2819 static const char __pyx_k_getInverseValue[] = "getInverseValue";
2820 static const char __pyx_k_getLocalElement[] = "getLocalElement";
2821 static const char __pyx_k_nodeStarOffsets[] = "nodeStarOffsets";
2822 static const char __pyx_k_nodes_2rank_len[] = "nodes_2rank_len";
2823 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2824 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2825 static const char __pyx_k_starting_coords[] = "starting_coords";
2826 static const char __pyx_k_IMRElementsArray[] = "IMRElementsArray_";
2827 static const char __pyx_k_arg_2rank_values[] = "arg_2rank_values";
2828 static const char __pyx_k_displacements_in[] = "displacements_in";
2829 static const char __pyx_k_nVariables_owned[] = "nVariables_owned";
2830 static const char __pyx_k_referenceElement[] = "referenceElement";
2831 static const char __pyx_k_smoothBoundaries[] = "smoothBoundaries";
2832 static const char __pyx_k_Create_contiguous[] = "Create_contiguous";
2833 static const char __pyx_k_displacements_out[] = "displacements_out";
2834 static const char __pyx_k_elementNodesArray[] = "elementNodesArray";
2835 static const char __pyx_k_nodeElementsArray[] = "nodeElementsArray";
2836 static const char __pyx_k_nodeMaterialTypes[] = "nodeMaterialTypes";
2837 static const char __pyx_k_proteus_Profiling[] = "proteus.Profiling";
2838 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2839 static const char __pyx_k_variable_nb_local[] = "variable_nb_local";
2840 static const char __pyx_k_checkOwnedVariable[] = "checkOwnedVariable";
2841 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2842 static const char __pyx_k_elementVolumeArray[] = "elementVolumeArray";
2843 static const char __pyx_k_nodeElementOffsets[] = "nodeElementOffsets";
2844 static const char __pyx_k_nodes_2rank_values[] = "nodes_2rank_values";
2845 static const char __pyx_k_patchBoundaryNodes[] = "patchBoundaryNodes";
2846 static const char __pyx_k_smoothNodesLaplace[] = "smoothNodesLaplace";
2847 static const char __pyx_k_smoothNodesQuality[] = "smoothNodesQuality";
2848 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2849 static const char __pyx_k_elementVolumesArray[] = "elementVolumesArray";
2850 static const char __pyx_k_fixedNodesBoolArray[] = "fixedNodesBoolArray";
2851 static const char __pyx_k_getDilationElements[] = "getDilationElements";
2852 static const char __pyx_k_getLocalNearestNode[] = "getLocalNearestNode";
2853 static const char __pyx_k_smoothNodesCentroid[] = "smoothNodesCentroid";
2854 static const char __pyx_k_elementDilationArray[] = "elementDilationArray_";
2855 static const char __pyx_k_mprans_MeshSmoothing[] = "mprans.MeshSmoothing";
2856 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2857 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2858 static const char __pyx_k_elementNeighborsArray[] = "elementNeighborsArray";
2859 static const char __pyx_k_elementVolumesArray_2[] = "elementVolumesArray_";
2860 static const char __pyx_k_error_looking_for_dir[] = "error looking for dir_";
2861 static const char __pyx_k_getDistortionElements[] = "getDistortionElements";
2862 static const char __pyx_k_getNonOwnedNodeValues[] = "getNonOwnedNodeValues";
2863 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2864 static const char __pyx_k_elementBoundariesArray[] = "elementBoundariesArray";
2865 static const char __pyx_k_elementDistortionArray[] = "elementDistortionArray_";
2866 static const char __pyx_k_getCornerNodesTriangle[] = "getCornerNodesTriangle";
2867 static const char __pyx_k_getLocalNearestElement[] = "getLocalNearestElement";
2868 static const char __pyx_k_updateDilationElements[] = "updateDilationElements";
2869 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2870 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2871 static const char __pyx_k_elementBarycentersArray[] = "elementBarycentersArray";
2872 static const char __pyx_k_pyScalarRecoveryAtNodes[] = "pyScalarRecoveryAtNodes";
2873 static const char __pyx_k_pyVectorRecoveryAtNodes[] = "pyVectorRecoveryAtNodes";
2874 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2875 static const char __pyx_k_elementVolumeTargetArray[] = "elementVolumeTargetArray";
2876 static const char __pyx_k_getElementVolumeTriangle[] = "getElementVolumeTriangle";
2877 static const char __pyx_k_updateDistortionElements[] = "updateDistortionElements";
2878 static const char __pyx_k_updateElementBarycenters[] = "updateElementBarycenters";
2879 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2880 static const char __pyx_k_elementBarycentersArray_2[] = "elementBarycentersArray_";
2881 static const char __pyx_k_elementBoundaryNodesArray[] = "elementBoundaryNodesArray";
2882 static const char __pyx_k_updateElementVolumesTetra[] = "updateElementVolumesTetra";
2883 static const char __pyx_k_elementBoundaryNormalsArray[] = "elementBoundaryNormalsArray";
2884 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2885 static const char __pyx_k_nodeOffsets_subdomain_owned[] = "nodeOffsets_subdomain_owned";
2886 static const char __pyx_k_elementBoundaryElementsArray[] = "elementBoundaryElementsArray";
2887 static const char __pyx_k_updateElementVolumesTriangle[] = "updateElementVolumesTriangle";
2888 static const char __pyx_k_elementBoundaryNormalsArray_2[] = "elementBoundaryNormalsArray_";
2889 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2890 static const char __pyx_k_getElementBoundaryNormalsTetra[] = "getElementBoundaryNormalsTetra";
2891 static const char __pyx_k_nodeNumbering_subdomain2global[] = "nodeNumbering_subdomain2global";
2892 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2893 static const char __pyx_k_elementBoundaryBarycentersArray[] = "elementBoundaryBarycentersArray";
2894 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
2895 static const char __pyx_k_pyScalarRecoveryAtNodesWeighted[] = "pyScalarRecoveryAtNodesWeighted";
2896 static const char __pyx_k_pyVectorRecoveryAtNodesWeighted[] = "pyVectorRecoveryAtNodesWeighted";
2897 static const char __pyx_k_variableOffsets_subdomain_owned[] = "variableOffsets_subdomain_owned";
2898 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2899 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2900 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2901 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2902 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2903 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
2904 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2905 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2906 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2907 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2908 static const char __pyx_k_could_not_find_element_element_e[] = "could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations";
2909 static const char __pyx_k_exteriorElementBoundariesBoolArr[] = "exteriorElementBoundariesBoolArray";
2910 static const char __pyx_k_getElementBoundaryNormalsTriangl[] = "getElementBoundaryNormalsTriangle";
2911 static const char __pyx_k_getInverseMeanRatioSingleTriangl[] = "getInverseMeanRatioSingleTriangle";
2912 static const char __pyx_k_getInverseMeanRatioTriangleEleme[] = "getInverseMeanRatioTriangleElements";
2913 static const char __pyx_k_getInverseMeanRatioTriangleNodes[] = "getInverseMeanRatioTriangleNodes";
2914 static const char __pyx_k_getLocalNearestElementAroundNode[] = "getLocalNearestElementAroundNode";
2915 static const char __pyx_k_getLocalNearestElementIntersecti[] = "getLocalNearestElementIntersection";
2916 static const char __pyx_k_getNonOwnedNodeValues_locals_gen[] = "getNonOwnedNodeValues.<locals>.genexpr";
2917 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2918 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2919 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
2920 static const char __pyx_k_proteus_mprans_MeshSmoothing_pyx[] = "proteus/mprans/MeshSmoothing.pyx";
2921 static const char __pyx_k_smoothNodesQuality_is_work_in_pr[] = "smoothNodesQuality is work in progress, do not use";
2922 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2923 static const char __pyx_k_updateElementBoundaryNormalsTetr[] = "updateElementBoundaryNormalsTetra";
2924 static const char __pyx_k_updateElementBoundaryNormalsTria[] = "updateElementBoundaryNormalsTriangle";
2925 static const char __pyx_k_updateInverseMeanRatioTriangleEl[] = "updateInverseMeanRatioTriangleElements";
2926 static const char __pyx_k_updateInverseMeanRatioTriangleNo[] = "updateInverseMeanRatioTriangleNodes";
2927 static const char __pyx_k_variableNumbering_subdomain2glob[] = "variableNumbering_subdomain2global";
2928 static PyObject *__pyx_n_s_ASCII;
2929 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2930 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2931 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2932 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2933 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2934 static PyObject *__pyx_n_s_Comm;
2935 static PyObject *__pyx_n_s_Commit;
2936 static PyObject *__pyx_n_s_Create_contiguous;
2937 static PyObject *__pyx_n_s_DOUBLE;
2938 static PyObject *__pyx_n_s_Ellipsis;
2939 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2940 static PyObject *__pyx_n_s_Gatherv;
2941 static PyObject *__pyx_n_s_IMRElementsArray;
2942 static PyObject *__pyx_n_s_IMRNodesArray;
2943 static PyObject *__pyx_n_s_INT;
2944 static PyObject *__pyx_n_s_ImportError;
2945 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
2946 static PyObject *__pyx_n_s_IndexError;
2947 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2948 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2949 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2950 static PyObject *__pyx_n_s_J_array;
2951 static PyObject *__pyx_n_s_MPI;
2952 static PyObject *__pyx_n_s_MemoryError;
2953 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2954 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2955 static PyObject *__pyx_n_b_O;
2956 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2957 static PyObject *__pyx_n_s_PickleError;
2958 static PyObject *__pyx_n_s_SUM;
2959 static PyObject *__pyx_kp_b_T;
2960 static PyObject *__pyx_n_s_TypeError;
2961 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2962 static PyObject *__pyx_n_s_ValueError;
2963 static PyObject *__pyx_n_s_View_MemoryView;
2964 static PyObject *__pyx_kp_b__27;
2965 static PyObject *__pyx_kp_b__28;
2966 static PyObject *__pyx_kp_b__29;
2967 static PyObject *__pyx_kp_b__30;
2968 static PyObject *__pyx_kp_u__31;
2969 static PyObject *__pyx_n_s_allocate_buffer;
2970 static PyObject *__pyx_n_s_allreduce;
2971 static PyObject *__pyx_n_s_alpha;
2972 static PyObject *__pyx_n_s_append;
2973 static PyObject *__pyx_n_s_apply_directly;
2974 static PyObject *__pyx_n_s_arg_2doArray;
2975 static PyObject *__pyx_n_s_arg_2rank;
2976 static PyObject *__pyx_n_s_arg_2rank_values;
2977 static PyObject *__pyx_n_s_arg_shape;
2978 static PyObject *__pyx_n_s_arg_shape_copy;
2979 static PyObject *__pyx_n_s_arg_shape_len;
2980 static PyObject *__pyx_n_s_args;
2981 static PyObject *__pyx_n_s_args_2;
2982 static PyObject *__pyx_n_s_array;
2983 static PyObject *__pyx_n_s_array_size;
2984 static PyObject *__pyx_n_s_astype;
2985 static PyObject *__pyx_n_s_base;
2986 static PyObject *__pyx_n_s_c;
2987 static PyObject *__pyx_n_u_c;
2988 static PyObject *__pyx_n_s_checkOwnedVariable;
2989 static PyObject *__pyx_n_s_checkedElements;
2990 static PyObject *__pyx_n_s_class;
2991 static PyObject *__pyx_n_s_cline_in_traceback;
2992 static PyObject *__pyx_n_s_close;
2993 static PyObject *__pyx_n_s_comm;
2994 static PyObject *__pyx_n_s_comm_size;
2995 static PyObject *__pyx_kp_s_contiguous_and_direct;
2996 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2997 static PyObject *__pyx_n_s_coords;
2998 static PyObject *__pyx_kp_s_could_not_find_element_element_e;
2999 static PyObject *__pyx_n_s_counts_in;
3000 static PyObject *__pyx_n_s_counts_out;
3001 static PyObject *__pyx_n_s_datatype;
3002 static PyObject *__pyx_n_s_detJ_array;
3003 static PyObject *__pyx_n_s_dict;
3004 static PyObject *__pyx_n_s_dilation;
3005 static PyObject *__pyx_n_s_disp;
3006 static PyObject *__pyx_n_s_displacements_in;
3007 static PyObject *__pyx_n_s_displacements_out;
3008 static PyObject *__pyx_n_s_distortion;
3009 static PyObject *__pyx_n_s_dot;
3010 static PyObject *__pyx_n_s_double;
3011 static PyObject *__pyx_n_s_dtype;
3012 static PyObject *__pyx_n_s_dtype_is_object;
3013 static PyObject *__pyx_n_s_eN;
3014 static PyObject *__pyx_n_s_eOffset;
3015 static PyObject *__pyx_n_s_el_average;
3016 static PyObject *__pyx_n_s_elementBarycentersArray;
3017 static PyObject *__pyx_n_s_elementBarycentersArray_2;
3018 static PyObject *__pyx_n_s_elementBoundariesArray;
3019 static PyObject *__pyx_n_s_elementBoundaryBarycentersArray;
3020 static PyObject *__pyx_n_s_elementBoundaryElementsArray;
3021 static PyObject *__pyx_n_s_elementBoundaryNodesArray;
3022 static PyObject *__pyx_n_s_elementBoundaryNormalsArray;
3023 static PyObject *__pyx_n_s_elementBoundaryNormalsArray_2;
3024 static PyObject *__pyx_n_s_elementDilationArray;
3025 static PyObject *__pyx_n_s_elementDistortionArray;
3026 static PyObject *__pyx_n_s_elementMaps;
3027 static PyObject *__pyx_n_s_elementNeighborsArray;
3028 static PyObject *__pyx_n_s_elementNodesArray;
3029 static PyObject *__pyx_n_s_elementVolumeArray;
3030 static PyObject *__pyx_n_s_elementVolumeTargetArray;
3031 static PyObject *__pyx_n_s_elementVolumesArray;
3032 static PyObject *__pyx_n_s_elementVolumesArray_2;
3033 static PyObject *__pyx_n_s_encode;
3034 static PyObject *__pyx_n_s_enumerate;
3035 static PyObject *__pyx_n_s_error;
3036 static PyObject *__pyx_kp_s_error_looking_for_dir;
3037 static PyObject *__pyx_n_s_exteriorElementBoundariesBoolArr;
3038 static PyObject *__pyx_n_s_femSpace;
3039 static PyObject *__pyx_n_s_fixedNodesBoolArray;
3040 static PyObject *__pyx_n_s_flags;
3041 static PyObject *__pyx_n_s_format;
3042 static PyObject *__pyx_n_s_fortran;
3043 static PyObject *__pyx_n_u_fortran;
3044 static PyObject *__pyx_n_s_genexpr;
3045 static PyObject *__pyx_n_s_get;
3046 static PyObject *__pyx_n_s_getCornerNodesTriangle;
3047 static PyObject *__pyx_n_s_getDilationElements;
3048 static PyObject *__pyx_n_s_getDistortionElements;
3049 static PyObject *__pyx_n_s_getElementBoundaryNormalsTetra;
3050 static PyObject *__pyx_n_s_getElementBoundaryNormalsTriangl;
3051 static PyObject *__pyx_n_s_getElementVolumeTriangle;
3052 static PyObject *__pyx_n_s_getInverseMeanRatioSingleTriangl;
3053 static PyObject *__pyx_n_s_getInverseMeanRatioTriangleEleme;
3054 static PyObject *__pyx_n_s_getInverseMeanRatioTriangleNodes;
3055 static PyObject *__pyx_n_s_getInverseValue;
3056 static PyObject *__pyx_n_s_getLocalElement;
3057 static PyObject *__pyx_n_s_getLocalNearestElement;
3058 static PyObject *__pyx_n_s_getLocalNearestElementAroundNode;
3059 static PyObject *__pyx_n_s_getLocalNearestElementIntersecti;
3060 static PyObject *__pyx_n_s_getLocalNearestNode;
3061 static PyObject *__pyx_n_s_getNonOwnedNodeValues;
3062 static PyObject *__pyx_n_s_getNonOwnedNodeValues_locals_gen;
3063 static PyObject *__pyx_n_s_getstate;
3064 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
3065 static PyObject *__pyx_n_s_i;
3066 static PyObject *__pyx_n_s_iN;
3067 static PyObject *__pyx_n_s_id;
3068 static PyObject *__pyx_n_s_ii;
3069 static PyObject *__pyx_n_s_import;
3070 static PyObject *__pyx_n_s_int32;
3071 static PyObject *__pyx_n_s_inv;
3072 static PyObject *__pyx_n_s_ir;
3073 static PyObject *__pyx_n_s_itemsize;
3074 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
3075 static PyObject *__pyx_n_s_join;
3076 static PyObject *__pyx_n_s_linalg;
3077 static PyObject *__pyx_n_s_logEvent;
3078 static PyObject *__pyx_n_s_main;
3079 static PyObject *__pyx_n_s_maxit;
3080 static PyObject *__pyx_n_s_memview;
3081 static PyObject *__pyx_n_s_mesh;
3082 static PyObject *__pyx_n_s_mode;
3083 static PyObject *__pyx_n_s_mpi4py;
3084 static PyObject *__pyx_n_s_mprans_MeshSmoothing;
3085 static PyObject *__pyx_n_s_my_rank;
3086 static PyObject *__pyx_n_s_my_size;
3087 static PyObject *__pyx_n_s_nA;
3088 static PyObject *__pyx_n_s_nB;
3089 static PyObject *__pyx_n_s_nC;
3090 static PyObject *__pyx_n_s_nElements;
3091 static PyObject *__pyx_n_s_nNodes;
3092 static PyObject *__pyx_n_s_nNodes_global;
3093 static PyObject *__pyx_n_s_nNodes_owned;
3094 static PyObject *__pyx_n_s_nVariables_owned;
3095 static PyObject *__pyx_n_s_name;
3096 static PyObject *__pyx_n_s_name_2;
3097 static PyObject *__pyx_n_s_nd;
3098 static PyObject *__pyx_n_s_ndim;
3099 static PyObject *__pyx_n_s_nearest_eN;
3100 static PyObject *__pyx_n_s_new;
3101 static PyObject *__pyx_n_s_new_rank;
3102 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
3103 static PyObject *__pyx_n_s_node;
3104 static PyObject *__pyx_n_s_node0;
3105 static PyObject *__pyx_n_s_nodeArray;
3106 static PyObject *__pyx_n_s_nodeArray_2;
3107 static PyObject *__pyx_n_s_nodeElementOffsets;
3108 static PyObject *__pyx_n_s_nodeElementsArray;
3109 static PyObject *__pyx_n_s_nodeMaterialTypes;
3110 static PyObject *__pyx_n_s_nodeNumbering_subdomain2global;
3111 static PyObject *__pyx_n_s_nodeOffsets_subdomain_owned;
3112 static PyObject *__pyx_n_s_nodeStarArray;
3113 static PyObject *__pyx_n_s_nodeStarOffsets;
3114 static PyObject *__pyx_n_s_node_new_rank;
3115 static PyObject *__pyx_n_s_nodes_2doArray;
3116 static PyObject *__pyx_n_s_nodes_2rank;
3117 static PyObject *__pyx_n_s_nodes_2rank_len;
3118 static PyObject *__pyx_n_s_nodes_2rank_values;
3119 static PyObject *__pyx_n_s_np;
3120 static PyObject *__pyx_n_s_numpy;
3121 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
3122 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
3123 static PyObject *__pyx_n_s_obj;
3124 static PyObject *__pyx_n_s_onElement;
3125 static PyObject *__pyx_n_s_op;
3126 static PyObject *__pyx_n_s_pack;
3127 static PyObject *__pyx_n_s_patchBoundaryNodes;
3128 static PyObject *__pyx_n_s_pickle;
3129 static PyObject *__pyx_n_s_proteus;
3130 static PyObject *__pyx_n_s_proteus_Profiling;
3131 static PyObject *__pyx_kp_s_proteus_mprans_MeshSmoothing_pyx;
3132 static PyObject *__pyx_n_s_pyScalarRecoveryAtNodes;
3133 static PyObject *__pyx_n_s_pyScalarRecoveryAtNodesWeighted;
3134 static PyObject *__pyx_n_s_pyVectorRecoveryAtNodes;
3135 static PyObject *__pyx_n_s_pyVectorRecoveryAtNodesWeighted;
3136 static PyObject *__pyx_n_s_pyx_PickleError;
3137 static PyObject *__pyx_n_s_pyx_checksum;
3138 static PyObject *__pyx_n_s_pyx_getbuffer;
3139 static PyObject *__pyx_n_s_pyx_result;
3140 static PyObject *__pyx_n_s_pyx_state;
3141 static PyObject *__pyx_n_s_pyx_type;
3142 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
3143 static PyObject *__pyx_n_s_pyx_vtable;
3144 static PyObject *__pyx_n_s_range;
3145 static PyObject *__pyx_n_s_rank;
3146 static PyObject *__pyx_n_s_rank_recv;
3147 static PyObject *__pyx_n_s_reduce;
3148 static PyObject *__pyx_n_s_reduce_cython;
3149 static PyObject *__pyx_n_s_reduce_ex;
3150 static PyObject *__pyx_n_s_referenceElement;
3151 static PyObject *__pyx_n_s_result;
3152 static PyObject *__pyx_n_s_root;
3153 static PyObject *__pyx_kp_u_s;
3154 static PyObject *__pyx_n_s_scalars;
3155 static PyObject *__pyx_n_s_send;
3156 static PyObject *__pyx_n_s_setstate;
3157 static PyObject *__pyx_n_s_setstate_cython;
3158 static PyObject *__pyx_n_s_shape;
3159 static PyObject *__pyx_n_s_shape_factor;
3160 static PyObject *__pyx_n_s_simultaneous;
3161 static PyObject *__pyx_n_s_size;
3162 static PyObject *__pyx_n_s_smoothBoundaries;
3163 static PyObject *__pyx_n_s_smoothNodesCentroid;
3164 static PyObject *__pyx_n_s_smoothNodesLaplace;
3165 static PyObject *__pyx_n_s_smoothNodesQuality;
3166 static PyObject *__pyx_kp_s_smoothNodesQuality_is_work_in_pr;
3167 static PyObject *__pyx_n_s_start;
3168 static PyObject *__pyx_n_s_starting_coords;
3169 static PyObject *__pyx_n_s_step;
3170 static PyObject *__pyx_n_s_stop;
3171 static PyObject *__pyx_kp_s_strided_and_direct;
3172 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
3173 static PyObject *__pyx_kp_s_strided_and_indirect;
3174 static PyObject *__pyx_kp_s_stringsource;
3175 static PyObject *__pyx_n_s_struct;
3176 static PyObject *__pyx_n_s_sumtot;
3177 static PyObject *__pyx_n_s_test;
3178 static PyObject *__pyx_n_s_throw;
3179 static PyObject *__pyx_n_s_tompi4py;
3180 static PyObject *__pyx_n_s_transpose;
3181 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
3182 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
3183 static PyObject *__pyx_n_s_unpack;
3184 static PyObject *__pyx_n_s_update;
3185 static PyObject *__pyx_n_s_updateDilationElements;
3186 static PyObject *__pyx_n_s_updateDistortionElements;
3187 static PyObject *__pyx_n_s_updateElementBarycenters;
3188 static PyObject *__pyx_n_s_updateElementBoundaryNormalsTetr;
3189 static PyObject *__pyx_n_s_updateElementBoundaryNormalsTria;
3190 static PyObject *__pyx_n_s_updateElementVolumesTetra;
3191 static PyObject *__pyx_n_s_updateElementVolumesTriangle;
3192 static PyObject *__pyx_n_s_updateInverseMeanRatioTriangleEl;
3193 static PyObject *__pyx_n_s_updateInverseMeanRatioTriangleNo;
3194 static PyObject *__pyx_n_s_variableNumbering_subdomain2glob;
3195 static PyObject *__pyx_n_s_variableOffsets_subdomain_owned;
3196 static PyObject *__pyx_n_s_variable_nb_local;
3197 static PyObject *__pyx_n_s_vectors;
3198 static PyObject *__pyx_n_s_x;
3199 static PyObject *__pyx_n_s_x2;
3200 static PyObject *__pyx_n_s_xi;
3201 static PyObject *__pyx_n_s_y;
3202 static PyObject *__pyx_n_s_y2;
3203 static PyObject *__pyx_n_s_z;
3204 static PyObject *__pyx_n_s_z2;
3205 static PyObject *__pyx_n_s_zeros;
3206 static PyObject *__pyx_n_s_zeros_like;
3207 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_smoothNodesLaplace(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes_owned, int __pyx_v_nd, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha); /* proto */
3208 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_2smoothNodesCentroid(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementVolumesArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nNodes_owned, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha); /* proto */
3209 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_4updateDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDilationArray_, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray, int __pyx_v_nElements); /* proto */
3210 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_6getDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray); /* proto */
3211 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_8updateDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDistortionArray_, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd, int __pyx_v_nElements); /* proto */
3212 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_10getDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd); /* proto */
3213 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_12updateInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRElementsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nElements); /* proto */
3214 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_14getInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray); /* proto */
3215 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_16updateInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRNodesArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, int __pyx_v_nNodes, int __pyx_v_nElements, bool __pyx_v_el_average); /* proto */
3216 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_18getInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, bool __pyx_v_el_average); /* proto */
3217 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_20getInverseMeanRatioSingleTriangle(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node0, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray); /* proto */
3218 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_22smoothNodesQuality(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distortion, __Pyx_memviewslice __pyx_v_dilation, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nNodes_owned, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementNodesArray, CYTHON_UNUSED bool __pyx_v_apply_directly); /* proto */
3219 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_24getLocalNearestNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, int __pyx_v_node); /* proto */
3220 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_26getLocalNearestElement(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNeighborsArray, int __pyx_v_eN); /* proto */
3221 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_node); /* proto */
3222 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_starting_coords, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray, __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray, int __pyx_v_eN); /* proto */
3223 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_32getLocalElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_femSpace, PyObject *__pyx_v_coords, PyObject *__pyx_v_node); /* proto */
3224 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_34updateElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements); /* proto */
3225 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_36getElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray); /* proto */
3226 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_38updateElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements); /* proto */
3227 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_40getElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray); /* proto */
3228 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_42updateElementVolumesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements); /* proto */
3229 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_44getElementVolumeTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nA, __Pyx_memviewslice __pyx_v_nB, __Pyx_memviewslice __pyx_v_nC); /* proto */
3230 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_46updateElementVolumesTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements); /* proto */
3231 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_48updateElementBarycenters(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBarycentersArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements); /* proto */
3232 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_50getCornerNodesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes); /* proto */
3233 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_genexpr(PyObject *__pyx_self); /* proto */
3234 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_3genexpr(PyObject *__pyx_self); /* proto */
3235 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_52getNonOwnedNodeValues(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args_, int __pyx_v_nNodes_owned, int __pyx_v_nNodes_global, __Pyx_memviewslice __pyx_v_nodeNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_nodeOffsets_subdomain_owned); /* proto */
3236 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_54checkOwnedVariable(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_variable_nb_local, int __pyx_v_rank, int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned); /* proto */
3237 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_56pyScalarRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets); /* proto */
3238 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_58pyScalarRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nNodes); /* proto */
3239 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_60pyVectorRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vectors, PyObject *__pyx_v_nodeElementsArray, PyObject *__pyx_v_nodeElementOffsets, PyObject *__pyx_v_nd); /* proto */
3240 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_62pyVectorRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd); /* proto */
3241 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
3242 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3243 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3244 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3245 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
3246 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
3247 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
3248 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
3249 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
3250 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3251 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
3252 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3253 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
3254 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
3255 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
3256 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3257 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
3258 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
3259 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
3260 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3261 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3262 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3263 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3264 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3265 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3266 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3267 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3268 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3269 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3270 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3271 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3272 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3273 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3274 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3275 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3276 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
3277 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3278 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3279 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3280 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
3281 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3282 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
3283 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3284 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3285 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3286 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3287 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3288 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3289 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3290 static PyObject *__pyx_float_0_;
3291 static PyObject *__pyx_float_1_;
3292 static PyObject *__pyx_float_0_5;
3293 static PyObject *__pyx_int_0;
3294 static PyObject *__pyx_int_1;
3295 static PyObject *__pyx_int_2;
3296 static PyObject *__pyx_int_3;
3297 static PyObject *__pyx_int_4;
3298 static PyObject *__pyx_int_112105877;
3299 static PyObject *__pyx_int_136983863;
3300 static PyObject *__pyx_int_184977713;
3301 static PyObject *__pyx_int_neg_1;
3302 static __Pyx_memviewslice __pyx_k_;
3303 static __Pyx_memviewslice __pyx_k__2;
3304 static __Pyx_memviewslice __pyx_k__5;
3305 static PyObject *__pyx_slice__4;
3306 static PyObject *__pyx_tuple__3;
3307 static PyObject *__pyx_tuple__6;
3308 static PyObject *__pyx_tuple__7;
3309 static PyObject *__pyx_tuple__8;
3310 static PyObject *__pyx_tuple__9;
3311 static PyObject *__pyx_tuple__10;
3312 static PyObject *__pyx_tuple__11;
3313 static PyObject *__pyx_tuple__12;
3314 static PyObject *__pyx_tuple__13;
3315 static PyObject *__pyx_tuple__14;
3316 static PyObject *__pyx_tuple__15;
3317 static PyObject *__pyx_tuple__16;
3318 static PyObject *__pyx_tuple__17;
3319 static PyObject *__pyx_tuple__18;
3320 static PyObject *__pyx_tuple__19;
3321 static PyObject *__pyx_tuple__20;
3322 static PyObject *__pyx_tuple__21;
3323 static PyObject *__pyx_tuple__22;
3324 static PyObject *__pyx_tuple__23;
3325 static PyObject *__pyx_tuple__24;
3326 static PyObject *__pyx_tuple__25;
3327 static PyObject *__pyx_tuple__26;
3328 static PyObject *__pyx_tuple__32;
3329 static PyObject *__pyx_tuple__34;
3330 static PyObject *__pyx_tuple__36;
3331 static PyObject *__pyx_tuple__38;
3332 static PyObject *__pyx_tuple__40;
3333 static PyObject *__pyx_tuple__42;
3334 static PyObject *__pyx_tuple__44;
3335 static PyObject *__pyx_tuple__46;
3336 static PyObject *__pyx_tuple__48;
3337 static PyObject *__pyx_tuple__50;
3338 static PyObject *__pyx_tuple__52;
3339 static PyObject *__pyx_tuple__54;
3340 static PyObject *__pyx_tuple__56;
3341 static PyObject *__pyx_tuple__58;
3342 static PyObject *__pyx_tuple__60;
3343 static PyObject *__pyx_tuple__62;
3344 static PyObject *__pyx_tuple__64;
3345 static PyObject *__pyx_tuple__66;
3346 static PyObject *__pyx_tuple__68;
3347 static PyObject *__pyx_tuple__70;
3348 static PyObject *__pyx_tuple__72;
3349 static PyObject *__pyx_tuple__74;
3350 static PyObject *__pyx_tuple__76;
3351 static PyObject *__pyx_tuple__78;
3352 static PyObject *__pyx_tuple__80;
3353 static PyObject *__pyx_tuple__82;
3354 static PyObject *__pyx_tuple__84;
3355 static PyObject *__pyx_tuple__86;
3356 static PyObject *__pyx_tuple__88;
3357 static PyObject *__pyx_tuple__90;
3358 static PyObject *__pyx_tuple__92;
3359 static PyObject *__pyx_tuple__94;
3360 static PyObject *__pyx_tuple__96;
3361 static PyObject *__pyx_tuple__97;
3362 static PyObject *__pyx_tuple__98;
3363 static PyObject *__pyx_tuple__99;
3364 static PyObject *__pyx_tuple__100;
3365 static PyObject *__pyx_tuple__101;
3366 static PyObject *__pyx_codeobj__33;
3367 static PyObject *__pyx_codeobj__35;
3368 static PyObject *__pyx_codeobj__37;
3369 static PyObject *__pyx_codeobj__39;
3370 static PyObject *__pyx_codeobj__41;
3371 static PyObject *__pyx_codeobj__43;
3372 static PyObject *__pyx_codeobj__45;
3373 static PyObject *__pyx_codeobj__47;
3374 static PyObject *__pyx_codeobj__49;
3375 static PyObject *__pyx_codeobj__51;
3376 static PyObject *__pyx_codeobj__53;
3377 static PyObject *__pyx_codeobj__55;
3378 static PyObject *__pyx_codeobj__57;
3379 static PyObject *__pyx_codeobj__59;
3380 static PyObject *__pyx_codeobj__61;
3381 static PyObject *__pyx_codeobj__63;
3382 static PyObject *__pyx_codeobj__65;
3383 static PyObject *__pyx_codeobj__67;
3384 static PyObject *__pyx_codeobj__69;
3385 static PyObject *__pyx_codeobj__71;
3386 static PyObject *__pyx_codeobj__73;
3387 static PyObject *__pyx_codeobj__75;
3388 static PyObject *__pyx_codeobj__77;
3389 static PyObject *__pyx_codeobj__79;
3390 static PyObject *__pyx_codeobj__81;
3391 static PyObject *__pyx_codeobj__83;
3392 static PyObject *__pyx_codeobj__85;
3393 static PyObject *__pyx_codeobj__87;
3394 static PyObject *__pyx_codeobj__89;
3395 static PyObject *__pyx_codeobj__91;
3396 static PyObject *__pyx_codeobj__93;
3397 static PyObject *__pyx_codeobj__95;
3398 static PyObject *__pyx_codeobj__102;
3399 /* Late includes */
3400 
3401 /* "mprans/MeshSmoothing.pyx":11
3402  * from proteus.Profiling import logEvent
3403  *
3404  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3405  * int[:] nodeStarOffsets,
3406  * int[:] nodeStarArray,
3407  */
3408 
3409 /* Python wrapper */
3410 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_1smoothNodesLaplace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3411 static char __pyx_doc_6mprans_13MeshSmoothing_smoothNodesLaplace[] = "\n Laplace Smoothing:\n Mesh nodes are displaced to the centroid of neighbouring nodes\n\n Parameters\n ----------\n nodeArray_: double[:,:]\n array of mesh nodes\n (!) will be modified with smoothing\n nodeStarOffsets: int[:]\n array to get offsets for neighbouring node numbers\n nodeStarArray: int[:]\n array of neighbouring nodes\n nodeMaterialTypes: int[:]\n array to know which node is interior node (materialType=0)\n nNodes_owned: int\n number of nodes owned\n nd: int\n number of dimensions (needed to find direction to smooth boundaries)\n simultaneous: bool\n if True: simultaneous smoothing\n if False: sequential smoothing\n smoothBoundaries: bool\n if True: boundaries are smoothed (only with surrounding boundary nodes)\n if False: boudnary nodes are fixed\n fixedNodesBoolArray: int[:]\n array of same length as nodeArray with:\n fixedNodesBoolArray[node] = 1 -> node is fixed\n fixedNodesBoolArray[node] = 0 -> node is not fixed\n alpha: double\n penalty term related to original position of nodes (0 <= alpha <= 1)\n ";
3412 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_1smoothNodesLaplace = {"smoothNodesLaplace", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_1smoothNodesLaplace, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_smoothNodesLaplace};
3413 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_1smoothNodesLaplace(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3414  __Pyx_memviewslice __pyx_v_nodeArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
3415  __Pyx_memviewslice __pyx_v_nodeStarOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
3416  __Pyx_memviewslice __pyx_v_nodeStarArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3417  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
3418  int __pyx_v_nNodes_owned;
3419  int __pyx_v_nd;
3420  bool __pyx_v_simultaneous;
3421  bool __pyx_v_smoothBoundaries;
3422  __Pyx_memviewslice __pyx_v_fixedNodesBoolArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3423  double __pyx_v_alpha;
3424  int __pyx_lineno = 0;
3425  const char *__pyx_filename = NULL;
3426  int __pyx_clineno = 0;
3427  PyObject *__pyx_r = 0;
3428  __Pyx_RefNannyDeclarations
3429  __Pyx_RefNannySetupContext("smoothNodesLaplace (wrapper)", 0);
3430  {
3431  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray,&__pyx_n_s_nodeStarOffsets,&__pyx_n_s_nodeStarArray,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_nNodes_owned,&__pyx_n_s_nd,&__pyx_n_s_simultaneous,&__pyx_n_s_smoothBoundaries,&__pyx_n_s_fixedNodesBoolArray,&__pyx_n_s_alpha,0};
3432  PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};
3433  if (unlikely(__pyx_kwds)) {
3434  Py_ssize_t kw_args;
3435  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3436  switch (pos_args) {
3437  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3438  CYTHON_FALLTHROUGH;
3439  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3440  CYTHON_FALLTHROUGH;
3441  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3442  CYTHON_FALLTHROUGH;
3443  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3444  CYTHON_FALLTHROUGH;
3445  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3446  CYTHON_FALLTHROUGH;
3447  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3448  CYTHON_FALLTHROUGH;
3449  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3450  CYTHON_FALLTHROUGH;
3451  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3452  CYTHON_FALLTHROUGH;
3453  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3454  CYTHON_FALLTHROUGH;
3455  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3456  CYTHON_FALLTHROUGH;
3457  case 0: break;
3458  default: goto __pyx_L5_argtuple_error;
3459  }
3460  kw_args = PyDict_Size(__pyx_kwds);
3461  switch (pos_args) {
3462  case 0:
3463  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray)) != 0)) kw_args--;
3464  else goto __pyx_L5_argtuple_error;
3465  CYTHON_FALLTHROUGH;
3466  case 1:
3467  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarOffsets)) != 0)) kw_args--;
3468  else {
3469  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 1); __PYX_ERR(0, 11, __pyx_L3_error)
3470  }
3471  CYTHON_FALLTHROUGH;
3472  case 2:
3473  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarArray)) != 0)) kw_args--;
3474  else {
3475  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 2); __PYX_ERR(0, 11, __pyx_L3_error)
3476  }
3477  CYTHON_FALLTHROUGH;
3478  case 3:
3479  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
3480  else {
3481  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 3); __PYX_ERR(0, 11, __pyx_L3_error)
3482  }
3483  CYTHON_FALLTHROUGH;
3484  case 4:
3485  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
3486  else {
3487  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 4); __PYX_ERR(0, 11, __pyx_L3_error)
3488  }
3489  CYTHON_FALLTHROUGH;
3490  case 5:
3491  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
3492  else {
3493  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, 5); __PYX_ERR(0, 11, __pyx_L3_error)
3494  }
3495  CYTHON_FALLTHROUGH;
3496  case 6:
3497  if (kw_args > 0) {
3498  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_simultaneous);
3499  if (value) { values[6] = value; kw_args--; }
3500  }
3501  CYTHON_FALLTHROUGH;
3502  case 7:
3503  if (kw_args > 0) {
3504  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smoothBoundaries);
3505  if (value) { values[7] = value; kw_args--; }
3506  }
3507  CYTHON_FALLTHROUGH;
3508  case 8:
3509  if (kw_args > 0) {
3510  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fixedNodesBoolArray);
3511  if (value) { values[8] = value; kw_args--; }
3512  }
3513  CYTHON_FALLTHROUGH;
3514  case 9:
3515  if (kw_args > 0) {
3516  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
3517  if (value) { values[9] = value; kw_args--; }
3518  }
3519  }
3520  if (unlikely(kw_args > 0)) {
3521  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothNodesLaplace") < 0)) __PYX_ERR(0, 11, __pyx_L3_error)
3522  }
3523  } else {
3524  switch (PyTuple_GET_SIZE(__pyx_args)) {
3525  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3526  CYTHON_FALLTHROUGH;
3527  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3528  CYTHON_FALLTHROUGH;
3529  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3530  CYTHON_FALLTHROUGH;
3531  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3532  CYTHON_FALLTHROUGH;
3533  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3534  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3535  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3536  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3537  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3538  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3539  break;
3540  default: goto __pyx_L5_argtuple_error;
3541  }
3542  }
3543  __pyx_v_nodeArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray_.memview)) __PYX_ERR(0, 11, __pyx_L3_error)
3544  __pyx_v_nodeStarOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarOffsets.memview)) __PYX_ERR(0, 12, __pyx_L3_error)
3545  __pyx_v_nodeStarArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarArray.memview)) __PYX_ERR(0, 13, __pyx_L3_error)
3546  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 14, __pyx_L3_error)
3547  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 15, __pyx_L3_error)
3548  __pyx_v_nd = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
3549  if (values[6]) {
3550  __pyx_v_simultaneous = __Pyx_PyObject_IsTrue(values[6]); if (unlikely((__pyx_v_simultaneous == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 17, __pyx_L3_error)
3551  } else {
3552 
3553  /* "mprans/MeshSmoothing.pyx":17
3554  * int nNodes_owned,
3555  * int nd,
3556  * bool simultaneous=False, # <<<<<<<<<<<<<<
3557  * bool smoothBoundaries=True,
3558  * int[:] fixedNodesBoolArray=None,
3559  */
3560  __pyx_v_simultaneous = ((bool)0);
3561  }
3562  if (values[7]) {
3563  __pyx_v_smoothBoundaries = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_smoothBoundaries == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 18, __pyx_L3_error)
3564  } else {
3565 
3566  /* "mprans/MeshSmoothing.pyx":18
3567  * int nd,
3568  * bool simultaneous=False,
3569  * bool smoothBoundaries=True, # <<<<<<<<<<<<<<
3570  * int[:] fixedNodesBoolArray=None,
3571  * double alpha=0.):
3572  */
3573  __pyx_v_smoothBoundaries = ((bool)1);
3574  }
3575  if (values[8]) {
3576  __pyx_v_fixedNodesBoolArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fixedNodesBoolArray.memview)) __PYX_ERR(0, 19, __pyx_L3_error)
3577  } else {
3578  __pyx_v_fixedNodesBoolArray = __pyx_k_;
3579  __PYX_INC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3580  }
3581  if (values[9]) {
3582  __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error)
3583  } else {
3584  __pyx_v_alpha = ((double)0.);
3585  }
3586  }
3587  goto __pyx_L4_argument_unpacking_done;
3588  __pyx_L5_argtuple_error:;
3589  __Pyx_RaiseArgtupleInvalid("smoothNodesLaplace", 0, 6, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 11, __pyx_L3_error)
3590  __pyx_L3_error:;
3591  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesLaplace", __pyx_clineno, __pyx_lineno, __pyx_filename);
3592  __Pyx_RefNannyFinishContext();
3593  return NULL;
3594  __pyx_L4_argument_unpacking_done:;
3595  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_smoothNodesLaplace(__pyx_self, __pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes_owned, __pyx_v_nd, __pyx_v_simultaneous, __pyx_v_smoothBoundaries, __pyx_v_fixedNodesBoolArray, __pyx_v_alpha);
3596 
3597  /* "mprans/MeshSmoothing.pyx":11
3598  * from proteus.Profiling import logEvent
3599  *
3600  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3601  * int[:] nodeStarOffsets,
3602  * int[:] nodeStarArray,
3603  */
3604 
3605  /* function exit code */
3606  __Pyx_RefNannyFinishContext();
3607  return __pyx_r;
3608 }
3609 
3610 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_smoothNodesLaplace(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes_owned, int __pyx_v_nd, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha) {
3611  PyObject *__pyx_r = NULL;
3612  __Pyx_RefNannyDeclarations
3613  struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace __pyx_t_1;
3614  __Pyx_RefNannySetupContext("smoothNodesLaplace", 0);
3615 
3616  /* "mprans/MeshSmoothing.pyx":53
3617  * penalty term related to original position of nodes (0 <= alpha <= 1)
3618  * """
3619  * cySmoothNodesLaplace(nodeArray_=nodeArray_, # <<<<<<<<<<<<<<
3620  * nodeStarOffsets=nodeStarOffsets,
3621  * nodeStarArray=nodeStarArray,
3622  */
3623  __pyx_t_1.__pyx_n = 4;
3624  __pyx_t_1.simultaneous = __pyx_v_simultaneous;
3625  __pyx_t_1.smoothBoundaries = __pyx_v_smoothBoundaries;
3626  __pyx_t_1.fixedNodesBoolArray = __pyx_v_fixedNodesBoolArray;
3627  __pyx_t_1.alpha = __pyx_v_alpha;
3628  __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace(__pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes_owned, __pyx_v_nd, &__pyx_t_1);
3629 
3630  /* "mprans/MeshSmoothing.pyx":11
3631  * from proteus.Profiling import logEvent
3632  *
3633  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3634  * int[:] nodeStarOffsets,
3635  * int[:] nodeStarArray,
3636  */
3637 
3638  /* function exit code */
3639  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3640  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray_, 1);
3641  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarOffsets, 1);
3642  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarArray, 1);
3643  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
3644  __PYX_XDEC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3645  __Pyx_XGIVEREF(__pyx_r);
3646  __Pyx_RefNannyFinishContext();
3647  return __pyx_r;
3648 }
3649 
3650 /* "mprans/MeshSmoothing.pyx":64
3651  * alpha=alpha)
3652  *
3653  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3654  * int[:] nodeElementOffsets,
3655  * int[:] nodeElementsArray,
3656  */
3657 
3658 /* Python wrapper */
3659 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_3smoothNodesCentroid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3660 static char __pyx_doc_6mprans_13MeshSmoothing_2smoothNodesCentroid[] = "\n Centroid Smoothing:\n Mesh nodes are displaced to the centroid of the polygon/volume formed by\n neighbouring nodes\n\n Parameters\n ----------\n nodeArray_: double[:,:]\n array of mesh nodes\n (!) will be modified with smoothing\n nodeElementsOffsets: int[:]\n array to get offsets for neighbouring element numbers\n nodeElementsArray: int[:]\n array to get element number from nodeElementOffsets\n nodeMaterialTypes: int[:]\n array to know which node is interior node (materialType=0)\n elementBarycentersArray: double[:,:]\n barycenters of elements\n elementVolumesArray: double[:]\n volume of elements\n elementNodesArray: int[:,:]\n list of nodes per elements\n nNodes_owned: int\n number of nodes owned\n simultaneous: bool\n if True: simultaneous smoothing\n if False: sequential smoothing\n (!) will update areas/volumes and barycenters in this case\n smoothBoundaries: bool\n if True: boundaries are smoothed (only with surrounding boundary nodes)\n if False: boudnary nodes are fixed\n fixedNodesBoolArray: int[:]\n array of same length as nodeArray with:\n fixedNodesBoolArray[node] = 1 -> node is fixed\n fixedNodesBoolArray[node] = 0 -> node is not fixed\n alpha: double\n penalty term related to original position of nodes (0 <= alpha <= 1)\n ";
3661 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_3smoothNodesCentroid = {"smoothNodesCentroid", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_3smoothNodesCentroid, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_2smoothNodesCentroid};
3662 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_3smoothNodesCentroid(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3663  __Pyx_memviewslice __pyx_v_nodeArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
3664  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
3665  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3666  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
3667  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3668  __Pyx_memviewslice __pyx_v_elementVolumesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3669  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3670  int __pyx_v_nNodes_owned;
3671  bool __pyx_v_simultaneous;
3672  bool __pyx_v_smoothBoundaries;
3673  __Pyx_memviewslice __pyx_v_fixedNodesBoolArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3674  double __pyx_v_alpha;
3675  int __pyx_lineno = 0;
3676  const char *__pyx_filename = NULL;
3677  int __pyx_clineno = 0;
3678  PyObject *__pyx_r = 0;
3679  __Pyx_RefNannyDeclarations
3680  __Pyx_RefNannySetupContext("smoothNodesCentroid (wrapper)", 0);
3681  {
3682  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementVolumesArray,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nNodes_owned,&__pyx_n_s_simultaneous,&__pyx_n_s_smoothBoundaries,&__pyx_n_s_fixedNodesBoolArray,&__pyx_n_s_alpha,0};
3683  PyObject* values[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
3684  if (unlikely(__pyx_kwds)) {
3685  Py_ssize_t kw_args;
3686  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3687  switch (pos_args) {
3688  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3689  CYTHON_FALLTHROUGH;
3690  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3691  CYTHON_FALLTHROUGH;
3692  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3693  CYTHON_FALLTHROUGH;
3694  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3695  CYTHON_FALLTHROUGH;
3696  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3697  CYTHON_FALLTHROUGH;
3698  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3699  CYTHON_FALLTHROUGH;
3700  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3701  CYTHON_FALLTHROUGH;
3702  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3703  CYTHON_FALLTHROUGH;
3704  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3705  CYTHON_FALLTHROUGH;
3706  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3707  CYTHON_FALLTHROUGH;
3708  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3709  CYTHON_FALLTHROUGH;
3710  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3711  CYTHON_FALLTHROUGH;
3712  case 0: break;
3713  default: goto __pyx_L5_argtuple_error;
3714  }
3715  kw_args = PyDict_Size(__pyx_kwds);
3716  switch (pos_args) {
3717  case 0:
3718  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray)) != 0)) kw_args--;
3719  else goto __pyx_L5_argtuple_error;
3720  CYTHON_FALLTHROUGH;
3721  case 1:
3722  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
3723  else {
3724  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 1); __PYX_ERR(0, 64, __pyx_L3_error)
3725  }
3726  CYTHON_FALLTHROUGH;
3727  case 2:
3728  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
3729  else {
3730  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 2); __PYX_ERR(0, 64, __pyx_L3_error)
3731  }
3732  CYTHON_FALLTHROUGH;
3733  case 3:
3734  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
3735  else {
3736  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 3); __PYX_ERR(0, 64, __pyx_L3_error)
3737  }
3738  CYTHON_FALLTHROUGH;
3739  case 4:
3740  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
3741  else {
3742  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 4); __PYX_ERR(0, 64, __pyx_L3_error)
3743  }
3744  CYTHON_FALLTHROUGH;
3745  case 5:
3746  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumesArray)) != 0)) kw_args--;
3747  else {
3748  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 5); __PYX_ERR(0, 64, __pyx_L3_error)
3749  }
3750  CYTHON_FALLTHROUGH;
3751  case 6:
3752  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
3753  else {
3754  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 6); __PYX_ERR(0, 64, __pyx_L3_error)
3755  }
3756  CYTHON_FALLTHROUGH;
3757  case 7:
3758  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
3759  else {
3760  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, 7); __PYX_ERR(0, 64, __pyx_L3_error)
3761  }
3762  CYTHON_FALLTHROUGH;
3763  case 8:
3764  if (kw_args > 0) {
3765  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_simultaneous);
3766  if (value) { values[8] = value; kw_args--; }
3767  }
3768  CYTHON_FALLTHROUGH;
3769  case 9:
3770  if (kw_args > 0) {
3771  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_smoothBoundaries);
3772  if (value) { values[9] = value; kw_args--; }
3773  }
3774  CYTHON_FALLTHROUGH;
3775  case 10:
3776  if (kw_args > 0) {
3777  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fixedNodesBoolArray);
3778  if (value) { values[10] = value; kw_args--; }
3779  }
3780  CYTHON_FALLTHROUGH;
3781  case 11:
3782  if (kw_args > 0) {
3783  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alpha);
3784  if (value) { values[11] = value; kw_args--; }
3785  }
3786  }
3787  if (unlikely(kw_args > 0)) {
3788  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothNodesCentroid") < 0)) __PYX_ERR(0, 64, __pyx_L3_error)
3789  }
3790  } else {
3791  switch (PyTuple_GET_SIZE(__pyx_args)) {
3792  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3793  CYTHON_FALLTHROUGH;
3794  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3795  CYTHON_FALLTHROUGH;
3796  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3797  CYTHON_FALLTHROUGH;
3798  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3799  CYTHON_FALLTHROUGH;
3800  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3801  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3802  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3803  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3804  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3805  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3806  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3807  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3808  break;
3809  default: goto __pyx_L5_argtuple_error;
3810  }
3811  }
3812  __pyx_v_nodeArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray_.memview)) __PYX_ERR(0, 64, __pyx_L3_error)
3813  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 65, __pyx_L3_error)
3814  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 66, __pyx_L3_error)
3815  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 67, __pyx_L3_error)
3816  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 68, __pyx_L3_error)
3817  __pyx_v_elementVolumesArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumesArray.memview)) __PYX_ERR(0, 69, __pyx_L3_error)
3818  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 70, __pyx_L3_error)
3819  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
3820  if (values[8]) {
3821  __pyx_v_simultaneous = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_simultaneous == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error)
3822  } else {
3823 
3824  /* "mprans/MeshSmoothing.pyx":72
3825  * int[:,:] elementNodesArray,
3826  * int nNodes_owned,
3827  * bool simultaneous=True, # <<<<<<<<<<<<<<
3828  * bool smoothBoundaries=True,
3829  * int[:] fixedNodesBoolArray=None,
3830  */
3831  __pyx_v_simultaneous = ((bool)1);
3832  }
3833  if (values[9]) {
3834  __pyx_v_smoothBoundaries = __Pyx_PyObject_IsTrue(values[9]); if (unlikely((__pyx_v_smoothBoundaries == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error)
3835  } else {
3836 
3837  /* "mprans/MeshSmoothing.pyx":73
3838  * int nNodes_owned,
3839  * bool simultaneous=True,
3840  * bool smoothBoundaries=True, # <<<<<<<<<<<<<<
3841  * int[:] fixedNodesBoolArray=None,
3842  * double alpha=0.):
3843  */
3844  __pyx_v_smoothBoundaries = ((bool)1);
3845  }
3846  if (values[10]) {
3847  __pyx_v_fixedNodesBoolArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_fixedNodesBoolArray.memview)) __PYX_ERR(0, 74, __pyx_L3_error)
3848  } else {
3849  __pyx_v_fixedNodesBoolArray = __pyx_k__2;
3850  __PYX_INC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3851  }
3852  if (values[11]) {
3853  __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L3_error)
3854  } else {
3855  __pyx_v_alpha = ((double)0.);
3856  }
3857  }
3858  goto __pyx_L4_argument_unpacking_done;
3859  __pyx_L5_argtuple_error:;
3860  __Pyx_RaiseArgtupleInvalid("smoothNodesCentroid", 0, 8, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 64, __pyx_L3_error)
3861  __pyx_L3_error:;
3862  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesCentroid", __pyx_clineno, __pyx_lineno, __pyx_filename);
3863  __Pyx_RefNannyFinishContext();
3864  return NULL;
3865  __pyx_L4_argument_unpacking_done:;
3866  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_2smoothNodesCentroid(__pyx_self, __pyx_v_nodeArray_, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nodeMaterialTypes, __pyx_v_elementBarycentersArray, __pyx_v_elementVolumesArray, __pyx_v_elementNodesArray, __pyx_v_nNodes_owned, __pyx_v_simultaneous, __pyx_v_smoothBoundaries, __pyx_v_fixedNodesBoolArray, __pyx_v_alpha);
3867 
3868  /* "mprans/MeshSmoothing.pyx":64
3869  * alpha=alpha)
3870  *
3871  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3872  * int[:] nodeElementOffsets,
3873  * int[:] nodeElementsArray,
3874  */
3875 
3876  /* function exit code */
3877  __Pyx_RefNannyFinishContext();
3878  return __pyx_r;
3879 }
3880 
3881 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_2smoothNodesCentroid(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementVolumesArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nNodes_owned, bool __pyx_v_simultaneous, bool __pyx_v_smoothBoundaries, __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, double __pyx_v_alpha) {
3882  PyObject *__pyx_r = NULL;
3883  __Pyx_RefNannyDeclarations
3884  struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid __pyx_t_1;
3885  __Pyx_RefNannySetupContext("smoothNodesCentroid", 0);
3886 
3887  /* "mprans/MeshSmoothing.pyx":114
3888  * penalty term related to original position of nodes (0 <= alpha <= 1)
3889  * """
3890  * cySmoothNodesCentroid(nodeArray_=nodeArray_, # <<<<<<<<<<<<<<
3891  * nodeElementOffsets=nodeElementOffsets,
3892  * nodeElementsArray=nodeElementsArray,
3893  */
3894  __pyx_t_1.__pyx_n = 3;
3895  __pyx_t_1.simultaneous = __pyx_v_simultaneous;
3896  __pyx_t_1.smoothBoundaries = __pyx_v_smoothBoundaries;
3897  __pyx_t_1.alpha = __pyx_v_alpha;
3898  __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid(__pyx_v_nodeArray_, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nodeMaterialTypes, __pyx_v_elementVolumesArray, __pyx_v_elementBarycentersArray, __pyx_v_elementNodesArray, __pyx_v_nNodes_owned, __pyx_v_fixedNodesBoolArray, &__pyx_t_1);
3899 
3900  /* "mprans/MeshSmoothing.pyx":64
3901  * alpha=alpha)
3902  *
3903  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
3904  * int[:] nodeElementOffsets,
3905  * int[:] nodeElementsArray,
3906  */
3907 
3908  /* function exit code */
3909  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3910  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray_, 1);
3911  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
3912  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
3913  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
3914  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
3915  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumesArray, 1);
3916  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
3917  __PYX_XDEC_MEMVIEW(&__pyx_v_fixedNodesBoolArray, 1);
3918  __Pyx_XGIVEREF(__pyx_r);
3919  __Pyx_RefNannyFinishContext();
3920  return __pyx_r;
3921 }
3922 
3923 /* "mprans/MeshSmoothing.pyx":127
3924  * alpha=alpha)
3925  *
3926  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
3927  * double[:] elementVolumeArray,
3928  * double[:] elementVolumeTargetArray,
3929  */
3930 
3931 /* Python wrapper */
3932 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_5updateDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3933 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_5updateDilationElements = {"updateDilationElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_5updateDilationElements, METH_VARARGS|METH_KEYWORDS, 0};
3934 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_5updateDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3935  __Pyx_memviewslice __pyx_v_elementDilationArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
3936  __Pyx_memviewslice __pyx_v_elementVolumeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3937  __Pyx_memviewslice __pyx_v_elementVolumeTargetArray = { 0, 0, { 0 }, { 0 }, { 0 } };
3938  int __pyx_v_nElements;
3939  int __pyx_lineno = 0;
3940  const char *__pyx_filename = NULL;
3941  int __pyx_clineno = 0;
3942  PyObject *__pyx_r = 0;
3943  __Pyx_RefNannyDeclarations
3944  __Pyx_RefNannySetupContext("updateDilationElements (wrapper)", 0);
3945  {
3946  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementDilationArray,&__pyx_n_s_elementVolumeArray,&__pyx_n_s_elementVolumeTargetArray,&__pyx_n_s_nElements,0};
3947  PyObject* values[4] = {0,0,0,0};
3948  if (unlikely(__pyx_kwds)) {
3949  Py_ssize_t kw_args;
3950  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3951  switch (pos_args) {
3952  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3953  CYTHON_FALLTHROUGH;
3954  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3955  CYTHON_FALLTHROUGH;
3956  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3957  CYTHON_FALLTHROUGH;
3958  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3959  CYTHON_FALLTHROUGH;
3960  case 0: break;
3961  default: goto __pyx_L5_argtuple_error;
3962  }
3963  kw_args = PyDict_Size(__pyx_kwds);
3964  switch (pos_args) {
3965  case 0:
3966  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDilationArray)) != 0)) kw_args--;
3967  else goto __pyx_L5_argtuple_error;
3968  CYTHON_FALLTHROUGH;
3969  case 1:
3970  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeArray)) != 0)) kw_args--;
3971  else {
3972  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, 1); __PYX_ERR(0, 127, __pyx_L3_error)
3973  }
3974  CYTHON_FALLTHROUGH;
3975  case 2:
3976  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeTargetArray)) != 0)) kw_args--;
3977  else {
3978  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, 2); __PYX_ERR(0, 127, __pyx_L3_error)
3979  }
3980  CYTHON_FALLTHROUGH;
3981  case 3:
3982  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
3983  else {
3984  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, 3); __PYX_ERR(0, 127, __pyx_L3_error)
3985  }
3986  }
3987  if (unlikely(kw_args > 0)) {
3988  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateDilationElements") < 0)) __PYX_ERR(0, 127, __pyx_L3_error)
3989  }
3990  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3991  goto __pyx_L5_argtuple_error;
3992  } else {
3993  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3994  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3995  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3996  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3997  }
3998  __pyx_v_elementDilationArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementDilationArray_.memview)) __PYX_ERR(0, 127, __pyx_L3_error)
3999  __pyx_v_elementVolumeArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeArray.memview)) __PYX_ERR(0, 128, __pyx_L3_error)
4000  __pyx_v_elementVolumeTargetArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeTargetArray.memview)) __PYX_ERR(0, 129, __pyx_L3_error)
4001  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L3_error)
4002  }
4003  goto __pyx_L4_argument_unpacking_done;
4004  __pyx_L5_argtuple_error:;
4005  __Pyx_RaiseArgtupleInvalid("updateDilationElements", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error)
4006  __pyx_L3_error:;
4007  __Pyx_AddTraceback("mprans.MeshSmoothing.updateDilationElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4008  __Pyx_RefNannyFinishContext();
4009  return NULL;
4010  __pyx_L4_argument_unpacking_done:;
4011  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_4updateDilationElements(__pyx_self, __pyx_v_elementDilationArray_, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray, __pyx_v_nElements);
4012 
4013  /* function exit code */
4014  __Pyx_RefNannyFinishContext();
4015  return __pyx_r;
4016 }
4017 
4018 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_4updateDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDilationArray_, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray, int __pyx_v_nElements) {
4019  PyObject *__pyx_r = NULL;
4020  __Pyx_RefNannyDeclarations
4021  __Pyx_RefNannySetupContext("updateDilationElements", 0);
4022 
4023  /* "mprans/MeshSmoothing.pyx":131
4024  * double[:] elementVolumeTargetArray,
4025  * int nElements):
4026  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_, # <<<<<<<<<<<<<<
4027  * elementVolumeArray=elementVolumeArray,
4028  * elementVolumeTargetArray=elementVolumeTargetArray,
4029  */
4030  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__pyx_v_elementDilationArray_, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray, __pyx_v_nElements);
4031 
4032  /* "mprans/MeshSmoothing.pyx":127
4033  * alpha=alpha)
4034  *
4035  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
4036  * double[:] elementVolumeArray,
4037  * double[:] elementVolumeTargetArray,
4038  */
4039 
4040  /* function exit code */
4041  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4042  __PYX_XDEC_MEMVIEW(&__pyx_v_elementDilationArray_, 1);
4043  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeArray, 1);
4044  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeTargetArray, 1);
4045  __Pyx_XGIVEREF(__pyx_r);
4046  __Pyx_RefNannyFinishContext();
4047  return __pyx_r;
4048 }
4049 
4050 /* "mprans/MeshSmoothing.pyx":136
4051  * nElements=nElements)
4052  *
4053  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
4054  * double[:] elementVolumeTargetArray):
4055  * cdef int nElements = len(elementVolumeArray)
4056  */
4057 
4058 /* Python wrapper */
4059 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_7getDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4060 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_7getDilationElements = {"getDilationElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_7getDilationElements, METH_VARARGS|METH_KEYWORDS, 0};
4061 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_7getDilationElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4062  __Pyx_memviewslice __pyx_v_elementVolumeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4063  __Pyx_memviewslice __pyx_v_elementVolumeTargetArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4064  int __pyx_lineno = 0;
4065  const char *__pyx_filename = NULL;
4066  int __pyx_clineno = 0;
4067  PyObject *__pyx_r = 0;
4068  __Pyx_RefNannyDeclarations
4069  __Pyx_RefNannySetupContext("getDilationElements (wrapper)", 0);
4070  {
4071  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementVolumeArray,&__pyx_n_s_elementVolumeTargetArray,0};
4072  PyObject* values[2] = {0,0};
4073  if (unlikely(__pyx_kwds)) {
4074  Py_ssize_t kw_args;
4075  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4076  switch (pos_args) {
4077  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4078  CYTHON_FALLTHROUGH;
4079  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4080  CYTHON_FALLTHROUGH;
4081  case 0: break;
4082  default: goto __pyx_L5_argtuple_error;
4083  }
4084  kw_args = PyDict_Size(__pyx_kwds);
4085  switch (pos_args) {
4086  case 0:
4087  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeArray)) != 0)) kw_args--;
4088  else goto __pyx_L5_argtuple_error;
4089  CYTHON_FALLTHROUGH;
4090  case 1:
4091  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumeTargetArray)) != 0)) kw_args--;
4092  else {
4093  __Pyx_RaiseArgtupleInvalid("getDilationElements", 1, 2, 2, 1); __PYX_ERR(0, 136, __pyx_L3_error)
4094  }
4095  }
4096  if (unlikely(kw_args > 0)) {
4097  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getDilationElements") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
4098  }
4099  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4100  goto __pyx_L5_argtuple_error;
4101  } else {
4102  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4103  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4104  }
4105  __pyx_v_elementVolumeArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeArray.memview)) __PYX_ERR(0, 136, __pyx_L3_error)
4106  __pyx_v_elementVolumeTargetArray = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumeTargetArray.memview)) __PYX_ERR(0, 137, __pyx_L3_error)
4107  }
4108  goto __pyx_L4_argument_unpacking_done;
4109  __pyx_L5_argtuple_error:;
4110  __Pyx_RaiseArgtupleInvalid("getDilationElements", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error)
4111  __pyx_L3_error:;
4112  __Pyx_AddTraceback("mprans.MeshSmoothing.getDilationElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4113  __Pyx_RefNannyFinishContext();
4114  return NULL;
4115  __pyx_L4_argument_unpacking_done:;
4116  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_6getDilationElements(__pyx_self, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray);
4117 
4118  /* function exit code */
4119  __Pyx_RefNannyFinishContext();
4120  return __pyx_r;
4121 }
4122 
4123 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_6getDilationElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray) {
4124  int __pyx_v_nElements;
4125  PyObject *__pyx_v_elementDilationArray_ = NULL;
4126  PyObject *__pyx_r = NULL;
4127  __Pyx_RefNannyDeclarations
4128  size_t __pyx_t_1;
4129  PyObject *__pyx_t_2 = NULL;
4130  PyObject *__pyx_t_3 = NULL;
4131  PyObject *__pyx_t_4 = NULL;
4132  PyObject *__pyx_t_5 = NULL;
4133  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4134  int __pyx_lineno = 0;
4135  const char *__pyx_filename = NULL;
4136  int __pyx_clineno = 0;
4137  __Pyx_RefNannySetupContext("getDilationElements", 0);
4138 
4139  /* "mprans/MeshSmoothing.pyx":138
4140  * def getDilationElements(double[:] elementVolumeArray,
4141  * double[:] elementVolumeTargetArray):
4142  * cdef int nElements = len(elementVolumeArray) # <<<<<<<<<<<<<<
4143  * elementDilationArray_ = np.zeros(nElements)
4144  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_,
4145  */
4146  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_elementVolumeArray);
4147  __pyx_v_nElements = __pyx_t_1;
4148 
4149  /* "mprans/MeshSmoothing.pyx":139
4150  * double[:] elementVolumeTargetArray):
4151  * cdef int nElements = len(elementVolumeArray)
4152  * elementDilationArray_ = np.zeros(nElements) # <<<<<<<<<<<<<<
4153  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_,
4154  * elementVolumeArray=elementVolumeArray,
4155  */
4156  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4157  __Pyx_GOTREF(__pyx_t_3);
4158  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
4159  __Pyx_GOTREF(__pyx_t_4);
4160  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4161  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error)
4162  __Pyx_GOTREF(__pyx_t_3);
4163  __pyx_t_5 = NULL;
4164  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4165  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4166  if (likely(__pyx_t_5)) {
4167  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4168  __Pyx_INCREF(__pyx_t_5);
4169  __Pyx_INCREF(function);
4170  __Pyx_DECREF_SET(__pyx_t_4, function);
4171  }
4172  }
4173  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
4174  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4175  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4176  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
4177  __Pyx_GOTREF(__pyx_t_2);
4178  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4179  __pyx_v_elementDilationArray_ = __pyx_t_2;
4180  __pyx_t_2 = 0;
4181 
4182  /* "mprans/MeshSmoothing.pyx":140
4183  * cdef int nElements = len(elementVolumeArray)
4184  * elementDilationArray_ = np.zeros(nElements)
4185  * cyUpdateDilationElements(elementDilationArray_=elementDilationArray_, # <<<<<<<<<<<<<<
4186  * elementVolumeArray=elementVolumeArray,
4187  * elementVolumeTargetArray=elementVolumeTargetArray,
4188  */
4189  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_elementDilationArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 140, __pyx_L1_error)
4190 
4191  /* "mprans/MeshSmoothing.pyx":143
4192  * elementVolumeArray=elementVolumeArray,
4193  * elementVolumeTargetArray=elementVolumeTargetArray,
4194  * nElements=nElements) # <<<<<<<<<<<<<<
4195  * return elementDilationArray_
4196  *
4197  */
4198  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__pyx_t_6, __pyx_v_elementVolumeArray, __pyx_v_elementVolumeTargetArray, __pyx_v_nElements);
4199  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4200  __pyx_t_6.memview = NULL;
4201  __pyx_t_6.data = NULL;
4202 
4203  /* "mprans/MeshSmoothing.pyx":144
4204  * elementVolumeTargetArray=elementVolumeTargetArray,
4205  * nElements=nElements)
4206  * return elementDilationArray_ # <<<<<<<<<<<<<<
4207  *
4208  * def updateDistortionElements(double[:] elementDistortionArray_,
4209  */
4210  __Pyx_XDECREF(__pyx_r);
4211  __Pyx_INCREF(__pyx_v_elementDilationArray_);
4212  __pyx_r = __pyx_v_elementDilationArray_;
4213  goto __pyx_L0;
4214 
4215  /* "mprans/MeshSmoothing.pyx":136
4216  * nElements=nElements)
4217  *
4218  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
4219  * double[:] elementVolumeTargetArray):
4220  * cdef int nElements = len(elementVolumeArray)
4221  */
4222 
4223  /* function exit code */
4224  __pyx_L1_error:;
4225  __Pyx_XDECREF(__pyx_t_2);
4226  __Pyx_XDECREF(__pyx_t_3);
4227  __Pyx_XDECREF(__pyx_t_4);
4228  __Pyx_XDECREF(__pyx_t_5);
4229  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4230  __Pyx_AddTraceback("mprans.MeshSmoothing.getDilationElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4231  __pyx_r = NULL;
4232  __pyx_L0:;
4233  __Pyx_XDECREF(__pyx_v_elementDilationArray_);
4234  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeArray, 1);
4235  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumeTargetArray, 1);
4236  __Pyx_XGIVEREF(__pyx_r);
4237  __Pyx_RefNannyFinishContext();
4238  return __pyx_r;
4239 }
4240 
4241 /* "mprans/MeshSmoothing.pyx":146
4242  * return elementDilationArray_
4243  *
4244  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
4245  * double[:,:,:,:] J_array,
4246  * double[:,:] detJ_array,
4247  */
4248 
4249 /* Python wrapper */
4250 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_9updateDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4251 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_9updateDistortionElements = {"updateDistortionElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_9updateDistortionElements, METH_VARARGS|METH_KEYWORDS, 0};
4252 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_9updateDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4253  __Pyx_memviewslice __pyx_v_elementDistortionArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
4254  __Pyx_memviewslice __pyx_v_J_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4255  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4256  int __pyx_v_nd;
4257  int __pyx_v_nElements;
4258  int __pyx_lineno = 0;
4259  const char *__pyx_filename = NULL;
4260  int __pyx_clineno = 0;
4261  PyObject *__pyx_r = 0;
4262  __Pyx_RefNannyDeclarations
4263  __Pyx_RefNannySetupContext("updateDistortionElements (wrapper)", 0);
4264  {
4265  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementDistortionArray,&__pyx_n_s_J_array,&__pyx_n_s_detJ_array,&__pyx_n_s_nd,&__pyx_n_s_nElements,0};
4266  PyObject* values[5] = {0,0,0,0,0};
4267  if (unlikely(__pyx_kwds)) {
4268  Py_ssize_t kw_args;
4269  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4270  switch (pos_args) {
4271  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4272  CYTHON_FALLTHROUGH;
4273  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4274  CYTHON_FALLTHROUGH;
4275  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4276  CYTHON_FALLTHROUGH;
4277  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4278  CYTHON_FALLTHROUGH;
4279  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4280  CYTHON_FALLTHROUGH;
4281  case 0: break;
4282  default: goto __pyx_L5_argtuple_error;
4283  }
4284  kw_args = PyDict_Size(__pyx_kwds);
4285  switch (pos_args) {
4286  case 0:
4287  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementDistortionArray)) != 0)) kw_args--;
4288  else goto __pyx_L5_argtuple_error;
4289  CYTHON_FALLTHROUGH;
4290  case 1:
4291  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_J_array)) != 0)) kw_args--;
4292  else {
4293  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 1); __PYX_ERR(0, 146, __pyx_L3_error)
4294  }
4295  CYTHON_FALLTHROUGH;
4296  case 2:
4297  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
4298  else {
4299  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 2); __PYX_ERR(0, 146, __pyx_L3_error)
4300  }
4301  CYTHON_FALLTHROUGH;
4302  case 3:
4303  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4304  else {
4305  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 3); __PYX_ERR(0, 146, __pyx_L3_error)
4306  }
4307  CYTHON_FALLTHROUGH;
4308  case 4:
4309  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
4310  else {
4311  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, 4); __PYX_ERR(0, 146, __pyx_L3_error)
4312  }
4313  }
4314  if (unlikely(kw_args > 0)) {
4315  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateDistortionElements") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
4316  }
4317  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4318  goto __pyx_L5_argtuple_error;
4319  } else {
4320  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4321  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4322  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4323  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4324  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4325  }
4326  __pyx_v_elementDistortionArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementDistortionArray_.memview)) __PYX_ERR(0, 146, __pyx_L3_error)
4327  __pyx_v_J_array = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_J_array.memview)) __PYX_ERR(0, 147, __pyx_L3_error)
4328  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 148, __pyx_L3_error)
4329  __pyx_v_nd = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L3_error)
4330  __pyx_v_nElements = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error)
4331  }
4332  goto __pyx_L4_argument_unpacking_done;
4333  __pyx_L5_argtuple_error:;
4334  __Pyx_RaiseArgtupleInvalid("updateDistortionElements", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
4335  __pyx_L3_error:;
4336  __Pyx_AddTraceback("mprans.MeshSmoothing.updateDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4337  __Pyx_RefNannyFinishContext();
4338  return NULL;
4339  __pyx_L4_argument_unpacking_done:;
4340  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_8updateDistortionElements(__pyx_self, __pyx_v_elementDistortionArray_, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd, __pyx_v_nElements);
4341 
4342  /* function exit code */
4343  __Pyx_RefNannyFinishContext();
4344  return __pyx_r;
4345 }
4346 
4347 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_8updateDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementDistortionArray_, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd, int __pyx_v_nElements) {
4348  PyObject *__pyx_r = NULL;
4349  __Pyx_RefNannyDeclarations
4350  __Pyx_RefNannySetupContext("updateDistortionElements", 0);
4351 
4352  /* "mprans/MeshSmoothing.pyx":151
4353  * int nd,
4354  * int nElements):
4355  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_, # <<<<<<<<<<<<<<
4356  * J_array=J_array,
4357  * detJ_array=detJ_array,
4358  */
4359  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__pyx_v_elementDistortionArray_, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd, __pyx_v_nElements);
4360 
4361  /* "mprans/MeshSmoothing.pyx":146
4362  * return elementDilationArray_
4363  *
4364  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
4365  * double[:,:,:,:] J_array,
4366  * double[:,:] detJ_array,
4367  */
4368 
4369  /* function exit code */
4370  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4371  __PYX_XDEC_MEMVIEW(&__pyx_v_elementDistortionArray_, 1);
4372  __PYX_XDEC_MEMVIEW(&__pyx_v_J_array, 1);
4373  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
4374  __Pyx_XGIVEREF(__pyx_r);
4375  __Pyx_RefNannyFinishContext();
4376  return __pyx_r;
4377 }
4378 
4379 /* "mprans/MeshSmoothing.pyx":157
4380  * nElements=nElements)
4381  *
4382  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
4383  * double[:,:] detJ_array,
4384  * int nd):
4385  */
4386 
4387 /* Python wrapper */
4388 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_11getDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4389 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_11getDistortionElements = {"getDistortionElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_11getDistortionElements, METH_VARARGS|METH_KEYWORDS, 0};
4390 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_11getDistortionElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4391  __Pyx_memviewslice __pyx_v_J_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4392  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
4393  int __pyx_v_nd;
4394  int __pyx_lineno = 0;
4395  const char *__pyx_filename = NULL;
4396  int __pyx_clineno = 0;
4397  PyObject *__pyx_r = 0;
4398  __Pyx_RefNannyDeclarations
4399  __Pyx_RefNannySetupContext("getDistortionElements (wrapper)", 0);
4400  {
4401  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_J_array,&__pyx_n_s_detJ_array,&__pyx_n_s_nd,0};
4402  PyObject* values[3] = {0,0,0};
4403  if (unlikely(__pyx_kwds)) {
4404  Py_ssize_t kw_args;
4405  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4406  switch (pos_args) {
4407  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4408  CYTHON_FALLTHROUGH;
4409  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4410  CYTHON_FALLTHROUGH;
4411  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4412  CYTHON_FALLTHROUGH;
4413  case 0: break;
4414  default: goto __pyx_L5_argtuple_error;
4415  }
4416  kw_args = PyDict_Size(__pyx_kwds);
4417  switch (pos_args) {
4418  case 0:
4419  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_J_array)) != 0)) kw_args--;
4420  else goto __pyx_L5_argtuple_error;
4421  CYTHON_FALLTHROUGH;
4422  case 1:
4423  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
4424  else {
4425  __Pyx_RaiseArgtupleInvalid("getDistortionElements", 1, 3, 3, 1); __PYX_ERR(0, 157, __pyx_L3_error)
4426  }
4427  CYTHON_FALLTHROUGH;
4428  case 2:
4429  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
4430  else {
4431  __Pyx_RaiseArgtupleInvalid("getDistortionElements", 1, 3, 3, 2); __PYX_ERR(0, 157, __pyx_L3_error)
4432  }
4433  }
4434  if (unlikely(kw_args > 0)) {
4435  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getDistortionElements") < 0)) __PYX_ERR(0, 157, __pyx_L3_error)
4436  }
4437  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4438  goto __pyx_L5_argtuple_error;
4439  } else {
4440  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4441  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4442  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4443  }
4444  __pyx_v_J_array = __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_J_array.memview)) __PYX_ERR(0, 157, __pyx_L3_error)
4445  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 158, __pyx_L3_error)
4446  __pyx_v_nd = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error)
4447  }
4448  goto __pyx_L4_argument_unpacking_done;
4449  __pyx_L5_argtuple_error:;
4450  __Pyx_RaiseArgtupleInvalid("getDistortionElements", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 157, __pyx_L3_error)
4451  __pyx_L3_error:;
4452  __Pyx_AddTraceback("mprans.MeshSmoothing.getDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4453  __Pyx_RefNannyFinishContext();
4454  return NULL;
4455  __pyx_L4_argument_unpacking_done:;
4456  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_10getDistortionElements(__pyx_self, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd);
4457 
4458  /* function exit code */
4459  __Pyx_RefNannyFinishContext();
4460  return __pyx_r;
4461 }
4462 
4463 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_10getDistortionElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd) {
4464  Py_ssize_t __pyx_v_nElements;
4465  PyObject *__pyx_v_elementDistortionArray_ = NULL;
4466  PyObject *__pyx_r = NULL;
4467  __Pyx_RefNannyDeclarations
4468  size_t __pyx_t_1;
4469  PyObject *__pyx_t_2 = NULL;
4470  PyObject *__pyx_t_3 = NULL;
4471  PyObject *__pyx_t_4 = NULL;
4472  PyObject *__pyx_t_5 = NULL;
4473  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4474  int __pyx_lineno = 0;
4475  const char *__pyx_filename = NULL;
4476  int __pyx_clineno = 0;
4477  __Pyx_RefNannySetupContext("getDistortionElements", 0);
4478 
4479  /* "mprans/MeshSmoothing.pyx":160
4480  * double[:,:] detJ_array,
4481  * int nd):
4482  * nElements = len(detJ_array) # <<<<<<<<<<<<<<
4483  * elementDistortionArray_ = np.zeros(nElements)
4484  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_,
4485  */
4486  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_detJ_array);
4487  __pyx_v_nElements = __pyx_t_1;
4488 
4489  /* "mprans/MeshSmoothing.pyx":161
4490  * int nd):
4491  * nElements = len(detJ_array)
4492  * elementDistortionArray_ = np.zeros(nElements) # <<<<<<<<<<<<<<
4493  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_,
4494  * J_array=J_array,
4495  */
4496  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
4497  __Pyx_GOTREF(__pyx_t_3);
4498  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error)
4499  __Pyx_GOTREF(__pyx_t_4);
4500  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4501  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
4502  __Pyx_GOTREF(__pyx_t_3);
4503  __pyx_t_5 = NULL;
4504  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4505  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4506  if (likely(__pyx_t_5)) {
4507  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4508  __Pyx_INCREF(__pyx_t_5);
4509  __Pyx_INCREF(function);
4510  __Pyx_DECREF_SET(__pyx_t_4, function);
4511  }
4512  }
4513  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
4514  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4515  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4516  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error)
4517  __Pyx_GOTREF(__pyx_t_2);
4518  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4519  __pyx_v_elementDistortionArray_ = __pyx_t_2;
4520  __pyx_t_2 = 0;
4521 
4522  /* "mprans/MeshSmoothing.pyx":162
4523  * nElements = len(detJ_array)
4524  * elementDistortionArray_ = np.zeros(nElements)
4525  * cyUpdateDistortionElements(elementDistortionArray_=elementDistortionArray_, # <<<<<<<<<<<<<<
4526  * J_array=J_array,
4527  * detJ_array=detJ_array,
4528  */
4529  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_elementDistortionArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 162, __pyx_L1_error)
4530 
4531  /* "mprans/MeshSmoothing.pyx":166
4532  * detJ_array=detJ_array,
4533  * nd=nd,
4534  * nElements=nElements) # <<<<<<<<<<<<<<
4535  * return elementDistortionArray_
4536  *
4537  */
4538  __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__pyx_t_6, __pyx_v_J_array, __pyx_v_detJ_array, __pyx_v_nd, __pyx_v_nElements);
4539  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4540  __pyx_t_6.memview = NULL;
4541  __pyx_t_6.data = NULL;
4542 
4543  /* "mprans/MeshSmoothing.pyx":167
4544  * nd=nd,
4545  * nElements=nElements)
4546  * return elementDistortionArray_ # <<<<<<<<<<<<<<
4547  *
4548  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_,
4549  */
4550  __Pyx_XDECREF(__pyx_r);
4551  __Pyx_INCREF(__pyx_v_elementDistortionArray_);
4552  __pyx_r = __pyx_v_elementDistortionArray_;
4553  goto __pyx_L0;
4554 
4555  /* "mprans/MeshSmoothing.pyx":157
4556  * nElements=nElements)
4557  *
4558  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
4559  * double[:,:] detJ_array,
4560  * int nd):
4561  */
4562 
4563  /* function exit code */
4564  __pyx_L1_error:;
4565  __Pyx_XDECREF(__pyx_t_2);
4566  __Pyx_XDECREF(__pyx_t_3);
4567  __Pyx_XDECREF(__pyx_t_4);
4568  __Pyx_XDECREF(__pyx_t_5);
4569  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4570  __Pyx_AddTraceback("mprans.MeshSmoothing.getDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4571  __pyx_r = NULL;
4572  __pyx_L0:;
4573  __Pyx_XDECREF(__pyx_v_elementDistortionArray_);
4574  __PYX_XDEC_MEMVIEW(&__pyx_v_J_array, 1);
4575  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
4576  __Pyx_XGIVEREF(__pyx_r);
4577  __Pyx_RefNannyFinishContext();
4578  return __pyx_r;
4579 }
4580 
4581 /* "mprans/MeshSmoothing.pyx":169
4582  * return elementDistortionArray_
4583  *
4584  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
4585  * double[:,:] nodeArray,
4586  * int[:,:] elementNodesArray,
4587  */
4588 
4589 /* Python wrapper */
4590 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4591 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements = {"updateInverseMeanRatioTriangleElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements, METH_VARARGS|METH_KEYWORDS, 0};
4592 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4593  __Pyx_memviewslice __pyx_v_IMRElementsArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
4594  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4595  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4596  int __pyx_v_nElements;
4597  int __pyx_lineno = 0;
4598  const char *__pyx_filename = NULL;
4599  int __pyx_clineno = 0;
4600  PyObject *__pyx_r = 0;
4601  __Pyx_RefNannyDeclarations
4602  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleElements (wrapper)", 0);
4603  {
4604  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_IMRElementsArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nElements,0};
4605  PyObject* values[4] = {0,0,0,0};
4606  if (unlikely(__pyx_kwds)) {
4607  Py_ssize_t kw_args;
4608  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4609  switch (pos_args) {
4610  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4611  CYTHON_FALLTHROUGH;
4612  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4613  CYTHON_FALLTHROUGH;
4614  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4615  CYTHON_FALLTHROUGH;
4616  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4617  CYTHON_FALLTHROUGH;
4618  case 0: break;
4619  default: goto __pyx_L5_argtuple_error;
4620  }
4621  kw_args = PyDict_Size(__pyx_kwds);
4622  switch (pos_args) {
4623  case 0:
4624  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_IMRElementsArray)) != 0)) kw_args--;
4625  else goto __pyx_L5_argtuple_error;
4626  CYTHON_FALLTHROUGH;
4627  case 1:
4628  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4629  else {
4630  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, 1); __PYX_ERR(0, 169, __pyx_L3_error)
4631  }
4632  CYTHON_FALLTHROUGH;
4633  case 2:
4634  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
4635  else {
4636  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, 2); __PYX_ERR(0, 169, __pyx_L3_error)
4637  }
4638  CYTHON_FALLTHROUGH;
4639  case 3:
4640  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
4641  else {
4642  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, 3); __PYX_ERR(0, 169, __pyx_L3_error)
4643  }
4644  }
4645  if (unlikely(kw_args > 0)) {
4646  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateInverseMeanRatioTriangleElements") < 0)) __PYX_ERR(0, 169, __pyx_L3_error)
4647  }
4648  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4649  goto __pyx_L5_argtuple_error;
4650  } else {
4651  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4652  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4653  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4654  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4655  }
4656  __pyx_v_IMRElementsArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_IMRElementsArray_.memview)) __PYX_ERR(0, 169, __pyx_L3_error)
4657  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 170, __pyx_L3_error)
4658  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 171, __pyx_L3_error)
4659  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L3_error)
4660  }
4661  goto __pyx_L4_argument_unpacking_done;
4662  __pyx_L5_argtuple_error:;
4663  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleElements", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 169, __pyx_L3_error)
4664  __pyx_L3_error:;
4665  __Pyx_AddTraceback("mprans.MeshSmoothing.updateInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4666  __Pyx_RefNannyFinishContext();
4667  return NULL;
4668  __pyx_L4_argument_unpacking_done:;
4669  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_12updateInverseMeanRatioTriangleElements(__pyx_self, __pyx_v_IMRElementsArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nElements);
4670 
4671  /* function exit code */
4672  __Pyx_RefNannyFinishContext();
4673  return __pyx_r;
4674 }
4675 
4676 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_12updateInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRElementsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nElements) {
4677  PyObject *__pyx_r = NULL;
4678  __Pyx_RefNannyDeclarations
4679  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleElements", 0);
4680 
4681  /* "mprans/MeshSmoothing.pyx":173
4682  * int[:,:] elementNodesArray,
4683  * int nElements):
4684  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_, # <<<<<<<<<<<<<<
4685  * nodeArray=nodeArray,
4686  * elementNodesArray=elementNodesArray,
4687  */
4688  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__pyx_v_IMRElementsArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nElements);
4689 
4690  /* "mprans/MeshSmoothing.pyx":169
4691  * return elementDistortionArray_
4692  *
4693  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
4694  * double[:,:] nodeArray,
4695  * int[:,:] elementNodesArray,
4696  */
4697 
4698  /* function exit code */
4699  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4700  __PYX_XDEC_MEMVIEW(&__pyx_v_IMRElementsArray_, 1);
4701  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
4702  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
4703  __Pyx_XGIVEREF(__pyx_r);
4704  __Pyx_RefNannyFinishContext();
4705  return __pyx_r;
4706 }
4707 
4708 /* "mprans/MeshSmoothing.pyx":178
4709  * nElements=nElements)
4710  *
4711  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
4712  * int[:,:] elementNodesArray):
4713  * cdef int nElements = len(elementNodesArray)
4714  */
4715 
4716 /* Python wrapper */
4717 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4718 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements = {"getInverseMeanRatioTriangleElements", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements, METH_VARARGS|METH_KEYWORDS, 0};
4719 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4720  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4721  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4722  int __pyx_lineno = 0;
4723  const char *__pyx_filename = NULL;
4724  int __pyx_clineno = 0;
4725  PyObject *__pyx_r = 0;
4726  __Pyx_RefNannyDeclarations
4727  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleElements (wrapper)", 0);
4728  {
4729  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,0};
4730  PyObject* values[2] = {0,0};
4731  if (unlikely(__pyx_kwds)) {
4732  Py_ssize_t kw_args;
4733  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4734  switch (pos_args) {
4735  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4736  CYTHON_FALLTHROUGH;
4737  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4738  CYTHON_FALLTHROUGH;
4739  case 0: break;
4740  default: goto __pyx_L5_argtuple_error;
4741  }
4742  kw_args = PyDict_Size(__pyx_kwds);
4743  switch (pos_args) {
4744  case 0:
4745  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4746  else goto __pyx_L5_argtuple_error;
4747  CYTHON_FALLTHROUGH;
4748  case 1:
4749  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
4750  else {
4751  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleElements", 1, 2, 2, 1); __PYX_ERR(0, 178, __pyx_L3_error)
4752  }
4753  }
4754  if (unlikely(kw_args > 0)) {
4755  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInverseMeanRatioTriangleElements") < 0)) __PYX_ERR(0, 178, __pyx_L3_error)
4756  }
4757  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
4758  goto __pyx_L5_argtuple_error;
4759  } else {
4760  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4761  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4762  }
4763  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 178, __pyx_L3_error)
4764  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 179, __pyx_L3_error)
4765  }
4766  goto __pyx_L4_argument_unpacking_done;
4767  __pyx_L5_argtuple_error:;
4768  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleElements", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 178, __pyx_L3_error)
4769  __pyx_L3_error:;
4770  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4771  __Pyx_RefNannyFinishContext();
4772  return NULL;
4773  __pyx_L4_argument_unpacking_done:;
4774  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_14getInverseMeanRatioTriangleElements(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementNodesArray);
4775 
4776  /* function exit code */
4777  __Pyx_RefNannyFinishContext();
4778  return __pyx_r;
4779 }
4780 
4781 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_14getInverseMeanRatioTriangleElements(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray) {
4782  int __pyx_v_nElements;
4783  PyObject *__pyx_v_IMRElementsArray_ = NULL;
4784  PyObject *__pyx_r = NULL;
4785  __Pyx_RefNannyDeclarations
4786  size_t __pyx_t_1;
4787  PyObject *__pyx_t_2 = NULL;
4788  PyObject *__pyx_t_3 = NULL;
4789  PyObject *__pyx_t_4 = NULL;
4790  PyObject *__pyx_t_5 = NULL;
4791  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4792  int __pyx_lineno = 0;
4793  const char *__pyx_filename = NULL;
4794  int __pyx_clineno = 0;
4795  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleElements", 0);
4796 
4797  /* "mprans/MeshSmoothing.pyx":180
4798  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray,
4799  * int[:,:] elementNodesArray):
4800  * cdef int nElements = len(elementNodesArray) # <<<<<<<<<<<<<<
4801  * IMRElementsArray_ = np.zeros(nElements)
4802  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_,
4803  */
4804  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_elementNodesArray);
4805  __pyx_v_nElements = __pyx_t_1;
4806 
4807  /* "mprans/MeshSmoothing.pyx":181
4808  * int[:,:] elementNodesArray):
4809  * cdef int nElements = len(elementNodesArray)
4810  * IMRElementsArray_ = np.zeros(nElements) # <<<<<<<<<<<<<<
4811  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_,
4812  * nodeArray=nodeArray,
4813  */
4814  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4815  __Pyx_GOTREF(__pyx_t_3);
4816  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
4817  __Pyx_GOTREF(__pyx_t_4);
4818  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4819  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4820  __Pyx_GOTREF(__pyx_t_3);
4821  __pyx_t_5 = NULL;
4822  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
4823  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4824  if (likely(__pyx_t_5)) {
4825  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4826  __Pyx_INCREF(__pyx_t_5);
4827  __Pyx_INCREF(function);
4828  __Pyx_DECREF_SET(__pyx_t_4, function);
4829  }
4830  }
4831  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
4832  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4833  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4834  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
4835  __Pyx_GOTREF(__pyx_t_2);
4836  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4837  __pyx_v_IMRElementsArray_ = __pyx_t_2;
4838  __pyx_t_2 = 0;
4839 
4840  /* "mprans/MeshSmoothing.pyx":182
4841  * cdef int nElements = len(elementNodesArray)
4842  * IMRElementsArray_ = np.zeros(nElements)
4843  * cyUpdateInverseMeanRatioTriangleElements(IMRElementsArray_=IMRElementsArray_, # <<<<<<<<<<<<<<
4844  * nodeArray=nodeArray,
4845  * elementNodesArray=elementNodesArray,
4846  */
4847  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_IMRElementsArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 182, __pyx_L1_error)
4848 
4849  /* "mprans/MeshSmoothing.pyx":185
4850  * nodeArray=nodeArray,
4851  * elementNodesArray=elementNodesArray,
4852  * nElements=nElements) # <<<<<<<<<<<<<<
4853  * return IMRElementsArray_
4854  *
4855  */
4856  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__pyx_t_6, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nElements);
4857  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4858  __pyx_t_6.memview = NULL;
4859  __pyx_t_6.data = NULL;
4860 
4861  /* "mprans/MeshSmoothing.pyx":186
4862  * elementNodesArray=elementNodesArray,
4863  * nElements=nElements)
4864  * return IMRElementsArray_ # <<<<<<<<<<<<<<
4865  *
4866  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_,
4867  */
4868  __Pyx_XDECREF(__pyx_r);
4869  __Pyx_INCREF(__pyx_v_IMRElementsArray_);
4870  __pyx_r = __pyx_v_IMRElementsArray_;
4871  goto __pyx_L0;
4872 
4873  /* "mprans/MeshSmoothing.pyx":178
4874  * nElements=nElements)
4875  *
4876  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
4877  * int[:,:] elementNodesArray):
4878  * cdef int nElements = len(elementNodesArray)
4879  */
4880 
4881  /* function exit code */
4882  __pyx_L1_error:;
4883  __Pyx_XDECREF(__pyx_t_2);
4884  __Pyx_XDECREF(__pyx_t_3);
4885  __Pyx_XDECREF(__pyx_t_4);
4886  __Pyx_XDECREF(__pyx_t_5);
4887  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4888  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename);
4889  __pyx_r = NULL;
4890  __pyx_L0:;
4891  __Pyx_XDECREF(__pyx_v_IMRElementsArray_);
4892  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
4893  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
4894  __Pyx_XGIVEREF(__pyx_r);
4895  __Pyx_RefNannyFinishContext();
4896  return __pyx_r;
4897 }
4898 
4899 /* "mprans/MeshSmoothing.pyx":188
4900  * return IMRElementsArray_
4901  *
4902  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
4903  * double[:,:] nodeArray,
4904  * int[:,:] elementNodesArray,
4905  */
4906 
4907 /* Python wrapper */
4908 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4909 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes = {"updateInverseMeanRatioTriangleNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes, METH_VARARGS|METH_KEYWORDS, 0};
4910 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4911  __Pyx_memviewslice __pyx_v_IMRNodesArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
4912  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4913  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4914  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
4915  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
4916  int __pyx_v_nNodes;
4917  int __pyx_v_nElements;
4918  bool __pyx_v_el_average;
4919  int __pyx_lineno = 0;
4920  const char *__pyx_filename = NULL;
4921  int __pyx_clineno = 0;
4922  PyObject *__pyx_r = 0;
4923  __Pyx_RefNannyDeclarations
4924  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleNodes (wrapper)", 0);
4925  {
4926  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_IMRNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nNodes,&__pyx_n_s_nElements,&__pyx_n_s_el_average,0};
4927  PyObject* values[8] = {0,0,0,0,0,0,0,0};
4928  if (unlikely(__pyx_kwds)) {
4929  Py_ssize_t kw_args;
4930  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4931  switch (pos_args) {
4932  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4933  CYTHON_FALLTHROUGH;
4934  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4935  CYTHON_FALLTHROUGH;
4936  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4937  CYTHON_FALLTHROUGH;
4938  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4939  CYTHON_FALLTHROUGH;
4940  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4941  CYTHON_FALLTHROUGH;
4942  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4943  CYTHON_FALLTHROUGH;
4944  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4945  CYTHON_FALLTHROUGH;
4946  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4947  CYTHON_FALLTHROUGH;
4948  case 0: break;
4949  default: goto __pyx_L5_argtuple_error;
4950  }
4951  kw_args = PyDict_Size(__pyx_kwds);
4952  switch (pos_args) {
4953  case 0:
4954  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_IMRNodesArray)) != 0)) kw_args--;
4955  else goto __pyx_L5_argtuple_error;
4956  CYTHON_FALLTHROUGH;
4957  case 1:
4958  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
4959  else {
4960  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 1); __PYX_ERR(0, 188, __pyx_L3_error)
4961  }
4962  CYTHON_FALLTHROUGH;
4963  case 2:
4964  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
4965  else {
4966  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 2); __PYX_ERR(0, 188, __pyx_L3_error)
4967  }
4968  CYTHON_FALLTHROUGH;
4969  case 3:
4970  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
4971  else {
4972  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 3); __PYX_ERR(0, 188, __pyx_L3_error)
4973  }
4974  CYTHON_FALLTHROUGH;
4975  case 4:
4976  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
4977  else {
4978  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 4); __PYX_ERR(0, 188, __pyx_L3_error)
4979  }
4980  CYTHON_FALLTHROUGH;
4981  case 5:
4982  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes)) != 0)) kw_args--;
4983  else {
4984  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 5); __PYX_ERR(0, 188, __pyx_L3_error)
4985  }
4986  CYTHON_FALLTHROUGH;
4987  case 6:
4988  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
4989  else {
4990  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, 6); __PYX_ERR(0, 188, __pyx_L3_error)
4991  }
4992  CYTHON_FALLTHROUGH;
4993  case 7:
4994  if (kw_args > 0) {
4995  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el_average);
4996  if (value) { values[7] = value; kw_args--; }
4997  }
4998  }
4999  if (unlikely(kw_args > 0)) {
5000  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateInverseMeanRatioTriangleNodes") < 0)) __PYX_ERR(0, 188, __pyx_L3_error)
5001  }
5002  } else {
5003  switch (PyTuple_GET_SIZE(__pyx_args)) {
5004  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5005  CYTHON_FALLTHROUGH;
5006  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5007  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5008  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5009  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5010  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5011  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5012  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5013  break;
5014  default: goto __pyx_L5_argtuple_error;
5015  }
5016  }
5017  __pyx_v_IMRNodesArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_IMRNodesArray_.memview)) __PYX_ERR(0, 188, __pyx_L3_error)
5018  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 189, __pyx_L3_error)
5019  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 190, __pyx_L3_error)
5020  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 191, __pyx_L3_error)
5021  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 192, __pyx_L3_error)
5022  __pyx_v_nNodes = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_nNodes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error)
5023  __pyx_v_nElements = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L3_error)
5024  if (values[7]) {
5025  __pyx_v_el_average = __Pyx_PyObject_IsTrue(values[7]); if (unlikely((__pyx_v_el_average == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 195, __pyx_L3_error)
5026  } else {
5027 
5028  /* "mprans/MeshSmoothing.pyx":195
5029  * int nNodes,
5030  * int nElements,
5031  * bool el_average=False): # <<<<<<<<<<<<<<
5032  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_,
5033  * nodeArray=nodeArray,
5034  */
5035  __pyx_v_el_average = ((bool)0);
5036  }
5037  }
5038  goto __pyx_L4_argument_unpacking_done;
5039  __pyx_L5_argtuple_error:;
5040  __Pyx_RaiseArgtupleInvalid("updateInverseMeanRatioTriangleNodes", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 188, __pyx_L3_error)
5041  __pyx_L3_error:;
5042  __Pyx_AddTraceback("mprans.MeshSmoothing.updateInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5043  __Pyx_RefNannyFinishContext();
5044  return NULL;
5045  __pyx_L4_argument_unpacking_done:;
5046  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_16updateInverseMeanRatioTriangleNodes(__pyx_self, __pyx_v_IMRNodesArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nNodes, __pyx_v_nElements, __pyx_v_el_average);
5047 
5048  /* "mprans/MeshSmoothing.pyx":188
5049  * return IMRElementsArray_
5050  *
5051  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
5052  * double[:,:] nodeArray,
5053  * int[:,:] elementNodesArray,
5054  */
5055 
5056  /* function exit code */
5057  __Pyx_RefNannyFinishContext();
5058  return __pyx_r;
5059 }
5060 
5061 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_16updateInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_IMRNodesArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, int __pyx_v_nNodes, int __pyx_v_nElements, bool __pyx_v_el_average) {
5062  PyObject *__pyx_r = NULL;
5063  __Pyx_RefNannyDeclarations
5064  struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes __pyx_t_1;
5065  __Pyx_RefNannySetupContext("updateInverseMeanRatioTriangleNodes", 0);
5066 
5067  /* "mprans/MeshSmoothing.pyx":196
5068  * int nElements,
5069  * bool el_average=False):
5070  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_, # <<<<<<<<<<<<<<
5071  * nodeArray=nodeArray,
5072  * elementNodesArray=elementNodesArray,
5073  */
5074  __pyx_t_1.__pyx_n = 1;
5075  __pyx_t_1.el_average = __pyx_v_el_average;
5076  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__pyx_v_IMRNodesArray_, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nElements, __pyx_v_nNodes, &__pyx_t_1);
5077 
5078  /* "mprans/MeshSmoothing.pyx":188
5079  * return IMRElementsArray_
5080  *
5081  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
5082  * double[:,:] nodeArray,
5083  * int[:,:] elementNodesArray,
5084  */
5085 
5086  /* function exit code */
5087  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5088  __PYX_XDEC_MEMVIEW(&__pyx_v_IMRNodesArray_, 1);
5089  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5090  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5091  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5092  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5093  __Pyx_XGIVEREF(__pyx_r);
5094  __Pyx_RefNannyFinishContext();
5095  return __pyx_r;
5096 }
5097 
5098 /* "mprans/MeshSmoothing.pyx":205
5099  * nElements=nElements)
5100  *
5101  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
5102  * int[:,:] elementNodesArray,
5103  * int[:] nodeElementOffsets,
5104  */
5105 
5106 /* Python wrapper */
5107 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5108 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes = {"getInverseMeanRatioTriangleNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes, METH_VARARGS|METH_KEYWORDS, 0};
5109 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5110  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5111  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5112  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5113  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5114  bool __pyx_v_el_average;
5115  int __pyx_lineno = 0;
5116  const char *__pyx_filename = NULL;
5117  int __pyx_clineno = 0;
5118  PyObject *__pyx_r = 0;
5119  __Pyx_RefNannyDeclarations
5120  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleNodes (wrapper)", 0);
5121  {
5122  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_el_average,0};
5123  PyObject* values[5] = {0,0,0,0,0};
5124  if (unlikely(__pyx_kwds)) {
5125  Py_ssize_t kw_args;
5126  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5127  switch (pos_args) {
5128  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5129  CYTHON_FALLTHROUGH;
5130  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5131  CYTHON_FALLTHROUGH;
5132  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5133  CYTHON_FALLTHROUGH;
5134  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5135  CYTHON_FALLTHROUGH;
5136  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5137  CYTHON_FALLTHROUGH;
5138  case 0: break;
5139  default: goto __pyx_L5_argtuple_error;
5140  }
5141  kw_args = PyDict_Size(__pyx_kwds);
5142  switch (pos_args) {
5143  case 0:
5144  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5145  else goto __pyx_L5_argtuple_error;
5146  CYTHON_FALLTHROUGH;
5147  case 1:
5148  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
5149  else {
5150  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, 1); __PYX_ERR(0, 205, __pyx_L3_error)
5151  }
5152  CYTHON_FALLTHROUGH;
5153  case 2:
5154  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5155  else {
5156  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, 2); __PYX_ERR(0, 205, __pyx_L3_error)
5157  }
5158  CYTHON_FALLTHROUGH;
5159  case 3:
5160  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5161  else {
5162  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, 3); __PYX_ERR(0, 205, __pyx_L3_error)
5163  }
5164  CYTHON_FALLTHROUGH;
5165  case 4:
5166  if (kw_args > 0) {
5167  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_el_average);
5168  if (value) { values[4] = value; kw_args--; }
5169  }
5170  }
5171  if (unlikely(kw_args > 0)) {
5172  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInverseMeanRatioTriangleNodes") < 0)) __PYX_ERR(0, 205, __pyx_L3_error)
5173  }
5174  } else {
5175  switch (PyTuple_GET_SIZE(__pyx_args)) {
5176  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5177  CYTHON_FALLTHROUGH;
5178  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5179  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5180  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5181  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5182  break;
5183  default: goto __pyx_L5_argtuple_error;
5184  }
5185  }
5186  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 205, __pyx_L3_error)
5187  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 206, __pyx_L3_error)
5188  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 207, __pyx_L3_error)
5189  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 208, __pyx_L3_error)
5190  if (values[4]) {
5191  __pyx_v_el_average = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_el_average == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error)
5192  } else {
5193 
5194  /* "mprans/MeshSmoothing.pyx":209
5195  * int[:] nodeElementOffsets,
5196  * int[:] nodeElementsArray,
5197  * bool el_average=False): # <<<<<<<<<<<<<<
5198  * cdef int nNodes = len(nodeArray)
5199  * cdef int nElements = len(elementNodesArray)
5200  */
5201  __pyx_v_el_average = ((bool)0);
5202  }
5203  }
5204  goto __pyx_L4_argument_unpacking_done;
5205  __pyx_L5_argtuple_error:;
5206  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioTriangleNodes", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 205, __pyx_L3_error)
5207  __pyx_L3_error:;
5208  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5209  __Pyx_RefNannyFinishContext();
5210  return NULL;
5211  __pyx_L4_argument_unpacking_done:;
5212  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_18getInverseMeanRatioTriangleNodes(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_el_average);
5213 
5214  /* "mprans/MeshSmoothing.pyx":205
5215  * nElements=nElements)
5216  *
5217  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
5218  * int[:,:] elementNodesArray,
5219  * int[:] nodeElementOffsets,
5220  */
5221 
5222  /* function exit code */
5223  __Pyx_RefNannyFinishContext();
5224  return __pyx_r;
5225 }
5226 
5227 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_18getInverseMeanRatioTriangleNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, bool __pyx_v_el_average) {
5228  int __pyx_v_nNodes;
5229  int __pyx_v_nElements;
5230  PyObject *__pyx_v_IMRNodesArray_ = NULL;
5231  PyObject *__pyx_r = NULL;
5232  __Pyx_RefNannyDeclarations
5233  size_t __pyx_t_1;
5234  PyObject *__pyx_t_2 = NULL;
5235  PyObject *__pyx_t_3 = NULL;
5236  PyObject *__pyx_t_4 = NULL;
5237  PyObject *__pyx_t_5 = NULL;
5238  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5239  struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes __pyx_t_7;
5240  int __pyx_lineno = 0;
5241  const char *__pyx_filename = NULL;
5242  int __pyx_clineno = 0;
5243  __Pyx_RefNannySetupContext("getInverseMeanRatioTriangleNodes", 0);
5244 
5245  /* "mprans/MeshSmoothing.pyx":210
5246  * int[:] nodeElementsArray,
5247  * bool el_average=False):
5248  * cdef int nNodes = len(nodeArray) # <<<<<<<<<<<<<<
5249  * cdef int nElements = len(elementNodesArray)
5250  * IMRNodesArray_ = np.zeros(nNodes)
5251  */
5252  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_nodeArray);
5253  __pyx_v_nNodes = __pyx_t_1;
5254 
5255  /* "mprans/MeshSmoothing.pyx":211
5256  * bool el_average=False):
5257  * cdef int nNodes = len(nodeArray)
5258  * cdef int nElements = len(elementNodesArray) # <<<<<<<<<<<<<<
5259  * IMRNodesArray_ = np.zeros(nNodes)
5260  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_,
5261  */
5262  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_elementNodesArray);
5263  __pyx_v_nElements = __pyx_t_1;
5264 
5265  /* "mprans/MeshSmoothing.pyx":212
5266  * cdef int nNodes = len(nodeArray)
5267  * cdef int nElements = len(elementNodesArray)
5268  * IMRNodesArray_ = np.zeros(nNodes) # <<<<<<<<<<<<<<
5269  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_,
5270  * nodeArray=nodeArray,
5271  */
5272  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
5273  __Pyx_GOTREF(__pyx_t_3);
5274  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
5275  __Pyx_GOTREF(__pyx_t_4);
5276  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5277  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nNodes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)
5278  __Pyx_GOTREF(__pyx_t_3);
5279  __pyx_t_5 = NULL;
5280  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
5281  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
5282  if (likely(__pyx_t_5)) {
5283  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
5284  __Pyx_INCREF(__pyx_t_5);
5285  __Pyx_INCREF(function);
5286  __Pyx_DECREF_SET(__pyx_t_4, function);
5287  }
5288  }
5289  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
5290  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
5291  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5292  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error)
5293  __Pyx_GOTREF(__pyx_t_2);
5294  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5295  __pyx_v_IMRNodesArray_ = __pyx_t_2;
5296  __pyx_t_2 = 0;
5297 
5298  /* "mprans/MeshSmoothing.pyx":213
5299  * cdef int nElements = len(elementNodesArray)
5300  * IMRNodesArray_ = np.zeros(nNodes)
5301  * cyUpdateInverseMeanRatioTriangleNodes(IMRNodesArray_=IMRNodesArray_, # <<<<<<<<<<<<<<
5302  * nodeArray=nodeArray,
5303  * elementNodesArray=elementNodesArray,
5304  */
5305  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_IMRNodesArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 213, __pyx_L1_error)
5306 
5307  /* "mprans/MeshSmoothing.pyx":218
5308  * nodeElementOffsets=nodeElementOffsets,
5309  * nodeElementsArray=nodeElementsArray,
5310  * el_average=el_average, # <<<<<<<<<<<<<<
5311  * nNodes=nNodes,
5312  * nElements=nElements)
5313  */
5314  __pyx_t_7.__pyx_n = 1;
5315  __pyx_t_7.el_average = __pyx_v_el_average;
5316  __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__pyx_t_6, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_nElements, __pyx_v_nNodes, &__pyx_t_7);
5317  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5318  __pyx_t_6.memview = NULL;
5319  __pyx_t_6.data = NULL;
5320 
5321  /* "mprans/MeshSmoothing.pyx":221
5322  * nNodes=nNodes,
5323  * nElements=nElements)
5324  * return IMRNodesArray_ # <<<<<<<<<<<<<<
5325  *
5326  * def getInverseMeanRatioSingleTriangle(int node0,
5327  */
5328  __Pyx_XDECREF(__pyx_r);
5329  __Pyx_INCREF(__pyx_v_IMRNodesArray_);
5330  __pyx_r = __pyx_v_IMRNodesArray_;
5331  goto __pyx_L0;
5332 
5333  /* "mprans/MeshSmoothing.pyx":205
5334  * nElements=nElements)
5335  *
5336  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
5337  * int[:,:] elementNodesArray,
5338  * int[:] nodeElementOffsets,
5339  */
5340 
5341  /* function exit code */
5342  __pyx_L1_error:;
5343  __Pyx_XDECREF(__pyx_t_2);
5344  __Pyx_XDECREF(__pyx_t_3);
5345  __Pyx_XDECREF(__pyx_t_4);
5346  __Pyx_XDECREF(__pyx_t_5);
5347  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5348  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
5349  __pyx_r = NULL;
5350  __pyx_L0:;
5351  __Pyx_XDECREF(__pyx_v_IMRNodesArray_);
5352  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5353  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5354  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5355  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5356  __Pyx_XGIVEREF(__pyx_r);
5357  __Pyx_RefNannyFinishContext();
5358  return __pyx_r;
5359 }
5360 
5361 /* "mprans/MeshSmoothing.pyx":223
5362  * return IMRNodesArray_
5363  *
5364  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
5365  * double[:,:] nodeArray,
5366  * int[:,:] elementNodesArray,
5367  */
5368 
5369 /* Python wrapper */
5370 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5371 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle = {"getInverseMeanRatioSingleTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle, METH_VARARGS|METH_KEYWORDS, 0};
5372 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5373  int __pyx_v_node0;
5374  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5375  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5376  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5377  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5378  int __pyx_lineno = 0;
5379  const char *__pyx_filename = NULL;
5380  int __pyx_clineno = 0;
5381  PyObject *__pyx_r = 0;
5382  __Pyx_RefNannyDeclarations
5383  __Pyx_RefNannySetupContext("getInverseMeanRatioSingleTriangle (wrapper)", 0);
5384  {
5385  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_node0,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,0};
5386  PyObject* values[5] = {0,0,0,0,0};
5387  if (unlikely(__pyx_kwds)) {
5388  Py_ssize_t kw_args;
5389  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5390  switch (pos_args) {
5391  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5392  CYTHON_FALLTHROUGH;
5393  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5394  CYTHON_FALLTHROUGH;
5395  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5396  CYTHON_FALLTHROUGH;
5397  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5398  CYTHON_FALLTHROUGH;
5399  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5400  CYTHON_FALLTHROUGH;
5401  case 0: break;
5402  default: goto __pyx_L5_argtuple_error;
5403  }
5404  kw_args = PyDict_Size(__pyx_kwds);
5405  switch (pos_args) {
5406  case 0:
5407  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node0)) != 0)) kw_args--;
5408  else goto __pyx_L5_argtuple_error;
5409  CYTHON_FALLTHROUGH;
5410  case 1:
5411  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5412  else {
5413  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 1); __PYX_ERR(0, 223, __pyx_L3_error)
5414  }
5415  CYTHON_FALLTHROUGH;
5416  case 2:
5417  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
5418  else {
5419  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 2); __PYX_ERR(0, 223, __pyx_L3_error)
5420  }
5421  CYTHON_FALLTHROUGH;
5422  case 3:
5423  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5424  else {
5425  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 3); __PYX_ERR(0, 223, __pyx_L3_error)
5426  }
5427  CYTHON_FALLTHROUGH;
5428  case 4:
5429  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5430  else {
5431  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, 4); __PYX_ERR(0, 223, __pyx_L3_error)
5432  }
5433  }
5434  if (unlikely(kw_args > 0)) {
5435  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getInverseMeanRatioSingleTriangle") < 0)) __PYX_ERR(0, 223, __pyx_L3_error)
5436  }
5437  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5438  goto __pyx_L5_argtuple_error;
5439  } else {
5440  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5441  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5442  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5443  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5444  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5445  }
5446  __pyx_v_node0 = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_node0 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L3_error)
5447  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 224, __pyx_L3_error)
5448  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 225, __pyx_L3_error)
5449  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 226, __pyx_L3_error)
5450  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 227, __pyx_L3_error)
5451  }
5452  goto __pyx_L4_argument_unpacking_done;
5453  __pyx_L5_argtuple_error:;
5454  __Pyx_RaiseArgtupleInvalid("getInverseMeanRatioSingleTriangle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 223, __pyx_L3_error)
5455  __pyx_L3_error:;
5456  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioSingleTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
5457  __Pyx_RefNannyFinishContext();
5458  return NULL;
5459  __pyx_L4_argument_unpacking_done:;
5460  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_20getInverseMeanRatioSingleTriangle(__pyx_self, __pyx_v_node0, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray);
5461 
5462  /* function exit code */
5463  __Pyx_RefNannyFinishContext();
5464  return __pyx_r;
5465 }
5466 
5467 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_20getInverseMeanRatioSingleTriangle(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_node0, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray) {
5468  PyObject *__pyx_r = NULL;
5469  __Pyx_RefNannyDeclarations
5470  PyObject *__pyx_t_1 = NULL;
5471  int __pyx_lineno = 0;
5472  const char *__pyx_filename = NULL;
5473  int __pyx_clineno = 0;
5474  __Pyx_RefNannySetupContext("getInverseMeanRatioSingleTriangle", 0);
5475 
5476  /* "mprans/MeshSmoothing.pyx":228
5477  * int[:] nodeElementOffsets,
5478  * int[:] nodeElementsArray):
5479  * return cyGetInverseMeanRatioSingleTriangle(node0=node0, # <<<<<<<<<<<<<<
5480  * nodeArray=nodeArray,
5481  * elementNodesArray=elementNodesArray,
5482  */
5483  __Pyx_XDECREF(__pyx_r);
5484 
5485  /* "mprans/MeshSmoothing.pyx":232
5486  * elementNodesArray=elementNodesArray,
5487  * nodeElementOffsets=nodeElementOffsets,
5488  * nodeElementsArray=nodeElementsArray) # <<<<<<<<<<<<<<
5489  *
5490  * def smoothNodesQuality(double[:] distortion,
5491  */
5492  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle(__pyx_v_node0, __pyx_v_nodeArray, __pyx_v_elementNodesArray, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error)
5493  __Pyx_GOTREF(__pyx_t_1);
5494  __pyx_r = __pyx_t_1;
5495  __pyx_t_1 = 0;
5496  goto __pyx_L0;
5497 
5498  /* "mprans/MeshSmoothing.pyx":223
5499  * return IMRNodesArray_
5500  *
5501  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
5502  * double[:,:] nodeArray,
5503  * int[:,:] elementNodesArray,
5504  */
5505 
5506  /* function exit code */
5507  __pyx_L1_error:;
5508  __Pyx_XDECREF(__pyx_t_1);
5509  __Pyx_AddTraceback("mprans.MeshSmoothing.getInverseMeanRatioSingleTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
5510  __pyx_r = NULL;
5511  __pyx_L0:;
5512  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5513  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5514  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5515  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5516  __Pyx_XGIVEREF(__pyx_r);
5517  __Pyx_RefNannyFinishContext();
5518  return __pyx_r;
5519 }
5520 
5521 /* "mprans/MeshSmoothing.pyx":234
5522  * nodeElementsArray=nodeElementsArray)
5523  *
5524  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
5525  * double[:] dilation,
5526  * double[:,:] nodeArray,
5527  */
5528 
5529 /* Python wrapper */
5530 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_23smoothNodesQuality(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5531 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_23smoothNodesQuality = {"smoothNodesQuality", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_23smoothNodesQuality, METH_VARARGS|METH_KEYWORDS, 0};
5532 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_23smoothNodesQuality(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5533  __Pyx_memviewslice __pyx_v_distortion = { 0, 0, { 0 }, { 0 }, { 0 } };
5534  __Pyx_memviewslice __pyx_v_dilation = { 0, 0, { 0 }, { 0 }, { 0 } };
5535  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5536  int __pyx_v_nNodes_owned;
5537  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
5538  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5539  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5540  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5541  CYTHON_UNUSED bool __pyx_v_apply_directly;
5542  int __pyx_lineno = 0;
5543  const char *__pyx_filename = NULL;
5544  int __pyx_clineno = 0;
5545  PyObject *__pyx_r = 0;
5546  __Pyx_RefNannyDeclarations
5547  __Pyx_RefNannySetupContext("smoothNodesQuality (wrapper)", 0);
5548  {
5549  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distortion,&__pyx_n_s_dilation,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nNodes_owned,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_elementNodesArray,&__pyx_n_s_apply_directly,0};
5550  PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
5551  if (unlikely(__pyx_kwds)) {
5552  Py_ssize_t kw_args;
5553  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5554  switch (pos_args) {
5555  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5556  CYTHON_FALLTHROUGH;
5557  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5558  CYTHON_FALLTHROUGH;
5559  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5560  CYTHON_FALLTHROUGH;
5561  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5562  CYTHON_FALLTHROUGH;
5563  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5564  CYTHON_FALLTHROUGH;
5565  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5566  CYTHON_FALLTHROUGH;
5567  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5568  CYTHON_FALLTHROUGH;
5569  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5570  CYTHON_FALLTHROUGH;
5571  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5572  CYTHON_FALLTHROUGH;
5573  case 0: break;
5574  default: goto __pyx_L5_argtuple_error;
5575  }
5576  kw_args = PyDict_Size(__pyx_kwds);
5577  switch (pos_args) {
5578  case 0:
5579  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distortion)) != 0)) kw_args--;
5580  else goto __pyx_L5_argtuple_error;
5581  CYTHON_FALLTHROUGH;
5582  case 1:
5583  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dilation)) != 0)) kw_args--;
5584  else {
5585  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 1); __PYX_ERR(0, 234, __pyx_L3_error)
5586  }
5587  CYTHON_FALLTHROUGH;
5588  case 2:
5589  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5590  else {
5591  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 2); __PYX_ERR(0, 234, __pyx_L3_error)
5592  }
5593  CYTHON_FALLTHROUGH;
5594  case 3:
5595  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
5596  else {
5597  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 3); __PYX_ERR(0, 234, __pyx_L3_error)
5598  }
5599  CYTHON_FALLTHROUGH;
5600  case 4:
5601  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
5602  else {
5603  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 4); __PYX_ERR(0, 234, __pyx_L3_error)
5604  }
5605  CYTHON_FALLTHROUGH;
5606  case 5:
5607  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
5608  else {
5609  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 5); __PYX_ERR(0, 234, __pyx_L3_error)
5610  }
5611  CYTHON_FALLTHROUGH;
5612  case 6:
5613  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
5614  else {
5615  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 6); __PYX_ERR(0, 234, __pyx_L3_error)
5616  }
5617  CYTHON_FALLTHROUGH;
5618  case 7:
5619  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
5620  else {
5621  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, 7); __PYX_ERR(0, 234, __pyx_L3_error)
5622  }
5623  CYTHON_FALLTHROUGH;
5624  case 8:
5625  if (kw_args > 0) {
5626  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_apply_directly);
5627  if (value) { values[8] = value; kw_args--; }
5628  }
5629  }
5630  if (unlikely(kw_args > 0)) {
5631  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "smoothNodesQuality") < 0)) __PYX_ERR(0, 234, __pyx_L3_error)
5632  }
5633  } else {
5634  switch (PyTuple_GET_SIZE(__pyx_args)) {
5635  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5636  CYTHON_FALLTHROUGH;
5637  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5638  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5639  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5640  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5641  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5642  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5643  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5644  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5645  break;
5646  default: goto __pyx_L5_argtuple_error;
5647  }
5648  }
5649  __pyx_v_distortion = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distortion.memview)) __PYX_ERR(0, 234, __pyx_L3_error)
5650  __pyx_v_dilation = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dilation.memview)) __PYX_ERR(0, 235, __pyx_L3_error)
5651  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 236, __pyx_L3_error)
5652  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L3_error)
5653  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 238, __pyx_L3_error)
5654  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 239, __pyx_L3_error)
5655  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 240, __pyx_L3_error)
5656  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 241, __pyx_L3_error)
5657  if (values[8]) {
5658  __pyx_v_apply_directly = __Pyx_PyObject_IsTrue(values[8]); if (unlikely((__pyx_v_apply_directly == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error)
5659  } else {
5660 
5661  /* "mprans/MeshSmoothing.pyx":242
5662  * int[:] nodeElementsArray,
5663  * int[:,:] elementNodesArray,
5664  * bool apply_directly=False): # <<<<<<<<<<<<<<
5665  * assert 1>2, 'smoothNodesQuality is work in progress, do not use'
5666  * return cySmoothNodesQuality(distortion=distortion,
5667  */
5668  __pyx_v_apply_directly = ((bool)0);
5669  }
5670  }
5671  goto __pyx_L4_argument_unpacking_done;
5672  __pyx_L5_argtuple_error:;
5673  __Pyx_RaiseArgtupleInvalid("smoothNodesQuality", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 234, __pyx_L3_error)
5674  __pyx_L3_error:;
5675  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesQuality", __pyx_clineno, __pyx_lineno, __pyx_filename);
5676  __Pyx_RefNannyFinishContext();
5677  return NULL;
5678  __pyx_L4_argument_unpacking_done:;
5679  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_22smoothNodesQuality(__pyx_self, __pyx_v_distortion, __pyx_v_dilation, __pyx_v_nodeArray, __pyx_v_nNodes_owned, __pyx_v_nodeMaterialTypes, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementNodesArray, __pyx_v_apply_directly);
5680 
5681  /* "mprans/MeshSmoothing.pyx":234
5682  * nodeElementsArray=nodeElementsArray)
5683  *
5684  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
5685  * double[:] dilation,
5686  * double[:,:] nodeArray,
5687  */
5688 
5689  /* function exit code */
5690  __Pyx_RefNannyFinishContext();
5691  return __pyx_r;
5692 }
5693 
5694 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_22smoothNodesQuality(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distortion, __Pyx_memviewslice __pyx_v_dilation, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nNodes_owned, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementNodesArray, CYTHON_UNUSED bool __pyx_v_apply_directly) {
5695  PyObject *__pyx_r = NULL;
5696  __Pyx_RefNannyDeclarations
5697  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
5698  struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality __pyx_t_2;
5699  PyObject *__pyx_t_3 = NULL;
5700  int __pyx_lineno = 0;
5701  const char *__pyx_filename = NULL;
5702  int __pyx_clineno = 0;
5703  __Pyx_RefNannySetupContext("smoothNodesQuality", 0);
5704 
5705  /* "mprans/MeshSmoothing.pyx":243
5706  * int[:,:] elementNodesArray,
5707  * bool apply_directly=False):
5708  * assert 1>2, 'smoothNodesQuality is work in progress, do not use' # <<<<<<<<<<<<<<
5709  * return cySmoothNodesQuality(distortion=distortion,
5710  * dilation=dilation,
5711  */
5712  #ifndef CYTHON_WITHOUT_ASSERTIONS
5713  if (unlikely(!Py_OptimizeFlag)) {
5714  if (unlikely(!0)) {
5715  PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_smoothNodesQuality_is_work_in_pr);
5716  __PYX_ERR(0, 243, __pyx_L1_error)
5717  }
5718  }
5719  #endif
5720 
5721  /* "mprans/MeshSmoothing.pyx":244
5722  * bool apply_directly=False):
5723  * assert 1>2, 'smoothNodesQuality is work in progress, do not use'
5724  * return cySmoothNodesQuality(distortion=distortion, # <<<<<<<<<<<<<<
5725  * dilation=dilation,
5726  * nodeArray=nodeArray,
5727  */
5728  __Pyx_XDECREF(__pyx_r);
5729 
5730  /* "mprans/MeshSmoothing.pyx":252
5731  * nodeElementsArray=nodeElementsArray,
5732  * elementNodesArray=elementNodesArray,
5733  * apply_directly=False) # <<<<<<<<<<<<<<
5734  *
5735  * def getLocalNearestNode(double[:] coords,
5736  */
5737  __pyx_t_2.__pyx_n = 1;
5738  __pyx_t_2.apply_directly = 0;
5739  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality(__pyx_v_distortion, __pyx_v_dilation, __pyx_v_nodeArray, __pyx_v_nNodes_owned, __pyx_v_nodeMaterialTypes, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementNodesArray, &__pyx_t_2); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 244, __pyx_L1_error)
5740 
5741  /* "mprans/MeshSmoothing.pyx":244
5742  * bool apply_directly=False):
5743  * assert 1>2, 'smoothNodesQuality is work in progress, do not use'
5744  * return cySmoothNodesQuality(distortion=distortion, # <<<<<<<<<<<<<<
5745  * dilation=dilation,
5746  * nodeArray=nodeArray,
5747  */
5748  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_1, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
5749  __Pyx_GOTREF(__pyx_t_3);
5750  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5751  __pyx_t_1.memview = NULL;
5752  __pyx_t_1.data = NULL;
5753  __pyx_r = __pyx_t_3;
5754  __pyx_t_3 = 0;
5755  goto __pyx_L0;
5756 
5757  /* "mprans/MeshSmoothing.pyx":234
5758  * nodeElementsArray=nodeElementsArray)
5759  *
5760  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
5761  * double[:] dilation,
5762  * double[:,:] nodeArray,
5763  */
5764 
5765  /* function exit code */
5766  __pyx_L1_error:;
5767  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
5768  __Pyx_XDECREF(__pyx_t_3);
5769  __Pyx_AddTraceback("mprans.MeshSmoothing.smoothNodesQuality", __pyx_clineno, __pyx_lineno, __pyx_filename);
5770  __pyx_r = NULL;
5771  __pyx_L0:;
5772  __PYX_XDEC_MEMVIEW(&__pyx_v_distortion, 1);
5773  __PYX_XDEC_MEMVIEW(&__pyx_v_dilation, 1);
5774  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5775  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
5776  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
5777  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
5778  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
5779  __Pyx_XGIVEREF(__pyx_r);
5780  __Pyx_RefNannyFinishContext();
5781  return __pyx_r;
5782 }
5783 
5784 /* "mprans/MeshSmoothing.pyx":254
5785  * apply_directly=False)
5786  *
5787  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
5788  * double[:,:] nodeArray,
5789  * int[:] nodeStarOffsets,
5790  */
5791 
5792 /* Python wrapper */
5793 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_25getLocalNearestNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5794 static char __pyx_doc_6mprans_13MeshSmoothing_24getLocalNearestNode[] = "Finds nearest node to coordinates (local)\n\n Parameters\n ----------\n coords: array_like\n coordinates from which to find nearest node\n nodeArray: array_like\n array of fluid mesh node coordinates\n nodeStarOffsets: array_like\n array of offsets from nodes (range)\n nodeStarArray: array_like\n array of neighbouring nodes\n node: int\n first guess for nearest node\n\n Returns\n -------\n node: int\n nearest node index\n ";
5795 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_25getLocalNearestNode = {"getLocalNearestNode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_25getLocalNearestNode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_24getLocalNearestNode};
5796 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_25getLocalNearestNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5797  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
5798  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5799  __Pyx_memviewslice __pyx_v_nodeStarOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
5800  __Pyx_memviewslice __pyx_v_nodeStarArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5801  int __pyx_v_node;
5802  int __pyx_lineno = 0;
5803  const char *__pyx_filename = NULL;
5804  int __pyx_clineno = 0;
5805  PyObject *__pyx_r = 0;
5806  __Pyx_RefNannyDeclarations
5807  __Pyx_RefNannySetupContext("getLocalNearestNode (wrapper)", 0);
5808  {
5809  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nodeStarOffsets,&__pyx_n_s_nodeStarArray,&__pyx_n_s_node,0};
5810  PyObject* values[5] = {0,0,0,0,0};
5811  if (unlikely(__pyx_kwds)) {
5812  Py_ssize_t kw_args;
5813  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5814  switch (pos_args) {
5815  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5816  CYTHON_FALLTHROUGH;
5817  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5818  CYTHON_FALLTHROUGH;
5819  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5820  CYTHON_FALLTHROUGH;
5821  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5822  CYTHON_FALLTHROUGH;
5823  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5824  CYTHON_FALLTHROUGH;
5825  case 0: break;
5826  default: goto __pyx_L5_argtuple_error;
5827  }
5828  kw_args = PyDict_Size(__pyx_kwds);
5829  switch (pos_args) {
5830  case 0:
5831  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
5832  else goto __pyx_L5_argtuple_error;
5833  CYTHON_FALLTHROUGH;
5834  case 1:
5835  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
5836  else {
5837  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 1); __PYX_ERR(0, 254, __pyx_L3_error)
5838  }
5839  CYTHON_FALLTHROUGH;
5840  case 2:
5841  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarOffsets)) != 0)) kw_args--;
5842  else {
5843  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 2); __PYX_ERR(0, 254, __pyx_L3_error)
5844  }
5845  CYTHON_FALLTHROUGH;
5846  case 3:
5847  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarArray)) != 0)) kw_args--;
5848  else {
5849  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 3); __PYX_ERR(0, 254, __pyx_L3_error)
5850  }
5851  CYTHON_FALLTHROUGH;
5852  case 4:
5853  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
5854  else {
5855  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, 4); __PYX_ERR(0, 254, __pyx_L3_error)
5856  }
5857  }
5858  if (unlikely(kw_args > 0)) {
5859  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestNode") < 0)) __PYX_ERR(0, 254, __pyx_L3_error)
5860  }
5861  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5862  goto __pyx_L5_argtuple_error;
5863  } else {
5864  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5865  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5866  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5867  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5868  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5869  }
5870  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 254, __pyx_L3_error)
5871  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 255, __pyx_L3_error)
5872  __pyx_v_nodeStarOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarOffsets.memview)) __PYX_ERR(0, 256, __pyx_L3_error)
5873  __pyx_v_nodeStarArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarArray.memview)) __PYX_ERR(0, 257, __pyx_L3_error)
5874  __pyx_v_node = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L3_error)
5875  }
5876  goto __pyx_L4_argument_unpacking_done;
5877  __pyx_L5_argtuple_error:;
5878  __Pyx_RaiseArgtupleInvalid("getLocalNearestNode", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 254, __pyx_L3_error)
5879  __pyx_L3_error:;
5880  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
5881  __Pyx_RefNannyFinishContext();
5882  return NULL;
5883  __pyx_L4_argument_unpacking_done:;
5884  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_24getLocalNearestNode(__pyx_self, __pyx_v_coords, __pyx_v_nodeArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_node);
5885 
5886  /* function exit code */
5887  __Pyx_RefNannyFinishContext();
5888  return __pyx_r;
5889 }
5890 
5891 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_24getLocalNearestNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, int __pyx_v_node) {
5892  PyObject *__pyx_r = NULL;
5893  __Pyx_RefNannyDeclarations
5894  PyObject *__pyx_t_1 = NULL;
5895  int __pyx_lineno = 0;
5896  const char *__pyx_filename = NULL;
5897  int __pyx_clineno = 0;
5898  __Pyx_RefNannySetupContext("getLocalNearestNode", 0);
5899 
5900  /* "mprans/MeshSmoothing.pyx":279
5901  * nearest node index
5902  * """
5903  * return pyxGetLocalNearestNode(coords, # <<<<<<<<<<<<<<
5904  * nodeArray,
5905  * nodeStarOffsets,
5906  */
5907  __Pyx_XDECREF(__pyx_r);
5908 
5909  /* "mprans/MeshSmoothing.pyx":283
5910  * nodeStarOffsets,
5911  * nodeStarArray,
5912  * node) # <<<<<<<<<<<<<<
5913  *
5914  * def getLocalNearestElement(double[:] coords,
5915  */
5916  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode(__pyx_v_coords, __pyx_v_nodeArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error)
5917  __Pyx_GOTREF(__pyx_t_1);
5918  __pyx_r = __pyx_t_1;
5919  __pyx_t_1 = 0;
5920  goto __pyx_L0;
5921 
5922  /* "mprans/MeshSmoothing.pyx":254
5923  * apply_directly=False)
5924  *
5925  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
5926  * double[:,:] nodeArray,
5927  * int[:] nodeStarOffsets,
5928  */
5929 
5930  /* function exit code */
5931  __pyx_L1_error:;
5932  __Pyx_XDECREF(__pyx_t_1);
5933  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
5934  __pyx_r = NULL;
5935  __pyx_L0:;
5936  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
5937  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
5938  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarOffsets, 1);
5939  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarArray, 1);
5940  __Pyx_XGIVEREF(__pyx_r);
5941  __Pyx_RefNannyFinishContext();
5942  return __pyx_r;
5943 }
5944 
5945 /* "mprans/MeshSmoothing.pyx":285
5946  * node)
5947  *
5948  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
5949  * double[:,:] elementBarycentersArray,
5950  * int[:,:] elementNeighborsArray,
5951  */
5952 
5953 /* Python wrapper */
5954 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_27getLocalNearestElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5955 static char __pyx_doc_6mprans_13MeshSmoothing_26getLocalNearestElement[] = "Finds nearest element to coordinates (local)\n\n Parameters\n ----------\n coords: double[:]\n coordinates from which to find nearest element\n elementBarycentersArray: double[:,:]\n array of mesh cell barycenter coordinates\n elementNeighborsArray: double[:,:]\n array of element neighbors\n eN: int\n first guess for nearest element\n\n Returns\n -------\n eN: int\n nearest element index\n ";
5956 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_27getLocalNearestElement = {"getLocalNearestElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_27getLocalNearestElement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_26getLocalNearestElement};
5957 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_27getLocalNearestElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5958  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
5959  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5960  __Pyx_memviewslice __pyx_v_elementNeighborsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
5961  int __pyx_v_eN;
5962  int __pyx_lineno = 0;
5963  const char *__pyx_filename = NULL;
5964  int __pyx_clineno = 0;
5965  PyObject *__pyx_r = 0;
5966  __Pyx_RefNannyDeclarations
5967  __Pyx_RefNannySetupContext("getLocalNearestElement (wrapper)", 0);
5968  {
5969  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_elementNeighborsArray,&__pyx_n_s_eN,0};
5970  PyObject* values[4] = {0,0,0,0};
5971  if (unlikely(__pyx_kwds)) {
5972  Py_ssize_t kw_args;
5973  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5974  switch (pos_args) {
5975  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5976  CYTHON_FALLTHROUGH;
5977  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5978  CYTHON_FALLTHROUGH;
5979  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5980  CYTHON_FALLTHROUGH;
5981  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5982  CYTHON_FALLTHROUGH;
5983  case 0: break;
5984  default: goto __pyx_L5_argtuple_error;
5985  }
5986  kw_args = PyDict_Size(__pyx_kwds);
5987  switch (pos_args) {
5988  case 0:
5989  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
5990  else goto __pyx_L5_argtuple_error;
5991  CYTHON_FALLTHROUGH;
5992  case 1:
5993  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
5994  else {
5995  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, 1); __PYX_ERR(0, 285, __pyx_L3_error)
5996  }
5997  CYTHON_FALLTHROUGH;
5998  case 2:
5999  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNeighborsArray)) != 0)) kw_args--;
6000  else {
6001  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, 2); __PYX_ERR(0, 285, __pyx_L3_error)
6002  }
6003  CYTHON_FALLTHROUGH;
6004  case 3:
6005  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eN)) != 0)) kw_args--;
6006  else {
6007  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, 3); __PYX_ERR(0, 285, __pyx_L3_error)
6008  }
6009  }
6010  if (unlikely(kw_args > 0)) {
6011  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestElement") < 0)) __PYX_ERR(0, 285, __pyx_L3_error)
6012  }
6013  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
6014  goto __pyx_L5_argtuple_error;
6015  } else {
6016  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6017  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6018  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6019  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6020  }
6021  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 285, __pyx_L3_error)
6022  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 286, __pyx_L3_error)
6023  __pyx_v_elementNeighborsArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNeighborsArray.memview)) __PYX_ERR(0, 287, __pyx_L3_error)
6024  __pyx_v_eN = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_eN == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L3_error)
6025  }
6026  goto __pyx_L4_argument_unpacking_done;
6027  __pyx_L5_argtuple_error:;
6028  __Pyx_RaiseArgtupleInvalid("getLocalNearestElement", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 285, __pyx_L3_error)
6029  __pyx_L3_error:;
6030  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
6031  __Pyx_RefNannyFinishContext();
6032  return NULL;
6033  __pyx_L4_argument_unpacking_done:;
6034  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_26getLocalNearestElement(__pyx_self, __pyx_v_coords, __pyx_v_elementBarycentersArray, __pyx_v_elementNeighborsArray, __pyx_v_eN);
6035 
6036  /* function exit code */
6037  __Pyx_RefNannyFinishContext();
6038  return __pyx_r;
6039 }
6040 
6041 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_26getLocalNearestElement(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNeighborsArray, int __pyx_v_eN) {
6042  PyObject *__pyx_r = NULL;
6043  __Pyx_RefNannyDeclarations
6044  PyObject *__pyx_t_1 = NULL;
6045  int __pyx_lineno = 0;
6046  const char *__pyx_filename = NULL;
6047  int __pyx_clineno = 0;
6048  __Pyx_RefNannySetupContext("getLocalNearestElement", 0);
6049 
6050  /* "mprans/MeshSmoothing.pyx":307
6051  * nearest element index
6052  * """
6053  * return pyxGetLocalNearestElement(coords, # <<<<<<<<<<<<<<
6054  * elementBarycentersArray,
6055  * elementNeighborsArray,
6056  */
6057  __Pyx_XDECREF(__pyx_r);
6058 
6059  /* "mprans/MeshSmoothing.pyx":310
6060  * elementBarycentersArray,
6061  * elementNeighborsArray,
6062  * eN) # <<<<<<<<<<<<<<
6063  *
6064  * def getLocalNearestElementAroundNode(double[:] coords,
6065  */
6066  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement(__pyx_v_coords, __pyx_v_elementBarycentersArray, __pyx_v_elementNeighborsArray, __pyx_v_eN)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
6067  __Pyx_GOTREF(__pyx_t_1);
6068  __pyx_r = __pyx_t_1;
6069  __pyx_t_1 = 0;
6070  goto __pyx_L0;
6071 
6072  /* "mprans/MeshSmoothing.pyx":285
6073  * node)
6074  *
6075  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
6076  * double[:,:] elementBarycentersArray,
6077  * int[:,:] elementNeighborsArray,
6078  */
6079 
6080  /* function exit code */
6081  __pyx_L1_error:;
6082  __Pyx_XDECREF(__pyx_t_1);
6083  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
6084  __pyx_r = NULL;
6085  __pyx_L0:;
6086  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
6087  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
6088  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNeighborsArray, 1);
6089  __Pyx_XGIVEREF(__pyx_r);
6090  __Pyx_RefNannyFinishContext();
6091  return __pyx_r;
6092 }
6093 
6094 /* "mprans/MeshSmoothing.pyx":312
6095  * eN)
6096  *
6097  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
6098  * int[:] nodeElementOffsets,
6099  * int[:] nodeElementsArray,
6100  */
6101 
6102 /* Python wrapper */
6103 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6104 static char __pyx_doc_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode[] = "Finds nearest neighbouring element of node to coordinates (local)\n\n Parameters\n ----------\n coords: double[:]\n coordinates from which to find nearest element\n nodeElementOffsets: int[:]\n element offsets from nodes\n nodeElementsArray: int[:]\n elements array from nodeElementOffsets\n elementBarycentersArray: int[:]\n array of mesh cell barycenter coordinates\n node: int\n node from which to search\n\n Returns\n -------\n eN: int\n nearest element index\n ";
6105 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode = {"getLocalNearestElementAroundNode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode};
6106 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6107  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
6108  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
6109  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6110  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6111  int __pyx_v_node;
6112  int __pyx_lineno = 0;
6113  const char *__pyx_filename = NULL;
6114  int __pyx_clineno = 0;
6115  PyObject *__pyx_r = 0;
6116  __Pyx_RefNannyDeclarations
6117  __Pyx_RefNannySetupContext("getLocalNearestElementAroundNode (wrapper)", 0);
6118  {
6119  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_node,0};
6120  PyObject* values[5] = {0,0,0,0,0};
6121  if (unlikely(__pyx_kwds)) {
6122  Py_ssize_t kw_args;
6123  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6124  switch (pos_args) {
6125  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6126  CYTHON_FALLTHROUGH;
6127  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6128  CYTHON_FALLTHROUGH;
6129  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6130  CYTHON_FALLTHROUGH;
6131  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6132  CYTHON_FALLTHROUGH;
6133  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6134  CYTHON_FALLTHROUGH;
6135  case 0: break;
6136  default: goto __pyx_L5_argtuple_error;
6137  }
6138  kw_args = PyDict_Size(__pyx_kwds);
6139  switch (pos_args) {
6140  case 0:
6141  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
6142  else goto __pyx_L5_argtuple_error;
6143  CYTHON_FALLTHROUGH;
6144  case 1:
6145  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
6146  else {
6147  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 1); __PYX_ERR(0, 312, __pyx_L3_error)
6148  }
6149  CYTHON_FALLTHROUGH;
6150  case 2:
6151  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
6152  else {
6153  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 2); __PYX_ERR(0, 312, __pyx_L3_error)
6154  }
6155  CYTHON_FALLTHROUGH;
6156  case 3:
6157  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
6158  else {
6159  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 3); __PYX_ERR(0, 312, __pyx_L3_error)
6160  }
6161  CYTHON_FALLTHROUGH;
6162  case 4:
6163  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
6164  else {
6165  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, 4); __PYX_ERR(0, 312, __pyx_L3_error)
6166  }
6167  }
6168  if (unlikely(kw_args > 0)) {
6169  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestElementAroundNode") < 0)) __PYX_ERR(0, 312, __pyx_L3_error)
6170  }
6171  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
6172  goto __pyx_L5_argtuple_error;
6173  } else {
6174  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6175  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6176  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6177  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6178  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6179  }
6180  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 312, __pyx_L3_error)
6181  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 313, __pyx_L3_error)
6182  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 314, __pyx_L3_error)
6183  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 315, __pyx_L3_error)
6184  __pyx_v_node = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_node == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 316, __pyx_L3_error)
6185  }
6186  goto __pyx_L4_argument_unpacking_done;
6187  __pyx_L5_argtuple_error:;
6188  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementAroundNode", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 312, __pyx_L3_error)
6189  __pyx_L3_error:;
6190  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementAroundNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
6191  __Pyx_RefNannyFinishContext();
6192  return NULL;
6193  __pyx_L4_argument_unpacking_done:;
6194  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode(__pyx_self, __pyx_v_coords, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementBarycentersArray, __pyx_v_node);
6195 
6196  /* function exit code */
6197  __Pyx_RefNannyFinishContext();
6198  return __pyx_r;
6199 }
6200 
6201 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_28getLocalNearestElementAroundNode(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_node) {
6202  PyObject *__pyx_r = NULL;
6203  __Pyx_RefNannyDeclarations
6204  PyObject *__pyx_t_1 = NULL;
6205  int __pyx_lineno = 0;
6206  const char *__pyx_filename = NULL;
6207  int __pyx_clineno = 0;
6208  __Pyx_RefNannySetupContext("getLocalNearestElementAroundNode", 0);
6209 
6210  /* "mprans/MeshSmoothing.pyx":337
6211  * nearest element index
6212  * """
6213  * return pyxGetLocalNearestElementAroundNode(coords=coords, # <<<<<<<<<<<<<<
6214  * nodeElementOffsets=nodeElementOffsets,
6215  * nodeElementsArray=nodeElementsArray,
6216  */
6217  __Pyx_XDECREF(__pyx_r);
6218 
6219  /* "mprans/MeshSmoothing.pyx":341
6220  * nodeElementsArray=nodeElementsArray,
6221  * elementBarycentersArray=elementBarycentersArray,
6222  * node=node) # <<<<<<<<<<<<<<
6223  *
6224  * def getLocalNearestElementIntersection(double[:] coords,
6225  */
6226  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode(__pyx_v_coords, __pyx_v_nodeElementOffsets, __pyx_v_nodeElementsArray, __pyx_v_elementBarycentersArray, __pyx_v_node)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
6227  __Pyx_GOTREF(__pyx_t_1);
6228  __pyx_r = __pyx_t_1;
6229  __pyx_t_1 = 0;
6230  goto __pyx_L0;
6231 
6232  /* "mprans/MeshSmoothing.pyx":312
6233  * eN)
6234  *
6235  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
6236  * int[:] nodeElementOffsets,
6237  * int[:] nodeElementsArray,
6238  */
6239 
6240  /* function exit code */
6241  __pyx_L1_error:;
6242  __Pyx_XDECREF(__pyx_t_1);
6243  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementAroundNode", __pyx_clineno, __pyx_lineno, __pyx_filename);
6244  __pyx_r = NULL;
6245  __pyx_L0:;
6246  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
6247  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
6248  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
6249  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
6250  __Pyx_XGIVEREF(__pyx_r);
6251  __Pyx_RefNannyFinishContext();
6252  return __pyx_r;
6253 }
6254 
6255 /* "mprans/MeshSmoothing.pyx":343
6256  * node=node)
6257  *
6258  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
6259  * double[:] starting_coords,
6260  * double[:,:,:] elementBoundaryNormalsArray,
6261  */
6262 
6263 /* Python wrapper */
6264 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6265 static char __pyx_doc_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection[] = "Find element nearest or containing coords through element boundary intersection\n\n Parameters\n ----------\n coords: double[:]\n coordinates of point for which a containing element must be found\n starting_coords: double[:]\n starting coords to look for coords\n elementBoundaryNormals: double[:,:,:]\n normals of the element boundaries\n elementBoundariesArray: int[:,:]\n index of boundaries per elements\n elementBoundaryBarycentersArray: int[:,:]\n barycenters of element boundaries\n elementBoundaryElementsArray: int[:,:]\n array of elements shared by boundaries\n exteriorElementBoundariesBoolArray: int[:]\n boolean array of exterior element boundaries (1: is exterior boundary)\n must be same length as the number of element boundaries\n eN: first guess of element\n\n Returns\n -------\n nearest_eN: int\n nearest element to coords (-1 if element at border)\n b_i_last: int\n last element boundary crossed\n ";
6266 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection = {"getLocalNearestElementIntersection", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection};
6267 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6268  __Pyx_memviewslice __pyx_v_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
6269  __Pyx_memviewslice __pyx_v_starting_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
6270  __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6271  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6272  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6273  __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6274  __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray = { 0, 0, { 0 }, { 0 }, { 0 } };
6275  int __pyx_v_eN;
6276  int __pyx_lineno = 0;
6277  const char *__pyx_filename = NULL;
6278  int __pyx_clineno = 0;
6279  PyObject *__pyx_r = 0;
6280  __Pyx_RefNannyDeclarations
6281  __Pyx_RefNannySetupContext("getLocalNearestElementIntersection (wrapper)", 0);
6282  {
6283  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_coords,&__pyx_n_s_starting_coords,&__pyx_n_s_elementBoundaryNormalsArray,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBoundaryElementsArray,&__pyx_n_s_exteriorElementBoundariesBoolArr,&__pyx_n_s_eN,0};
6284  PyObject* values[8] = {0,0,0,0,0,0,0,0};
6285  if (unlikely(__pyx_kwds)) {
6286  Py_ssize_t kw_args;
6287  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6288  switch (pos_args) {
6289  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6290  CYTHON_FALLTHROUGH;
6291  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6292  CYTHON_FALLTHROUGH;
6293  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6294  CYTHON_FALLTHROUGH;
6295  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6296  CYTHON_FALLTHROUGH;
6297  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6298  CYTHON_FALLTHROUGH;
6299  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6300  CYTHON_FALLTHROUGH;
6301  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6302  CYTHON_FALLTHROUGH;
6303  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6304  CYTHON_FALLTHROUGH;
6305  case 0: break;
6306  default: goto __pyx_L5_argtuple_error;
6307  }
6308  kw_args = PyDict_Size(__pyx_kwds);
6309  switch (pos_args) {
6310  case 0:
6311  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
6312  else goto __pyx_L5_argtuple_error;
6313  CYTHON_FALLTHROUGH;
6314  case 1:
6315  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_starting_coords)) != 0)) kw_args--;
6316  else {
6317  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 1); __PYX_ERR(0, 343, __pyx_L3_error)
6318  }
6319  CYTHON_FALLTHROUGH;
6320  case 2:
6321  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNormalsArray)) != 0)) kw_args--;
6322  else {
6323  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 2); __PYX_ERR(0, 343, __pyx_L3_error)
6324  }
6325  CYTHON_FALLTHROUGH;
6326  case 3:
6327  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
6328  else {
6329  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 3); __PYX_ERR(0, 343, __pyx_L3_error)
6330  }
6331  CYTHON_FALLTHROUGH;
6332  case 4:
6333  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
6334  else {
6335  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 4); __PYX_ERR(0, 343, __pyx_L3_error)
6336  }
6337  CYTHON_FALLTHROUGH;
6338  case 5:
6339  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryElementsArray)) != 0)) kw_args--;
6340  else {
6341  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 5); __PYX_ERR(0, 343, __pyx_L3_error)
6342  }
6343  CYTHON_FALLTHROUGH;
6344  case 6:
6345  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exteriorElementBoundariesBoolArr)) != 0)) kw_args--;
6346  else {
6347  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 6); __PYX_ERR(0, 343, __pyx_L3_error)
6348  }
6349  CYTHON_FALLTHROUGH;
6350  case 7:
6351  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_eN)) != 0)) kw_args--;
6352  else {
6353  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, 7); __PYX_ERR(0, 343, __pyx_L3_error)
6354  }
6355  }
6356  if (unlikely(kw_args > 0)) {
6357  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalNearestElementIntersection") < 0)) __PYX_ERR(0, 343, __pyx_L3_error)
6358  }
6359  } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
6360  goto __pyx_L5_argtuple_error;
6361  } else {
6362  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6363  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6364  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6365  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6366  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6367  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6368  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6369  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6370  }
6371  __pyx_v_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_coords.memview)) __PYX_ERR(0, 343, __pyx_L3_error)
6372  __pyx_v_starting_coords = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_starting_coords.memview)) __PYX_ERR(0, 344, __pyx_L3_error)
6373  __pyx_v_elementBoundaryNormalsArray = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNormalsArray.memview)) __PYX_ERR(0, 345, __pyx_L3_error)
6374  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 346, __pyx_L3_error)
6375  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 347, __pyx_L3_error)
6376  __pyx_v_elementBoundaryElementsArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryElementsArray.memview)) __PYX_ERR(0, 348, __pyx_L3_error)
6377  __pyx_v_exteriorElementBoundariesBoolArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_exteriorElementBoundariesBoolArray.memview)) __PYX_ERR(0, 349, __pyx_L3_error)
6378  __pyx_v_eN = __Pyx_PyInt_As_int(values[7]); if (unlikely((__pyx_v_eN == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 350, __pyx_L3_error)
6379  }
6380  goto __pyx_L4_argument_unpacking_done;
6381  __pyx_L5_argtuple_error:;
6382  __Pyx_RaiseArgtupleInvalid("getLocalNearestElementIntersection", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 343, __pyx_L3_error)
6383  __pyx_L3_error:;
6384  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementIntersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
6385  __Pyx_RefNannyFinishContext();
6386  return NULL;
6387  __pyx_L4_argument_unpacking_done:;
6388  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection(__pyx_self, __pyx_v_coords, __pyx_v_starting_coords, __pyx_v_elementBoundaryNormalsArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_exteriorElementBoundariesBoolArray, __pyx_v_eN);
6389 
6390  /* function exit code */
6391  __Pyx_RefNannyFinishContext();
6392  return __pyx_r;
6393 }
6394 
6395 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_30getLocalNearestElementIntersection(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_starting_coords, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray, __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray, int __pyx_v_eN) {
6396  PyObject *__pyx_r = NULL;
6397  __Pyx_RefNannyDeclarations
6398  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
6399  PyObject *__pyx_t_2 = NULL;
6400  int __pyx_lineno = 0;
6401  const char *__pyx_filename = NULL;
6402  int __pyx_clineno = 0;
6403  __Pyx_RefNannySetupContext("getLocalNearestElementIntersection", 0);
6404 
6405  /* "mprans/MeshSmoothing.pyx":379
6406  * last element boundary crossed
6407  * """
6408  * return pyxGetLocalNearestElementIntersection(coords=coords, # <<<<<<<<<<<<<<
6409  * starting_coords=starting_coords,
6410  * elementBoundaryNormalsArray=elementBoundaryNormalsArray,
6411  */
6412  __Pyx_XDECREF(__pyx_r);
6413 
6414  /* "mprans/MeshSmoothing.pyx":386
6415  * elementBoundaryElementsArray=elementBoundaryElementsArray,
6416  * exteriorElementBoundariesBoolArray=exteriorElementBoundariesBoolArray,
6417  * eN=eN) # <<<<<<<<<<<<<<
6418  *
6419  * def getLocalElement(femSpace,
6420  */
6421  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection(__pyx_v_coords, __pyx_v_starting_coords, __pyx_v_elementBoundaryNormalsArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBoundaryElementsArray, __pyx_v_exteriorElementBoundariesBoolArray, __pyx_v_eN); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 379, __pyx_L1_error)
6422 
6423  /* "mprans/MeshSmoothing.pyx":379
6424  * last element boundary crossed
6425  * """
6426  * return pyxGetLocalNearestElementIntersection(coords=coords, # <<<<<<<<<<<<<<
6427  * starting_coords=starting_coords,
6428  * elementBoundaryNormalsArray=elementBoundaryNormalsArray,
6429  */
6430  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
6431  __Pyx_GOTREF(__pyx_t_2);
6432  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
6433  __pyx_t_1.memview = NULL;
6434  __pyx_t_1.data = NULL;
6435  __pyx_r = __pyx_t_2;
6436  __pyx_t_2 = 0;
6437  goto __pyx_L0;
6438 
6439  /* "mprans/MeshSmoothing.pyx":343
6440  * node=node)
6441  *
6442  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
6443  * double[:] starting_coords,
6444  * double[:,:,:] elementBoundaryNormalsArray,
6445  */
6446 
6447  /* function exit code */
6448  __pyx_L1_error:;
6449  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
6450  __Pyx_XDECREF(__pyx_t_2);
6451  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalNearestElementIntersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
6452  __pyx_r = NULL;
6453  __pyx_L0:;
6454  __PYX_XDEC_MEMVIEW(&__pyx_v_coords, 1);
6455  __PYX_XDEC_MEMVIEW(&__pyx_v_starting_coords, 1);
6456  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNormalsArray, 1);
6457  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
6458  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
6459  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryElementsArray, 1);
6460  __PYX_XDEC_MEMVIEW(&__pyx_v_exteriorElementBoundariesBoolArray, 1);
6461  __Pyx_XGIVEREF(__pyx_r);
6462  __Pyx_RefNannyFinishContext();
6463  return __pyx_r;
6464 }
6465 
6466 /* "mprans/MeshSmoothing.pyx":388
6467  * eN=eN)
6468  *
6469  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
6470  * coords,
6471  * node):
6472  */
6473 
6474 /* Python wrapper */
6475 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_33getLocalElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6476 static char __pyx_doc_6mprans_13MeshSmoothing_32getLocalElement[] = "Given coordinates and its nearest node, determine if it is on a\n local element.\n (!) old implementation -> slow\n\n Parameters\n ----------\n femSpace: object\n finite element space\n coords: array_like\n coordinates from which to element\n node: int\n nearest node index\n\n Returns\n -------\n eN: int or None\n local index of element (None if not found)\n ";
6477 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_33getLocalElement = {"getLocalElement", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_33getLocalElement, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6mprans_13MeshSmoothing_32getLocalElement};
6478 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_33getLocalElement(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6479  PyObject *__pyx_v_femSpace = 0;
6480  PyObject *__pyx_v_coords = 0;
6481  PyObject *__pyx_v_node = 0;
6482  int __pyx_lineno = 0;
6483  const char *__pyx_filename = NULL;
6484  int __pyx_clineno = 0;
6485  PyObject *__pyx_r = 0;
6486  __Pyx_RefNannyDeclarations
6487  __Pyx_RefNannySetupContext("getLocalElement (wrapper)", 0);
6488  {
6489  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_femSpace,&__pyx_n_s_coords,&__pyx_n_s_node,0};
6490  PyObject* values[3] = {0,0,0};
6491  if (unlikely(__pyx_kwds)) {
6492  Py_ssize_t kw_args;
6493  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6494  switch (pos_args) {
6495  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6496  CYTHON_FALLTHROUGH;
6497  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6498  CYTHON_FALLTHROUGH;
6499  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6500  CYTHON_FALLTHROUGH;
6501  case 0: break;
6502  default: goto __pyx_L5_argtuple_error;
6503  }
6504  kw_args = PyDict_Size(__pyx_kwds);
6505  switch (pos_args) {
6506  case 0:
6507  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_femSpace)) != 0)) kw_args--;
6508  else goto __pyx_L5_argtuple_error;
6509  CYTHON_FALLTHROUGH;
6510  case 1:
6511  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coords)) != 0)) kw_args--;
6512  else {
6513  __Pyx_RaiseArgtupleInvalid("getLocalElement", 1, 3, 3, 1); __PYX_ERR(0, 388, __pyx_L3_error)
6514  }
6515  CYTHON_FALLTHROUGH;
6516  case 2:
6517  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node)) != 0)) kw_args--;
6518  else {
6519  __Pyx_RaiseArgtupleInvalid("getLocalElement", 1, 3, 3, 2); __PYX_ERR(0, 388, __pyx_L3_error)
6520  }
6521  }
6522  if (unlikely(kw_args > 0)) {
6523  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getLocalElement") < 0)) __PYX_ERR(0, 388, __pyx_L3_error)
6524  }
6525  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6526  goto __pyx_L5_argtuple_error;
6527  } else {
6528  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6529  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6530  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6531  }
6532  __pyx_v_femSpace = values[0];
6533  __pyx_v_coords = values[1];
6534  __pyx_v_node = values[2];
6535  }
6536  goto __pyx_L4_argument_unpacking_done;
6537  __pyx_L5_argtuple_error:;
6538  __Pyx_RaiseArgtupleInvalid("getLocalElement", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 388, __pyx_L3_error)
6539  __pyx_L3_error:;
6540  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
6541  __Pyx_RefNannyFinishContext();
6542  return NULL;
6543  __pyx_L4_argument_unpacking_done:;
6544  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_32getLocalElement(__pyx_self, __pyx_v_femSpace, __pyx_v_coords, __pyx_v_node);
6545 
6546  /* function exit code */
6547  __Pyx_RefNannyFinishContext();
6548  return __pyx_r;
6549 }
6550 
6551 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_32getLocalElement(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_femSpace, PyObject *__pyx_v_coords, PyObject *__pyx_v_node) {
6552  PyObject *__pyx_v_patchBoundaryNodes = NULL;
6553  PyObject *__pyx_v_checkedElements = NULL;
6554  PyObject *__pyx_v_eOffset = NULL;
6555  PyObject *__pyx_v_eN = NULL;
6556  PyObject *__pyx_v_xi = NULL;
6557  PyObject *__pyx_r = NULL;
6558  __Pyx_RefNannyDeclarations
6559  PyObject *__pyx_t_1 = NULL;
6560  PyObject *__pyx_t_2 = NULL;
6561  PyObject *__pyx_t_3 = NULL;
6562  Py_ssize_t __pyx_t_4;
6563  int __pyx_t_5;
6564  PyObject *__pyx_t_6 = NULL;
6565  PyObject *(*__pyx_t_7)(PyObject *);
6566  int __pyx_t_8;
6567  int __pyx_t_9;
6568  PyObject *__pyx_t_10 = NULL;
6569  Py_ssize_t __pyx_t_11;
6570  int __pyx_t_12;
6571  Py_ssize_t __pyx_t_13;
6572  int __pyx_t_14;
6573  PyObject *__pyx_t_15 = NULL;
6574  int __pyx_lineno = 0;
6575  const char *__pyx_filename = NULL;
6576  int __pyx_clineno = 0;
6577  __Pyx_RefNannySetupContext("getLocalElement", 0);
6578  __Pyx_INCREF(__pyx_v_node);
6579 
6580  /* "mprans/MeshSmoothing.pyx":409
6581  * local index of element (None if not found)
6582  * """
6583  * patchBoundaryNodes=set() # <<<<<<<<<<<<<<
6584  * checkedElements=[]
6585  * # nodeElementOffsets give the indices to get the elements sharing the node
6586  */
6587  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
6588  __Pyx_GOTREF(__pyx_t_1);
6589  __pyx_v_patchBoundaryNodes = ((PyObject*)__pyx_t_1);
6590  __pyx_t_1 = 0;
6591 
6592  /* "mprans/MeshSmoothing.pyx":410
6593  * """
6594  * patchBoundaryNodes=set()
6595  * checkedElements=[] # <<<<<<<<<<<<<<
6596  * # nodeElementOffsets give the indices to get the elements sharing the node
6597  * #log Profiling.logEvent("Getting Local Element")
6598  */
6599  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 410, __pyx_L1_error)
6600  __Pyx_GOTREF(__pyx_t_1);
6601  __pyx_v_checkedElements = ((PyObject*)__pyx_t_1);
6602  __pyx_t_1 = 0;
6603 
6604  /* "mprans/MeshSmoothing.pyx":413
6605  * # nodeElementOffsets give the indices to get the elements sharing the node
6606  * #log Profiling.logEvent("Getting Local Element")
6607  * if node+1 < len(femSpace.mesh.nodeElementOffsets): # <<<<<<<<<<<<<<
6608  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6609  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6610  */
6611  __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_node, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
6612  __Pyx_GOTREF(__pyx_t_1);
6613  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
6614  __Pyx_GOTREF(__pyx_t_2);
6615  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
6616  __Pyx_GOTREF(__pyx_t_3);
6617  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6618  __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 413, __pyx_L1_error)
6619  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6620  __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
6621  __Pyx_GOTREF(__pyx_t_3);
6622  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
6623  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6624  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6625  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 413, __pyx_L1_error)
6626  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6627  if (__pyx_t_5) {
6628 
6629  /* "mprans/MeshSmoothing.pyx":414
6630  * #log Profiling.logEvent("Getting Local Element")
6631  * if node+1 < len(femSpace.mesh.nodeElementOffsets):
6632  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
6633  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6634  * checkedElements.append(eN)
6635  */
6636  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
6637  __Pyx_GOTREF(__pyx_t_2);
6638  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6639  __Pyx_GOTREF(__pyx_t_3);
6640  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6641  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_node); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
6642  __Pyx_GOTREF(__pyx_t_2);
6643  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6644  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6645  __Pyx_GOTREF(__pyx_t_3);
6646  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
6647  __Pyx_GOTREF(__pyx_t_1);
6648  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6649  __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_node, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6650  __Pyx_GOTREF(__pyx_t_3);
6651  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6652  __Pyx_GOTREF(__pyx_t_6);
6653  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6654  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6655  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6656  __Pyx_GOTREF(__pyx_t_3);
6657  __Pyx_GIVEREF(__pyx_t_2);
6658  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
6659  __Pyx_GIVEREF(__pyx_t_6);
6660  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
6661  __pyx_t_2 = 0;
6662  __pyx_t_6 = 0;
6663  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6664  __Pyx_GOTREF(__pyx_t_6);
6665  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6666  if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
6667  __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
6668  __pyx_t_7 = NULL;
6669  } else {
6670  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error)
6671  __Pyx_GOTREF(__pyx_t_3);
6672  __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 414, __pyx_L1_error)
6673  }
6674  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6675  for (;;) {
6676  if (likely(!__pyx_t_7)) {
6677  if (likely(PyList_CheckExact(__pyx_t_3))) {
6678  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
6679  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6680  __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 414, __pyx_L1_error)
6681  #else
6682  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6683  __Pyx_GOTREF(__pyx_t_6);
6684  #endif
6685  } else {
6686  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
6687  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6688  __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 414, __pyx_L1_error)
6689  #else
6690  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
6691  __Pyx_GOTREF(__pyx_t_6);
6692  #endif
6693  }
6694  } else {
6695  __pyx_t_6 = __pyx_t_7(__pyx_t_3);
6696  if (unlikely(!__pyx_t_6)) {
6697  PyObject* exc_type = PyErr_Occurred();
6698  if (exc_type) {
6699  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6700  else __PYX_ERR(0, 414, __pyx_L1_error)
6701  }
6702  break;
6703  }
6704  __Pyx_GOTREF(__pyx_t_6);
6705  }
6706  __Pyx_XDECREF_SET(__pyx_v_eOffset, __pyx_t_6);
6707  __pyx_t_6 = 0;
6708 
6709  /* "mprans/MeshSmoothing.pyx":415
6710  * if node+1 < len(femSpace.mesh.nodeElementOffsets):
6711  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6712  * eN = femSpace.mesh.nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
6713  * checkedElements.append(eN)
6714  * # union of set
6715  */
6716  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error)
6717  __Pyx_GOTREF(__pyx_t_6);
6718  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
6719  __Pyx_GOTREF(__pyx_t_2);
6720  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6721  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_eOffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error)
6722  __Pyx_GOTREF(__pyx_t_6);
6723  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6724  __Pyx_XDECREF_SET(__pyx_v_eN, __pyx_t_6);
6725  __pyx_t_6 = 0;
6726 
6727  /* "mprans/MeshSmoothing.pyx":416
6728  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6729  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6730  * checkedElements.append(eN) # <<<<<<<<<<<<<<
6731  * # union of set
6732  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6733  */
6734  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_checkedElements, __pyx_v_eN); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 416, __pyx_L1_error)
6735 
6736  /* "mprans/MeshSmoothing.pyx":418
6737  * checkedElements.append(eN)
6738  * # union of set
6739  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN]) # <<<<<<<<<<<<<<
6740  * # evaluate the inverse map for element eN (global to local)
6741  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
6742  */
6743  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
6744  __Pyx_GOTREF(__pyx_t_6);
6745  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
6746  __Pyx_GOTREF(__pyx_t_2);
6747  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6748  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_eN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
6749  __Pyx_GOTREF(__pyx_t_6);
6750  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6751  __pyx_t_2 = PySet_New(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
6752  __Pyx_GOTREF(__pyx_t_2);
6753  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6754  __pyx_t_6 = PyNumber_InPlaceOr(__pyx_v_patchBoundaryNodes, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 418, __pyx_L1_error)
6755  __Pyx_GOTREF(__pyx_t_6);
6756  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6757  __Pyx_DECREF_SET(__pyx_v_patchBoundaryNodes, ((PyObject*)__pyx_t_6));
6758  __pyx_t_6 = 0;
6759 
6760  /* "mprans/MeshSmoothing.pyx":420
6761  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6762  * # evaluate the inverse map for element eN (global to local)
6763  * xi = femSpace.elementMaps.getInverseValue(eN, coords) # <<<<<<<<<<<<<<
6764  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6765  * # query whether xi lies within the reference element
6766  */
6767  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error)
6768  __Pyx_GOTREF(__pyx_t_2);
6769  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_getInverseValue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error)
6770  __Pyx_GOTREF(__pyx_t_1);
6771  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6772  __pyx_t_2 = NULL;
6773  __pyx_t_9 = 0;
6774  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6775  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
6776  if (likely(__pyx_t_2)) {
6777  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6778  __Pyx_INCREF(__pyx_t_2);
6779  __Pyx_INCREF(function);
6780  __Pyx_DECREF_SET(__pyx_t_1, function);
6781  __pyx_t_9 = 1;
6782  }
6783  }
6784  #if CYTHON_FAST_PYCALL
6785  if (PyFunction_Check(__pyx_t_1)) {
6786  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_eN, __pyx_v_coords};
6787  __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
6788  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6789  __Pyx_GOTREF(__pyx_t_6);
6790  } else
6791  #endif
6792  #if CYTHON_FAST_PYCCALL
6793  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
6794  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_eN, __pyx_v_coords};
6795  __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
6796  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6797  __Pyx_GOTREF(__pyx_t_6);
6798  } else
6799  #endif
6800  {
6801  __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 420, __pyx_L1_error)
6802  __Pyx_GOTREF(__pyx_t_10);
6803  if (__pyx_t_2) {
6804  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
6805  }
6806  __Pyx_INCREF(__pyx_v_eN);
6807  __Pyx_GIVEREF(__pyx_v_eN);
6808  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_eN);
6809  __Pyx_INCREF(__pyx_v_coords);
6810  __Pyx_GIVEREF(__pyx_v_coords);
6811  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_coords);
6812  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 420, __pyx_L1_error)
6813  __Pyx_GOTREF(__pyx_t_6);
6814  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6815  }
6816  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6817  __Pyx_XDECREF_SET(__pyx_v_xi, __pyx_t_6);
6818  __pyx_t_6 = 0;
6819 
6820  /* "mprans/MeshSmoothing.pyx":423
6821  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6822  * # query whether xi lies within the reference element
6823  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
6824  * return eN
6825  * else:
6826  */
6827  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
6828  __Pyx_GOTREF(__pyx_t_1);
6829  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_referenceElement); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 423, __pyx_L1_error)
6830  __Pyx_GOTREF(__pyx_t_10);
6831  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6832  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_onElement); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
6833  __Pyx_GOTREF(__pyx_t_1);
6834  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6835  __pyx_t_10 = NULL;
6836  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6837  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
6838  if (likely(__pyx_t_10)) {
6839  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6840  __Pyx_INCREF(__pyx_t_10);
6841  __Pyx_INCREF(function);
6842  __Pyx_DECREF_SET(__pyx_t_1, function);
6843  }
6844  }
6845  __pyx_t_6 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_10, __pyx_v_xi) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_xi);
6846  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
6847  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 423, __pyx_L1_error)
6848  __Pyx_GOTREF(__pyx_t_6);
6849  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6850  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 423, __pyx_L1_error)
6851  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6852  if (__pyx_t_5) {
6853 
6854  /* "mprans/MeshSmoothing.pyx":424
6855  * # query whether xi lies within the reference element
6856  * if femSpace.elementMaps.referenceElement.onElement(xi):
6857  * return eN # <<<<<<<<<<<<<<
6858  * else:
6859  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]):
6860  */
6861  __Pyx_XDECREF(__pyx_r);
6862  __Pyx_INCREF(__pyx_v_eN);
6863  __pyx_r = __pyx_v_eN;
6864  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6865  goto __pyx_L0;
6866 
6867  /* "mprans/MeshSmoothing.pyx":423
6868  * #J = femSpace.elementMaps.getJacobianValues(eN, )
6869  * # query whether xi lies within the reference element
6870  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
6871  * return eN
6872  * else:
6873  */
6874  }
6875 
6876  /* "mprans/MeshSmoothing.pyx":414
6877  * #log Profiling.logEvent("Getting Local Element")
6878  * if node+1 < len(femSpace.mesh.nodeElementOffsets):
6879  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
6880  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6881  * checkedElements.append(eN)
6882  */
6883  }
6884  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6885 
6886  /* "mprans/MeshSmoothing.pyx":413
6887  * # nodeElementOffsets give the indices to get the elements sharing the node
6888  * #log Profiling.logEvent("Getting Local Element")
6889  * if node+1 < len(femSpace.mesh.nodeElementOffsets): # <<<<<<<<<<<<<<
6890  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
6891  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6892  */
6893  goto __pyx_L3;
6894  }
6895 
6896  /* "mprans/MeshSmoothing.pyx":426
6897  * return eN
6898  * else:
6899  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]): # <<<<<<<<<<<<<<
6900  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6901  * checkedElements.append(eN)
6902  */
6903  /*else*/ {
6904  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
6905  __Pyx_GOTREF(__pyx_t_3);
6906  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6907  __Pyx_GOTREF(__pyx_t_6);
6908  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6909  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_node); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
6910  __Pyx_GOTREF(__pyx_t_3);
6911  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6912  __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6913  __Pyx_GOTREF(__pyx_t_6);
6914  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6915  if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
6916  __pyx_t_3 = __pyx_t_6; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
6917  __pyx_t_7 = NULL;
6918  } else {
6919  __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
6920  __Pyx_GOTREF(__pyx_t_3);
6921  __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 426, __pyx_L1_error)
6922  }
6923  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6924  for (;;) {
6925  if (likely(!__pyx_t_7)) {
6926  if (likely(PyList_CheckExact(__pyx_t_3))) {
6927  if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
6928  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6929  __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
6930  #else
6931  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6932  __Pyx_GOTREF(__pyx_t_6);
6933  #endif
6934  } else {
6935  if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
6936  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6937  __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
6938  #else
6939  __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 426, __pyx_L1_error)
6940  __Pyx_GOTREF(__pyx_t_6);
6941  #endif
6942  }
6943  } else {
6944  __pyx_t_6 = __pyx_t_7(__pyx_t_3);
6945  if (unlikely(!__pyx_t_6)) {
6946  PyObject* exc_type = PyErr_Occurred();
6947  if (exc_type) {
6948  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6949  else __PYX_ERR(0, 426, __pyx_L1_error)
6950  }
6951  break;
6952  }
6953  __Pyx_GOTREF(__pyx_t_6);
6954  }
6955  __Pyx_XDECREF_SET(__pyx_v_eOffset, __pyx_t_6);
6956  __pyx_t_6 = 0;
6957 
6958  /* "mprans/MeshSmoothing.pyx":427
6959  * else:
6960  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]):
6961  * eN = femSpace.mesh.nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
6962  * checkedElements.append(eN)
6963  * # union of set
6964  */
6965  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
6966  __Pyx_GOTREF(__pyx_t_6);
6967  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
6968  __Pyx_GOTREF(__pyx_t_1);
6969  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6970  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_eOffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error)
6971  __Pyx_GOTREF(__pyx_t_6);
6972  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6973  __Pyx_XDECREF_SET(__pyx_v_eN, __pyx_t_6);
6974  __pyx_t_6 = 0;
6975 
6976  /* "mprans/MeshSmoothing.pyx":428
6977  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]):
6978  * eN = femSpace.mesh.nodeElementsArray[eOffset]
6979  * checkedElements.append(eN) # <<<<<<<<<<<<<<
6980  * # union of set
6981  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
6982  */
6983  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_checkedElements, __pyx_v_eN); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 428, __pyx_L1_error)
6984 
6985  /* "mprans/MeshSmoothing.pyx":430
6986  * checkedElements.append(eN)
6987  * # union of set
6988  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN]) # <<<<<<<<<<<<<<
6989  * # evaluate the inverse map for element eN (global to local)
6990  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
6991  */
6992  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
6993  __Pyx_GOTREF(__pyx_t_6);
6994  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_elementNodesArray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
6995  __Pyx_GOTREF(__pyx_t_1);
6996  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6997  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_eN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
6998  __Pyx_GOTREF(__pyx_t_6);
6999  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7000  __pyx_t_1 = PySet_New(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
7001  __Pyx_GOTREF(__pyx_t_1);
7002  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7003  __pyx_t_6 = PyNumber_InPlaceOr(__pyx_v_patchBoundaryNodes, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 430, __pyx_L1_error)
7004  __Pyx_GOTREF(__pyx_t_6);
7005  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7006  __Pyx_DECREF_SET(__pyx_v_patchBoundaryNodes, ((PyObject*)__pyx_t_6));
7007  __pyx_t_6 = 0;
7008 
7009  /* "mprans/MeshSmoothing.pyx":432
7010  * patchBoundaryNodes|=set(femSpace.mesh.elementNodesArray[eN])
7011  * # evaluate the inverse map for element eN (global to local)
7012  * xi = femSpace.elementMaps.getInverseValue(eN, coords) # <<<<<<<<<<<<<<
7013  * #J = femSpace.elementMaps.getJacobianValues(eN, )
7014  * # query whether xi lies within the reference element
7015  */
7016  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error)
7017  __Pyx_GOTREF(__pyx_t_1);
7018  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_getInverseValue); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 432, __pyx_L1_error)
7019  __Pyx_GOTREF(__pyx_t_10);
7020  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7021  __pyx_t_1 = NULL;
7022  __pyx_t_9 = 0;
7023  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
7024  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
7025  if (likely(__pyx_t_1)) {
7026  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
7027  __Pyx_INCREF(__pyx_t_1);
7028  __Pyx_INCREF(function);
7029  __Pyx_DECREF_SET(__pyx_t_10, function);
7030  __pyx_t_9 = 1;
7031  }
7032  }
7033  #if CYTHON_FAST_PYCALL
7034  if (PyFunction_Check(__pyx_t_10)) {
7035  PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_eN, __pyx_v_coords};
7036  __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error)
7037  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7038  __Pyx_GOTREF(__pyx_t_6);
7039  } else
7040  #endif
7041  #if CYTHON_FAST_PYCCALL
7042  if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
7043  PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_v_eN, __pyx_v_coords};
7044  __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error)
7045  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7046  __Pyx_GOTREF(__pyx_t_6);
7047  } else
7048  #endif
7049  {
7050  __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 432, __pyx_L1_error)
7051  __Pyx_GOTREF(__pyx_t_2);
7052  if (__pyx_t_1) {
7053  __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
7054  }
7055  __Pyx_INCREF(__pyx_v_eN);
7056  __Pyx_GIVEREF(__pyx_v_eN);
7057  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_eN);
7058  __Pyx_INCREF(__pyx_v_coords);
7059  __Pyx_GIVEREF(__pyx_v_coords);
7060  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_v_coords);
7061  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 432, __pyx_L1_error)
7062  __Pyx_GOTREF(__pyx_t_6);
7063  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7064  }
7065  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7066  __Pyx_XDECREF_SET(__pyx_v_xi, __pyx_t_6);
7067  __pyx_t_6 = 0;
7068 
7069  /* "mprans/MeshSmoothing.pyx":435
7070  * #J = femSpace.elementMaps.getJacobianValues(eN, )
7071  * # query whether xi lies within the reference element
7072  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
7073  * return eN
7074  * # extra loop if case coords is in neighbour element
7075  */
7076  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
7077  __Pyx_GOTREF(__pyx_t_10);
7078  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_referenceElement); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error)
7079  __Pyx_GOTREF(__pyx_t_2);
7080  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7081  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_onElement); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 435, __pyx_L1_error)
7082  __Pyx_GOTREF(__pyx_t_10);
7083  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7084  __pyx_t_2 = NULL;
7085  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
7086  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
7087  if (likely(__pyx_t_2)) {
7088  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
7089  __Pyx_INCREF(__pyx_t_2);
7090  __Pyx_INCREF(function);
7091  __Pyx_DECREF_SET(__pyx_t_10, function);
7092  }
7093  }
7094  __pyx_t_6 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_2, __pyx_v_xi) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_xi);
7095  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7096  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 435, __pyx_L1_error)
7097  __Pyx_GOTREF(__pyx_t_6);
7098  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7099  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 435, __pyx_L1_error)
7100  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7101  if (__pyx_t_5) {
7102 
7103  /* "mprans/MeshSmoothing.pyx":436
7104  * # query whether xi lies within the reference element
7105  * if femSpace.elementMaps.referenceElement.onElement(xi):
7106  * return eN # <<<<<<<<<<<<<<
7107  * # extra loop if case coords is in neighbour element
7108  * for node in patchBoundaryNodes:
7109  */
7110  __Pyx_XDECREF(__pyx_r);
7111  __Pyx_INCREF(__pyx_v_eN);
7112  __pyx_r = __pyx_v_eN;
7113  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7114  goto __pyx_L0;
7115 
7116  /* "mprans/MeshSmoothing.pyx":435
7117  * #J = femSpace.elementMaps.getJacobianValues(eN, )
7118  * # query whether xi lies within the reference element
7119  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
7120  * return eN
7121  * # extra loop if case coords is in neighbour element
7122  */
7123  }
7124 
7125  /* "mprans/MeshSmoothing.pyx":426
7126  * return eN
7127  * else:
7128  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node]): # <<<<<<<<<<<<<<
7129  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7130  * checkedElements.append(eN)
7131  */
7132  }
7133  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7134  }
7135  __pyx_L3:;
7136 
7137  /* "mprans/MeshSmoothing.pyx":438
7138  * return eN
7139  * # extra loop if case coords is in neighbour element
7140  * for node in patchBoundaryNodes: # <<<<<<<<<<<<<<
7141  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7142  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7143  */
7144  __pyx_t_4 = 0;
7145  __pyx_t_6 = __Pyx_set_iterator(__pyx_v_patchBoundaryNodes, 1, (&__pyx_t_11), (&__pyx_t_9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L1_error)
7146  __Pyx_GOTREF(__pyx_t_6);
7147  __Pyx_XDECREF(__pyx_t_3);
7148  __pyx_t_3 = __pyx_t_6;
7149  __pyx_t_6 = 0;
7150  while (1) {
7151  __pyx_t_12 = __Pyx_set_iter_next(__pyx_t_3, __pyx_t_11, &__pyx_t_4, &__pyx_t_6, __pyx_t_9);
7152  if (unlikely(__pyx_t_12 == 0)) break;
7153  if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 438, __pyx_L1_error)
7154  __Pyx_GOTREF(__pyx_t_6);
7155  __Pyx_DECREF_SET(__pyx_v_node, __pyx_t_6);
7156  __pyx_t_6 = 0;
7157 
7158  /* "mprans/MeshSmoothing.pyx":439
7159  * # extra loop if case coords is in neighbour element
7160  * for node in patchBoundaryNodes:
7161  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
7162  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7163  * if eN not in checkedElements:
7164  */
7165  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error)
7166  __Pyx_GOTREF(__pyx_t_6);
7167  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
7168  __Pyx_GOTREF(__pyx_t_10);
7169  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7170  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_v_node); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 439, __pyx_L1_error)
7171  __Pyx_GOTREF(__pyx_t_6);
7172  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7173  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
7174  __Pyx_GOTREF(__pyx_t_10);
7175  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 439, __pyx_L1_error)
7176  __Pyx_GOTREF(__pyx_t_2);
7177  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7178  __pyx_t_10 = __Pyx_PyInt_AddObjC(__pyx_v_node, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
7179  __Pyx_GOTREF(__pyx_t_10);
7180  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7181  __Pyx_GOTREF(__pyx_t_1);
7182  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7183  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7184  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
7185  __Pyx_GOTREF(__pyx_t_10);
7186  __Pyx_GIVEREF(__pyx_t_6);
7187  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
7188  __Pyx_GIVEREF(__pyx_t_1);
7189  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1);
7190  __pyx_t_6 = 0;
7191  __pyx_t_1 = 0;
7192  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7193  __Pyx_GOTREF(__pyx_t_1);
7194  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7195  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
7196  __pyx_t_10 = __pyx_t_1; __Pyx_INCREF(__pyx_t_10); __pyx_t_13 = 0;
7197  __pyx_t_7 = NULL;
7198  } else {
7199  __pyx_t_13 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 439, __pyx_L1_error)
7200  __Pyx_GOTREF(__pyx_t_10);
7201  __pyx_t_7 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L1_error)
7202  }
7203  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7204  for (;;) {
7205  if (likely(!__pyx_t_7)) {
7206  if (likely(PyList_CheckExact(__pyx_t_10))) {
7207  if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_10)) break;
7208  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7209  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
7210  #else
7211  __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7212  __Pyx_GOTREF(__pyx_t_1);
7213  #endif
7214  } else {
7215  if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
7216  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7217  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 439, __pyx_L1_error)
7218  #else
7219  __pyx_t_1 = PySequence_ITEM(__pyx_t_10, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 439, __pyx_L1_error)
7220  __Pyx_GOTREF(__pyx_t_1);
7221  #endif
7222  }
7223  } else {
7224  __pyx_t_1 = __pyx_t_7(__pyx_t_10);
7225  if (unlikely(!__pyx_t_1)) {
7226  PyObject* exc_type = PyErr_Occurred();
7227  if (exc_type) {
7228  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7229  else __PYX_ERR(0, 439, __pyx_L1_error)
7230  }
7231  break;
7232  }
7233  __Pyx_GOTREF(__pyx_t_1);
7234  }
7235  __Pyx_XDECREF_SET(__pyx_v_eOffset, __pyx_t_1);
7236  __pyx_t_1 = 0;
7237 
7238  /* "mprans/MeshSmoothing.pyx":440
7239  * for node in patchBoundaryNodes:
7240  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7241  * eN = femSpace.mesh.nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
7242  * if eN not in checkedElements:
7243  * checkedElements.append(eN)
7244  */
7245  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_mesh); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
7246  __Pyx_GOTREF(__pyx_t_1);
7247  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 440, __pyx_L1_error)
7248  __Pyx_GOTREF(__pyx_t_6);
7249  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7250  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_v_eOffset); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error)
7251  __Pyx_GOTREF(__pyx_t_1);
7252  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7253  __Pyx_XDECREF_SET(__pyx_v_eN, __pyx_t_1);
7254  __pyx_t_1 = 0;
7255 
7256  /* "mprans/MeshSmoothing.pyx":441
7257  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7258  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7259  * if eN not in checkedElements: # <<<<<<<<<<<<<<
7260  * checkedElements.append(eN)
7261  * # evaluate the inverse map for element eN
7262  */
7263  __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_eN, __pyx_v_checkedElements, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 441, __pyx_L1_error)
7264  __pyx_t_14 = (__pyx_t_5 != 0);
7265  if (__pyx_t_14) {
7266 
7267  /* "mprans/MeshSmoothing.pyx":442
7268  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7269  * if eN not in checkedElements:
7270  * checkedElements.append(eN) # <<<<<<<<<<<<<<
7271  * # evaluate the inverse map for element eN
7272  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
7273  */
7274  __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_checkedElements, __pyx_v_eN); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 442, __pyx_L1_error)
7275 
7276  /* "mprans/MeshSmoothing.pyx":444
7277  * checkedElements.append(eN)
7278  * # evaluate the inverse map for element eN
7279  * xi = femSpace.elementMaps.getInverseValue(eN, coords) # <<<<<<<<<<<<<<
7280  * # query whether xi lies within the reference element
7281  * if femSpace.elementMaps.referenceElement.onElement(xi):
7282  */
7283  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
7284  __Pyx_GOTREF(__pyx_t_6);
7285  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_getInverseValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
7286  __Pyx_GOTREF(__pyx_t_2);
7287  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7288  __pyx_t_6 = NULL;
7289  __pyx_t_12 = 0;
7290  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7291  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
7292  if (likely(__pyx_t_6)) {
7293  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7294  __Pyx_INCREF(__pyx_t_6);
7295  __Pyx_INCREF(function);
7296  __Pyx_DECREF_SET(__pyx_t_2, function);
7297  __pyx_t_12 = 1;
7298  }
7299  }
7300  #if CYTHON_FAST_PYCALL
7301  if (PyFunction_Check(__pyx_t_2)) {
7302  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_eN, __pyx_v_coords};
7303  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
7304  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7305  __Pyx_GOTREF(__pyx_t_1);
7306  } else
7307  #endif
7308  #if CYTHON_FAST_PYCCALL
7309  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
7310  PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_eN, __pyx_v_coords};
7311  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
7312  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7313  __Pyx_GOTREF(__pyx_t_1);
7314  } else
7315  #endif
7316  {
7317  __pyx_t_15 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 444, __pyx_L1_error)
7318  __Pyx_GOTREF(__pyx_t_15);
7319  if (__pyx_t_6) {
7320  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6); __pyx_t_6 = NULL;
7321  }
7322  __Pyx_INCREF(__pyx_v_eN);
7323  __Pyx_GIVEREF(__pyx_v_eN);
7324  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_12, __pyx_v_eN);
7325  __Pyx_INCREF(__pyx_v_coords);
7326  __Pyx_GIVEREF(__pyx_v_coords);
7327  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_12, __pyx_v_coords);
7328  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
7329  __Pyx_GOTREF(__pyx_t_1);
7330  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7331  }
7332  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7333  __Pyx_XDECREF_SET(__pyx_v_xi, __pyx_t_1);
7334  __pyx_t_1 = 0;
7335 
7336  /* "mprans/MeshSmoothing.pyx":446
7337  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
7338  * # query whether xi lies within the reference element
7339  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
7340  * return eN
7341  * # no elements found
7342  */
7343  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_femSpace, __pyx_n_s_elementMaps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
7344  __Pyx_GOTREF(__pyx_t_2);
7345  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_referenceElement); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 446, __pyx_L1_error)
7346  __Pyx_GOTREF(__pyx_t_15);
7347  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7348  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_onElement); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error)
7349  __Pyx_GOTREF(__pyx_t_2);
7350  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
7351  __pyx_t_15 = NULL;
7352  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
7353  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_2);
7354  if (likely(__pyx_t_15)) {
7355  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7356  __Pyx_INCREF(__pyx_t_15);
7357  __Pyx_INCREF(function);
7358  __Pyx_DECREF_SET(__pyx_t_2, function);
7359  }
7360  }
7361  __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_15, __pyx_v_xi) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xi);
7362  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
7363  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 446, __pyx_L1_error)
7364  __Pyx_GOTREF(__pyx_t_1);
7365  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7366  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 446, __pyx_L1_error)
7367  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7368  if (__pyx_t_14) {
7369 
7370  /* "mprans/MeshSmoothing.pyx":447
7371  * # query whether xi lies within the reference element
7372  * if femSpace.elementMaps.referenceElement.onElement(xi):
7373  * return eN # <<<<<<<<<<<<<<
7374  * # no elements found
7375  * return None
7376  */
7377  __Pyx_XDECREF(__pyx_r);
7378  __Pyx_INCREF(__pyx_v_eN);
7379  __pyx_r = __pyx_v_eN;
7380  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7381  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7382  goto __pyx_L0;
7383 
7384  /* "mprans/MeshSmoothing.pyx":446
7385  * xi = femSpace.elementMaps.getInverseValue(eN, coords)
7386  * # query whether xi lies within the reference element
7387  * if femSpace.elementMaps.referenceElement.onElement(xi): # <<<<<<<<<<<<<<
7388  * return eN
7389  * # no elements found
7390  */
7391  }
7392 
7393  /* "mprans/MeshSmoothing.pyx":441
7394  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]):
7395  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7396  * if eN not in checkedElements: # <<<<<<<<<<<<<<
7397  * checkedElements.append(eN)
7398  * # evaluate the inverse map for element eN
7399  */
7400  }
7401 
7402  /* "mprans/MeshSmoothing.pyx":439
7403  * # extra loop if case coords is in neighbour element
7404  * for node in patchBoundaryNodes:
7405  * for eOffset in range(femSpace.mesh.nodeElementOffsets[node], femSpace.mesh.nodeElementOffsets[node + 1]): # <<<<<<<<<<<<<<
7406  * eN = femSpace.mesh.nodeElementsArray[eOffset]
7407  * if eN not in checkedElements:
7408  */
7409  }
7410  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
7411  }
7412  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7413 
7414  /* "mprans/MeshSmoothing.pyx":449
7415  * return eN
7416  * # no elements found
7417  * return None # <<<<<<<<<<<<<<
7418  *
7419  *
7420  */
7421  __Pyx_XDECREF(__pyx_r);
7422  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7423  goto __pyx_L0;
7424 
7425  /* "mprans/MeshSmoothing.pyx":388
7426  * eN=eN)
7427  *
7428  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
7429  * coords,
7430  * node):
7431  */
7432 
7433  /* function exit code */
7434  __pyx_L1_error:;
7435  __Pyx_XDECREF(__pyx_t_1);
7436  __Pyx_XDECREF(__pyx_t_2);
7437  __Pyx_XDECREF(__pyx_t_3);
7438  __Pyx_XDECREF(__pyx_t_6);
7439  __Pyx_XDECREF(__pyx_t_10);
7440  __Pyx_XDECREF(__pyx_t_15);
7441  __Pyx_AddTraceback("mprans.MeshSmoothing.getLocalElement", __pyx_clineno, __pyx_lineno, __pyx_filename);
7442  __pyx_r = NULL;
7443  __pyx_L0:;
7444  __Pyx_XDECREF(__pyx_v_patchBoundaryNodes);
7445  __Pyx_XDECREF(__pyx_v_checkedElements);
7446  __Pyx_XDECREF(__pyx_v_eOffset);
7447  __Pyx_XDECREF(__pyx_v_eN);
7448  __Pyx_XDECREF(__pyx_v_xi);
7449  __Pyx_XDECREF(__pyx_v_node);
7450  __Pyx_XGIVEREF(__pyx_r);
7451  __Pyx_RefNannyFinishContext();
7452  return __pyx_r;
7453 }
7454 
7455 /* "mprans/MeshSmoothing.pyx":452
7456  *
7457  *
7458  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7459  * double[:,:] nodeArray,
7460  * int[:,:] elementBoundariesArray,
7461  */
7462 
7463 /* Python wrapper */
7464 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7465 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle = {"updateElementBoundaryNormalsTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle, METH_VARARGS|METH_KEYWORDS, 0};
7466 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7467  __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
7468  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7469  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7470  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7471  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7472  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7473  int __pyx_v_nElements;
7474  int __pyx_lineno = 0;
7475  const char *__pyx_filename = NULL;
7476  int __pyx_clineno = 0;
7477  PyObject *__pyx_r = 0;
7478  __Pyx_RefNannyDeclarations
7479  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTriangle (wrapper)", 0);
7480  {
7481  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundaryNormalsArray_2,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nElements,0};
7482  PyObject* values[7] = {0,0,0,0,0,0,0};
7483  if (unlikely(__pyx_kwds)) {
7484  Py_ssize_t kw_args;
7485  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7486  switch (pos_args) {
7487  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7488  CYTHON_FALLTHROUGH;
7489  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7490  CYTHON_FALLTHROUGH;
7491  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7492  CYTHON_FALLTHROUGH;
7493  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7494  CYTHON_FALLTHROUGH;
7495  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7496  CYTHON_FALLTHROUGH;
7497  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7498  CYTHON_FALLTHROUGH;
7499  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7500  CYTHON_FALLTHROUGH;
7501  case 0: break;
7502  default: goto __pyx_L5_argtuple_error;
7503  }
7504  kw_args = PyDict_Size(__pyx_kwds);
7505  switch (pos_args) {
7506  case 0:
7507  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNormalsArray_2)) != 0)) kw_args--;
7508  else goto __pyx_L5_argtuple_error;
7509  CYTHON_FALLTHROUGH;
7510  case 1:
7511  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7512  else {
7513  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 1); __PYX_ERR(0, 452, __pyx_L3_error)
7514  }
7515  CYTHON_FALLTHROUGH;
7516  case 2:
7517  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7518  else {
7519  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 2); __PYX_ERR(0, 452, __pyx_L3_error)
7520  }
7521  CYTHON_FALLTHROUGH;
7522  case 3:
7523  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7524  else {
7525  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 3); __PYX_ERR(0, 452, __pyx_L3_error)
7526  }
7527  CYTHON_FALLTHROUGH;
7528  case 4:
7529  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7530  else {
7531  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 4); __PYX_ERR(0, 452, __pyx_L3_error)
7532  }
7533  CYTHON_FALLTHROUGH;
7534  case 5:
7535  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7536  else {
7537  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 5); __PYX_ERR(0, 452, __pyx_L3_error)
7538  }
7539  CYTHON_FALLTHROUGH;
7540  case 6:
7541  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
7542  else {
7543  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, 6); __PYX_ERR(0, 452, __pyx_L3_error)
7544  }
7545  }
7546  if (unlikely(kw_args > 0)) {
7547  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementBoundaryNormalsTriangle") < 0)) __PYX_ERR(0, 452, __pyx_L3_error)
7548  }
7549  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7550  goto __pyx_L5_argtuple_error;
7551  } else {
7552  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7553  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7554  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7555  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7556  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7557  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7558  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7559  }
7560  __pyx_v_elementBoundaryNormalsArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNormalsArray_.memview)) __PYX_ERR(0, 452, __pyx_L3_error)
7561  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 453, __pyx_L3_error)
7562  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 454, __pyx_L3_error)
7563  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 455, __pyx_L3_error)
7564  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 456, __pyx_L3_error)
7565  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 457, __pyx_L3_error)
7566  __pyx_v_nElements = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 458, __pyx_L3_error)
7567  }
7568  goto __pyx_L4_argument_unpacking_done;
7569  __pyx_L5_argtuple_error:;
7570  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTriangle", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 452, __pyx_L3_error)
7571  __pyx_L3_error:;
7572  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
7573  __Pyx_RefNannyFinishContext();
7574  return NULL;
7575  __pyx_L4_argument_unpacking_done:;
7576  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_34updateElementBoundaryNormalsTriangle(__pyx_self, __pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7577 
7578  /* function exit code */
7579  __Pyx_RefNannyFinishContext();
7580  return __pyx_r;
7581 }
7582 
7583 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_34updateElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
7584  PyObject *__pyx_r = NULL;
7585  __Pyx_RefNannyDeclarations
7586  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTriangle", 0);
7587 
7588  /* "mprans/MeshSmoothing.pyx":459
7589  * double[:,:] elementBarycentersArray,
7590  * int nElements):
7591  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7592  * nodeArray=nodeArray,
7593  * elementBoundariesArray=elementBoundariesArray,
7594  */
7595  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7596 
7597  /* "mprans/MeshSmoothing.pyx":452
7598  *
7599  *
7600  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7601  * double[:,:] nodeArray,
7602  * int[:,:] elementBoundariesArray,
7603  */
7604 
7605  /* function exit code */
7606  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7607  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNormalsArray_, 1);
7608  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
7609  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
7610  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
7611  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
7612  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
7613  __Pyx_XGIVEREF(__pyx_r);
7614  __Pyx_RefNannyFinishContext();
7615  return __pyx_r;
7616 }
7617 
7618 /* "mprans/MeshSmoothing.pyx":467
7619  * nElements=nElements)
7620  *
7621  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
7622  * int[:,:] elementBoundariesArray,
7623  * int[:,:] elementBoundaryNodesArray,
7624  */
7625 
7626 /* Python wrapper */
7627 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7628 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle = {"getElementBoundaryNormalsTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle, METH_VARARGS|METH_KEYWORDS, 0};
7629 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7630  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7631  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7632  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7633  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7634  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7635  int __pyx_lineno = 0;
7636  const char *__pyx_filename = NULL;
7637  int __pyx_clineno = 0;
7638  PyObject *__pyx_r = 0;
7639  __Pyx_RefNannyDeclarations
7640  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTriangle (wrapper)", 0);
7641  {
7642  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,0};
7643  PyObject* values[5] = {0,0,0,0,0};
7644  if (unlikely(__pyx_kwds)) {
7645  Py_ssize_t kw_args;
7646  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7647  switch (pos_args) {
7648  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7649  CYTHON_FALLTHROUGH;
7650  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7651  CYTHON_FALLTHROUGH;
7652  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7653  CYTHON_FALLTHROUGH;
7654  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7655  CYTHON_FALLTHROUGH;
7656  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7657  CYTHON_FALLTHROUGH;
7658  case 0: break;
7659  default: goto __pyx_L5_argtuple_error;
7660  }
7661  kw_args = PyDict_Size(__pyx_kwds);
7662  switch (pos_args) {
7663  case 0:
7664  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7665  else goto __pyx_L5_argtuple_error;
7666  CYTHON_FALLTHROUGH;
7667  case 1:
7668  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7669  else {
7670  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 1); __PYX_ERR(0, 467, __pyx_L3_error)
7671  }
7672  CYTHON_FALLTHROUGH;
7673  case 2:
7674  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7675  else {
7676  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 2); __PYX_ERR(0, 467, __pyx_L3_error)
7677  }
7678  CYTHON_FALLTHROUGH;
7679  case 3:
7680  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7681  else {
7682  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 3); __PYX_ERR(0, 467, __pyx_L3_error)
7683  }
7684  CYTHON_FALLTHROUGH;
7685  case 4:
7686  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7687  else {
7688  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, 4); __PYX_ERR(0, 467, __pyx_L3_error)
7689  }
7690  }
7691  if (unlikely(kw_args > 0)) {
7692  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElementBoundaryNormalsTriangle") < 0)) __PYX_ERR(0, 467, __pyx_L3_error)
7693  }
7694  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
7695  goto __pyx_L5_argtuple_error;
7696  } else {
7697  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7698  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7699  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7700  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7701  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7702  }
7703  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 467, __pyx_L3_error)
7704  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 468, __pyx_L3_error)
7705  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 469, __pyx_L3_error)
7706  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 470, __pyx_L3_error)
7707  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 471, __pyx_L3_error)
7708  }
7709  goto __pyx_L4_argument_unpacking_done;
7710  __pyx_L5_argtuple_error:;
7711  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTriangle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 467, __pyx_L3_error)
7712  __pyx_L3_error:;
7713  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
7714  __Pyx_RefNannyFinishContext();
7715  return NULL;
7716  __pyx_L4_argument_unpacking_done:;
7717  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_36getElementBoundaryNormalsTriangle(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray);
7718 
7719  /* function exit code */
7720  __Pyx_RefNannyFinishContext();
7721  return __pyx_r;
7722 }
7723 
7724 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_36getElementBoundaryNormalsTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray) {
7725  PyObject *__pyx_v_elementBoundaryNormalsArray_ = NULL;
7726  int __pyx_v_nElements;
7727  PyObject *__pyx_r = NULL;
7728  __Pyx_RefNannyDeclarations
7729  PyObject *__pyx_t_1 = NULL;
7730  PyObject *__pyx_t_2 = NULL;
7731  PyObject *__pyx_t_3 = NULL;
7732  PyObject *__pyx_t_4 = NULL;
7733  int __pyx_t_5;
7734  PyObject *__pyx_t_6 = NULL;
7735  Py_ssize_t __pyx_t_7;
7736  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
7737  int __pyx_lineno = 0;
7738  const char *__pyx_filename = NULL;
7739  int __pyx_clineno = 0;
7740  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTriangle", 0);
7741 
7742  /* "mprans/MeshSmoothing.pyx":472
7743  * double[:,:] elementBoundaryBarycentersArray,
7744  * double[:,:] elementBarycentersArray):
7745  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 3, 3) # <<<<<<<<<<<<<<
7746  * cdef int nElements = len(elementBoundaryNormalsArray_)
7747  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
7748  */
7749  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
7750  __Pyx_GOTREF(__pyx_t_2);
7751  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
7752  __Pyx_GOTREF(__pyx_t_3);
7753  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7754  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_elementBoundariesArray.shape[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 472, __pyx_L1_error)
7755  __Pyx_GOTREF(__pyx_t_2);
7756  __pyx_t_4 = NULL;
7757  __pyx_t_5 = 0;
7758  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7759  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7760  if (likely(__pyx_t_4)) {
7761  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7762  __Pyx_INCREF(__pyx_t_4);
7763  __Pyx_INCREF(function);
7764  __Pyx_DECREF_SET(__pyx_t_3, function);
7765  __pyx_t_5 = 1;
7766  }
7767  }
7768  #if CYTHON_FAST_PYCALL
7769  if (PyFunction_Check(__pyx_t_3)) {
7770  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_3, __pyx_int_3};
7771  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
7772  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7773  __Pyx_GOTREF(__pyx_t_1);
7774  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7775  } else
7776  #endif
7777  #if CYTHON_FAST_PYCCALL
7778  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7779  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_3, __pyx_int_3};
7780  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
7781  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7782  __Pyx_GOTREF(__pyx_t_1);
7783  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7784  } else
7785  #endif
7786  {
7787  __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 472, __pyx_L1_error)
7788  __Pyx_GOTREF(__pyx_t_6);
7789  if (__pyx_t_4) {
7790  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7791  }
7792  __Pyx_GIVEREF(__pyx_t_2);
7793  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
7794  __Pyx_INCREF(__pyx_int_3);
7795  __Pyx_GIVEREF(__pyx_int_3);
7796  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_3);
7797  __Pyx_INCREF(__pyx_int_3);
7798  __Pyx_GIVEREF(__pyx_int_3);
7799  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_int_3);
7800  __pyx_t_2 = 0;
7801  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 472, __pyx_L1_error)
7802  __Pyx_GOTREF(__pyx_t_1);
7803  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7804  }
7805  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7806  __pyx_v_elementBoundaryNormalsArray_ = __pyx_t_1;
7807  __pyx_t_1 = 0;
7808 
7809  /* "mprans/MeshSmoothing.pyx":473
7810  * double[:,:] elementBarycentersArray):
7811  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 3, 3)
7812  * cdef int nElements = len(elementBoundaryNormalsArray_) # <<<<<<<<<<<<<<
7813  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
7814  * nodeArray=nodeArray,
7815  */
7816  __pyx_t_7 = PyObject_Length(__pyx_v_elementBoundaryNormalsArray_); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 473, __pyx_L1_error)
7817  __pyx_v_nElements = __pyx_t_7;
7818 
7819  /* "mprans/MeshSmoothing.pyx":474
7820  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 3, 3)
7821  * cdef int nElements = len(elementBoundaryNormalsArray_)
7822  * pyxUpdateElementBoundaryNormalsTriangle(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7823  * nodeArray=nodeArray,
7824  * elementBoundariesArray=elementBoundariesArray,
7825  */
7826  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_v_elementBoundaryNormalsArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 474, __pyx_L1_error)
7827 
7828  /* "mprans/MeshSmoothing.pyx":480
7829  * elementBoundaryBarycentersArray=elementBoundaryBarycentersArray,
7830  * elementBarycentersArray=elementBarycentersArray,
7831  * nElements=nElements) # <<<<<<<<<<<<<<
7832  * return elementBoundaryNormalsArray_
7833  *
7834  */
7835  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__pyx_t_8, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
7836  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
7837  __pyx_t_8.memview = NULL;
7838  __pyx_t_8.data = NULL;
7839 
7840  /* "mprans/MeshSmoothing.pyx":481
7841  * elementBarycentersArray=elementBarycentersArray,
7842  * nElements=nElements)
7843  * return elementBoundaryNormalsArray_ # <<<<<<<<<<<<<<
7844  *
7845  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_,
7846  */
7847  __Pyx_XDECREF(__pyx_r);
7848  __Pyx_INCREF(__pyx_v_elementBoundaryNormalsArray_);
7849  __pyx_r = __pyx_v_elementBoundaryNormalsArray_;
7850  goto __pyx_L0;
7851 
7852  /* "mprans/MeshSmoothing.pyx":467
7853  * nElements=nElements)
7854  *
7855  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
7856  * int[:,:] elementBoundariesArray,
7857  * int[:,:] elementBoundaryNodesArray,
7858  */
7859 
7860  /* function exit code */
7861  __pyx_L1_error:;
7862  __Pyx_XDECREF(__pyx_t_1);
7863  __Pyx_XDECREF(__pyx_t_2);
7864  __Pyx_XDECREF(__pyx_t_3);
7865  __Pyx_XDECREF(__pyx_t_4);
7866  __Pyx_XDECREF(__pyx_t_6);
7867  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
7868  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
7869  __pyx_r = NULL;
7870  __pyx_L0:;
7871  __Pyx_XDECREF(__pyx_v_elementBoundaryNormalsArray_);
7872  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
7873  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
7874  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
7875  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
7876  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
7877  __Pyx_XGIVEREF(__pyx_r);
7878  __Pyx_RefNannyFinishContext();
7879  return __pyx_r;
7880 }
7881 
7882 /* "mprans/MeshSmoothing.pyx":483
7883  * return elementBoundaryNormalsArray_
7884  *
7885  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
7886  * double[:,:] nodeArray,
7887  * int[:,:] elementBoundariesArray,
7888  */
7889 
7890 /* Python wrapper */
7891 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7892 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra = {"updateElementBoundaryNormalsTetra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra, METH_VARARGS|METH_KEYWORDS, 0};
7893 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7894  __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
7895  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7896  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7897  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7898  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7899  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
7900  int __pyx_v_nElements;
7901  int __pyx_lineno = 0;
7902  const char *__pyx_filename = NULL;
7903  int __pyx_clineno = 0;
7904  PyObject *__pyx_r = 0;
7905  __Pyx_RefNannyDeclarations
7906  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTetra (wrapper)", 0);
7907  {
7908  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBoundaryNormalsArray_2,&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,&__pyx_n_s_nElements,0};
7909  PyObject* values[7] = {0,0,0,0,0,0,0};
7910  if (unlikely(__pyx_kwds)) {
7911  Py_ssize_t kw_args;
7912  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7913  switch (pos_args) {
7914  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7915  CYTHON_FALLTHROUGH;
7916  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7917  CYTHON_FALLTHROUGH;
7918  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7919  CYTHON_FALLTHROUGH;
7920  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7921  CYTHON_FALLTHROUGH;
7922  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7923  CYTHON_FALLTHROUGH;
7924  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7925  CYTHON_FALLTHROUGH;
7926  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7927  CYTHON_FALLTHROUGH;
7928  case 0: break;
7929  default: goto __pyx_L5_argtuple_error;
7930  }
7931  kw_args = PyDict_Size(__pyx_kwds);
7932  switch (pos_args) {
7933  case 0:
7934  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNormalsArray_2)) != 0)) kw_args--;
7935  else goto __pyx_L5_argtuple_error;
7936  CYTHON_FALLTHROUGH;
7937  case 1:
7938  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
7939  else {
7940  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 1); __PYX_ERR(0, 483, __pyx_L3_error)
7941  }
7942  CYTHON_FALLTHROUGH;
7943  case 2:
7944  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
7945  else {
7946  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 2); __PYX_ERR(0, 483, __pyx_L3_error)
7947  }
7948  CYTHON_FALLTHROUGH;
7949  case 3:
7950  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
7951  else {
7952  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 3); __PYX_ERR(0, 483, __pyx_L3_error)
7953  }
7954  CYTHON_FALLTHROUGH;
7955  case 4:
7956  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
7957  else {
7958  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 4); __PYX_ERR(0, 483, __pyx_L3_error)
7959  }
7960  CYTHON_FALLTHROUGH;
7961  case 5:
7962  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
7963  else {
7964  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 5); __PYX_ERR(0, 483, __pyx_L3_error)
7965  }
7966  CYTHON_FALLTHROUGH;
7967  case 6:
7968  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
7969  else {
7970  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, 6); __PYX_ERR(0, 483, __pyx_L3_error)
7971  }
7972  }
7973  if (unlikely(kw_args > 0)) {
7974  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementBoundaryNormalsTetra") < 0)) __PYX_ERR(0, 483, __pyx_L3_error)
7975  }
7976  } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
7977  goto __pyx_L5_argtuple_error;
7978  } else {
7979  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7980  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7981  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7982  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
7983  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
7984  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
7985  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
7986  }
7987  __pyx_v_elementBoundaryNormalsArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNormalsArray_.memview)) __PYX_ERR(0, 483, __pyx_L3_error)
7988  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 484, __pyx_L3_error)
7989  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 485, __pyx_L3_error)
7990  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 486, __pyx_L3_error)
7991  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 487, __pyx_L3_error)
7992  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 488, __pyx_L3_error)
7993  __pyx_v_nElements = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error)
7994  }
7995  goto __pyx_L4_argument_unpacking_done;
7996  __pyx_L5_argtuple_error:;
7997  __Pyx_RaiseArgtupleInvalid("updateElementBoundaryNormalsTetra", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 483, __pyx_L3_error)
7998  __pyx_L3_error:;
7999  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
8000  __Pyx_RefNannyFinishContext();
8001  return NULL;
8002  __pyx_L4_argument_unpacking_done:;
8003  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_38updateElementBoundaryNormalsTetra(__pyx_self, __pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
8004 
8005  /* function exit code */
8006  __Pyx_RefNannyFinishContext();
8007  return __pyx_r;
8008 }
8009 
8010 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_38updateElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
8011  PyObject *__pyx_r = NULL;
8012  __Pyx_RefNannyDeclarations
8013  __Pyx_RefNannySetupContext("updateElementBoundaryNormalsTetra", 0);
8014 
8015  /* "mprans/MeshSmoothing.pyx":490
8016  * double[:,:] elementBarycentersArray,
8017  * int nElements):
8018  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
8019  * nodeArray=nodeArray,
8020  * elementBoundariesArray=elementBoundariesArray,
8021  */
8022  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__pyx_v_elementBoundaryNormalsArray_, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
8023 
8024  /* "mprans/MeshSmoothing.pyx":483
8025  * return elementBoundaryNormalsArray_
8026  *
8027  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
8028  * double[:,:] nodeArray,
8029  * int[:,:] elementBoundariesArray,
8030  */
8031 
8032  /* function exit code */
8033  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8034  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNormalsArray_, 1);
8035  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8036  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
8037  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
8038  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
8039  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
8040  __Pyx_XGIVEREF(__pyx_r);
8041  __Pyx_RefNannyFinishContext();
8042  return __pyx_r;
8043 }
8044 
8045 /* "mprans/MeshSmoothing.pyx":498
8046  * nElements=nElements)
8047  *
8048  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8049  * int[:,:] elementBoundariesArray,
8050  * int[:,:] elementBoundaryNodesArray,
8051  */
8052 
8053 /* Python wrapper */
8054 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8055 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra = {"getElementBoundaryNormalsTetra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra, METH_VARARGS|METH_KEYWORDS, 0};
8056 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8057  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8058  __Pyx_memviewslice __pyx_v_elementBoundariesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8059  __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8060  __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8061  __Pyx_memviewslice __pyx_v_elementBarycentersArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8062  int __pyx_lineno = 0;
8063  const char *__pyx_filename = NULL;
8064  int __pyx_clineno = 0;
8065  PyObject *__pyx_r = 0;
8066  __Pyx_RefNannyDeclarations
8067  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTetra (wrapper)", 0);
8068  {
8069  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_elementBoundariesArray,&__pyx_n_s_elementBoundaryNodesArray,&__pyx_n_s_elementBoundaryBarycentersArray,&__pyx_n_s_elementBarycentersArray,0};
8070  PyObject* values[5] = {0,0,0,0,0};
8071  if (unlikely(__pyx_kwds)) {
8072  Py_ssize_t kw_args;
8073  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8074  switch (pos_args) {
8075  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8076  CYTHON_FALLTHROUGH;
8077  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8078  CYTHON_FALLTHROUGH;
8079  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8080  CYTHON_FALLTHROUGH;
8081  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8082  CYTHON_FALLTHROUGH;
8083  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8084  CYTHON_FALLTHROUGH;
8085  case 0: break;
8086  default: goto __pyx_L5_argtuple_error;
8087  }
8088  kw_args = PyDict_Size(__pyx_kwds);
8089  switch (pos_args) {
8090  case 0:
8091  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8092  else goto __pyx_L5_argtuple_error;
8093  CYTHON_FALLTHROUGH;
8094  case 1:
8095  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundariesArray)) != 0)) kw_args--;
8096  else {
8097  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 1); __PYX_ERR(0, 498, __pyx_L3_error)
8098  }
8099  CYTHON_FALLTHROUGH;
8100  case 2:
8101  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryNodesArray)) != 0)) kw_args--;
8102  else {
8103  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 2); __PYX_ERR(0, 498, __pyx_L3_error)
8104  }
8105  CYTHON_FALLTHROUGH;
8106  case 3:
8107  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBoundaryBarycentersArray)) != 0)) kw_args--;
8108  else {
8109  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 3); __PYX_ERR(0, 498, __pyx_L3_error)
8110  }
8111  CYTHON_FALLTHROUGH;
8112  case 4:
8113  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray)) != 0)) kw_args--;
8114  else {
8115  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, 4); __PYX_ERR(0, 498, __pyx_L3_error)
8116  }
8117  }
8118  if (unlikely(kw_args > 0)) {
8119  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElementBoundaryNormalsTetra") < 0)) __PYX_ERR(0, 498, __pyx_L3_error)
8120  }
8121  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
8122  goto __pyx_L5_argtuple_error;
8123  } else {
8124  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8125  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8126  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8127  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8128  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8129  }
8130  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 498, __pyx_L3_error)
8131  __pyx_v_elementBoundariesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundariesArray.memview)) __PYX_ERR(0, 499, __pyx_L3_error)
8132  __pyx_v_elementBoundaryNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryNodesArray.memview)) __PYX_ERR(0, 500, __pyx_L3_error)
8133  __pyx_v_elementBoundaryBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBoundaryBarycentersArray.memview)) __PYX_ERR(0, 501, __pyx_L3_error)
8134  __pyx_v_elementBarycentersArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray.memview)) __PYX_ERR(0, 502, __pyx_L3_error)
8135  }
8136  goto __pyx_L4_argument_unpacking_done;
8137  __pyx_L5_argtuple_error:;
8138  __Pyx_RaiseArgtupleInvalid("getElementBoundaryNormalsTetra", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 498, __pyx_L3_error)
8139  __pyx_L3_error:;
8140  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
8141  __Pyx_RefNannyFinishContext();
8142  return NULL;
8143  __pyx_L4_argument_unpacking_done:;
8144  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_40getElementBoundaryNormalsTetra(__pyx_self, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray);
8145 
8146  /* function exit code */
8147  __Pyx_RefNannyFinishContext();
8148  return __pyx_r;
8149 }
8150 
8151 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_40getElementBoundaryNormalsTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray) {
8152  PyObject *__pyx_v_elementBoundaryNormalsArray_ = NULL;
8153  int __pyx_v_nElements;
8154  PyObject *__pyx_r = NULL;
8155  __Pyx_RefNannyDeclarations
8156  PyObject *__pyx_t_1 = NULL;
8157  PyObject *__pyx_t_2 = NULL;
8158  PyObject *__pyx_t_3 = NULL;
8159  PyObject *__pyx_t_4 = NULL;
8160  int __pyx_t_5;
8161  PyObject *__pyx_t_6 = NULL;
8162  Py_ssize_t __pyx_t_7;
8163  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
8164  int __pyx_lineno = 0;
8165  const char *__pyx_filename = NULL;
8166  int __pyx_clineno = 0;
8167  __Pyx_RefNannySetupContext("getElementBoundaryNormalsTetra", 0);
8168 
8169  /* "mprans/MeshSmoothing.pyx":503
8170  * double[:,:] elementBoundaryBarycentersArray,
8171  * double[:,:] elementBarycentersArray):
8172  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 4, 3) # <<<<<<<<<<<<<<
8173  * cdef int nElements = len(elementBoundaryNormalsArray_)
8174  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
8175  */
8176  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
8177  __Pyx_GOTREF(__pyx_t_2);
8178  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error)
8179  __Pyx_GOTREF(__pyx_t_3);
8180  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8181  __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_elementBoundariesArray.shape[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
8182  __Pyx_GOTREF(__pyx_t_2);
8183  __pyx_t_4 = NULL;
8184  __pyx_t_5 = 0;
8185  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8186  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8187  if (likely(__pyx_t_4)) {
8188  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8189  __Pyx_INCREF(__pyx_t_4);
8190  __Pyx_INCREF(function);
8191  __Pyx_DECREF_SET(__pyx_t_3, function);
8192  __pyx_t_5 = 1;
8193  }
8194  }
8195  #if CYTHON_FAST_PYCALL
8196  if (PyFunction_Check(__pyx_t_3)) {
8197  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_4, __pyx_int_3};
8198  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
8199  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8200  __Pyx_GOTREF(__pyx_t_1);
8201  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8202  } else
8203  #endif
8204  #if CYTHON_FAST_PYCCALL
8205  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
8206  PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_2, __pyx_int_4, __pyx_int_3};
8207  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
8208  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8209  __Pyx_GOTREF(__pyx_t_1);
8210  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8211  } else
8212  #endif
8213  {
8214  __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 503, __pyx_L1_error)
8215  __Pyx_GOTREF(__pyx_t_6);
8216  if (__pyx_t_4) {
8217  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
8218  }
8219  __Pyx_GIVEREF(__pyx_t_2);
8220  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_2);
8221  __Pyx_INCREF(__pyx_int_4);
8222  __Pyx_GIVEREF(__pyx_int_4);
8223  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_int_4);
8224  __Pyx_INCREF(__pyx_int_3);
8225  __Pyx_GIVEREF(__pyx_int_3);
8226  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_int_3);
8227  __pyx_t_2 = 0;
8228  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
8229  __Pyx_GOTREF(__pyx_t_1);
8230  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8231  }
8232  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8233  __pyx_v_elementBoundaryNormalsArray_ = __pyx_t_1;
8234  __pyx_t_1 = 0;
8235 
8236  /* "mprans/MeshSmoothing.pyx":504
8237  * double[:,:] elementBarycentersArray):
8238  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 4, 3)
8239  * cdef int nElements = len(elementBoundaryNormalsArray_) # <<<<<<<<<<<<<<
8240  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_,
8241  * nodeArray=nodeArray,
8242  */
8243  __pyx_t_7 = PyObject_Length(__pyx_v_elementBoundaryNormalsArray_); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 504, __pyx_L1_error)
8244  __pyx_v_nElements = __pyx_t_7;
8245 
8246  /* "mprans/MeshSmoothing.pyx":505
8247  * elementBoundaryNormalsArray_ = np.zeros(elementBoundariesArray.shape[0], 4, 3)
8248  * cdef int nElements = len(elementBoundaryNormalsArray_)
8249  * pyxUpdateElementBoundaryNormalsTetra(elementBoundaryNormalsArray_=elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
8250  * nodeArray=nodeArray,
8251  * elementBoundariesArray=elementBoundariesArray,
8252  */
8253  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(__pyx_v_elementBoundaryNormalsArray_, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 505, __pyx_L1_error)
8254 
8255  /* "mprans/MeshSmoothing.pyx":511
8256  * elementBoundaryBarycentersArray=elementBoundaryBarycentersArray,
8257  * elementBarycentersArray=elementBarycentersArray,
8258  * nElements=nElements) # <<<<<<<<<<<<<<
8259  * return elementBoundaryNormalsArray_
8260  *
8261  */
8262  __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__pyx_t_8, __pyx_v_nodeArray, __pyx_v_elementBoundariesArray, __pyx_v_elementBoundaryNodesArray, __pyx_v_elementBoundaryBarycentersArray, __pyx_v_elementBarycentersArray, __pyx_v_nElements);
8263  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
8264  __pyx_t_8.memview = NULL;
8265  __pyx_t_8.data = NULL;
8266 
8267  /* "mprans/MeshSmoothing.pyx":512
8268  * elementBarycentersArray=elementBarycentersArray,
8269  * nElements=nElements)
8270  * return elementBoundaryNormalsArray_ # <<<<<<<<<<<<<<
8271  *
8272  * def updateElementVolumesTriangle(double[:] elementVolumesArray_,
8273  */
8274  __Pyx_XDECREF(__pyx_r);
8275  __Pyx_INCREF(__pyx_v_elementBoundaryNormalsArray_);
8276  __pyx_r = __pyx_v_elementBoundaryNormalsArray_;
8277  goto __pyx_L0;
8278 
8279  /* "mprans/MeshSmoothing.pyx":498
8280  * nElements=nElements)
8281  *
8282  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8283  * int[:,:] elementBoundariesArray,
8284  * int[:,:] elementBoundaryNodesArray,
8285  */
8286 
8287  /* function exit code */
8288  __pyx_L1_error:;
8289  __Pyx_XDECREF(__pyx_t_1);
8290  __Pyx_XDECREF(__pyx_t_2);
8291  __Pyx_XDECREF(__pyx_t_3);
8292  __Pyx_XDECREF(__pyx_t_4);
8293  __Pyx_XDECREF(__pyx_t_6);
8294  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
8295  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementBoundaryNormalsTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
8296  __pyx_r = NULL;
8297  __pyx_L0:;
8298  __Pyx_XDECREF(__pyx_v_elementBoundaryNormalsArray_);
8299  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8300  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundariesArray, 1);
8301  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryNodesArray, 1);
8302  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBoundaryBarycentersArray, 1);
8303  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray, 1);
8304  __Pyx_XGIVEREF(__pyx_r);
8305  __Pyx_RefNannyFinishContext();
8306  return __pyx_r;
8307 }
8308 
8309 /* "mprans/MeshSmoothing.pyx":514
8310  * return elementBoundaryNormalsArray_
8311  *
8312  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8313  * int[:,:] elementNodesArray,
8314  * double[:,:] nodeArray,
8315  */
8316 
8317 /* Python wrapper */
8318 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_43updateElementVolumesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8319 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_43updateElementVolumesTriangle = {"updateElementVolumesTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_43updateElementVolumesTriangle, METH_VARARGS|METH_KEYWORDS, 0};
8320 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_43updateElementVolumesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8321  __Pyx_memviewslice __pyx_v_elementVolumesArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
8322  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8323  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8324  int __pyx_v_nElements;
8325  int __pyx_lineno = 0;
8326  const char *__pyx_filename = NULL;
8327  int __pyx_clineno = 0;
8328  PyObject *__pyx_r = 0;
8329  __Pyx_RefNannyDeclarations
8330  __Pyx_RefNannySetupContext("updateElementVolumesTriangle (wrapper)", 0);
8331  {
8332  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementVolumesArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nElements,0};
8333  PyObject* values[4] = {0,0,0,0};
8334  if (unlikely(__pyx_kwds)) {
8335  Py_ssize_t kw_args;
8336  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8337  switch (pos_args) {
8338  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8339  CYTHON_FALLTHROUGH;
8340  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8341  CYTHON_FALLTHROUGH;
8342  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8343  CYTHON_FALLTHROUGH;
8344  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8345  CYTHON_FALLTHROUGH;
8346  case 0: break;
8347  default: goto __pyx_L5_argtuple_error;
8348  }
8349  kw_args = PyDict_Size(__pyx_kwds);
8350  switch (pos_args) {
8351  case 0:
8352  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumesArray_2)) != 0)) kw_args--;
8353  else goto __pyx_L5_argtuple_error;
8354  CYTHON_FALLTHROUGH;
8355  case 1:
8356  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
8357  else {
8358  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, 1); __PYX_ERR(0, 514, __pyx_L3_error)
8359  }
8360  CYTHON_FALLTHROUGH;
8361  case 2:
8362  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8363  else {
8364  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, 2); __PYX_ERR(0, 514, __pyx_L3_error)
8365  }
8366  CYTHON_FALLTHROUGH;
8367  case 3:
8368  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
8369  else {
8370  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, 3); __PYX_ERR(0, 514, __pyx_L3_error)
8371  }
8372  }
8373  if (unlikely(kw_args > 0)) {
8374  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementVolumesTriangle") < 0)) __PYX_ERR(0, 514, __pyx_L3_error)
8375  }
8376  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8377  goto __pyx_L5_argtuple_error;
8378  } else {
8379  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8380  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8381  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8382  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8383  }
8384  __pyx_v_elementVolumesArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumesArray_.memview)) __PYX_ERR(0, 514, __pyx_L3_error)
8385  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 515, __pyx_L3_error)
8386  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 516, __pyx_L3_error)
8387  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 517, __pyx_L3_error)
8388  }
8389  goto __pyx_L4_argument_unpacking_done;
8390  __pyx_L5_argtuple_error:;
8391  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTriangle", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 514, __pyx_L3_error)
8392  __pyx_L3_error:;
8393  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementVolumesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8394  __Pyx_RefNannyFinishContext();
8395  return NULL;
8396  __pyx_L4_argument_unpacking_done:;
8397  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_42updateElementVolumesTriangle(__pyx_self, __pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8398 
8399  /* function exit code */
8400  __Pyx_RefNannyFinishContext();
8401  return __pyx_r;
8402 }
8403 
8404 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_42updateElementVolumesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
8405  PyObject *__pyx_r = NULL;
8406  __Pyx_RefNannyDeclarations
8407  __Pyx_RefNannySetupContext("updateElementVolumesTriangle", 0);
8408 
8409  /* "mprans/MeshSmoothing.pyx":518
8410  * double[:,:] nodeArray,
8411  * int nElements):
8412  * cyUpdateElementVolumesTriangle(elementVolumesArray_=elementVolumesArray_, # <<<<<<<<<<<<<<
8413  * elementNodesArray=elementNodesArray,
8414  * nodeArray=nodeArray,
8415  */
8416  __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle(__pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8417 
8418  /* "mprans/MeshSmoothing.pyx":514
8419  * return elementBoundaryNormalsArray_
8420  *
8421  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8422  * int[:,:] elementNodesArray,
8423  * double[:,:] nodeArray,
8424  */
8425 
8426  /* function exit code */
8427  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8428  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumesArray_, 1);
8429  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
8430  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8431  __Pyx_XGIVEREF(__pyx_r);
8432  __Pyx_RefNannyFinishContext();
8433  return __pyx_r;
8434 }
8435 
8436 /* "mprans/MeshSmoothing.pyx":523
8437  * nElements=nElements)
8438  *
8439  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
8440  * double[:] nB,
8441  * double[:] nC):
8442  */
8443 
8444 /* Python wrapper */
8445 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_45getElementVolumeTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8446 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_45getElementVolumeTriangle = {"getElementVolumeTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_45getElementVolumeTriangle, METH_VARARGS|METH_KEYWORDS, 0};
8447 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_45getElementVolumeTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8448  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
8449  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
8450  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
8451  int __pyx_lineno = 0;
8452  const char *__pyx_filename = NULL;
8453  int __pyx_clineno = 0;
8454  PyObject *__pyx_r = 0;
8455  __Pyx_RefNannyDeclarations
8456  __Pyx_RefNannySetupContext("getElementVolumeTriangle (wrapper)", 0);
8457  {
8458  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nA,&__pyx_n_s_nB,&__pyx_n_s_nC,0};
8459  PyObject* values[3] = {0,0,0};
8460  if (unlikely(__pyx_kwds)) {
8461  Py_ssize_t kw_args;
8462  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8463  switch (pos_args) {
8464  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8465  CYTHON_FALLTHROUGH;
8466  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8467  CYTHON_FALLTHROUGH;
8468  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8469  CYTHON_FALLTHROUGH;
8470  case 0: break;
8471  default: goto __pyx_L5_argtuple_error;
8472  }
8473  kw_args = PyDict_Size(__pyx_kwds);
8474  switch (pos_args) {
8475  case 0:
8476  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nA)) != 0)) kw_args--;
8477  else goto __pyx_L5_argtuple_error;
8478  CYTHON_FALLTHROUGH;
8479  case 1:
8480  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nB)) != 0)) kw_args--;
8481  else {
8482  __Pyx_RaiseArgtupleInvalid("getElementVolumeTriangle", 1, 3, 3, 1); __PYX_ERR(0, 523, __pyx_L3_error)
8483  }
8484  CYTHON_FALLTHROUGH;
8485  case 2:
8486  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nC)) != 0)) kw_args--;
8487  else {
8488  __Pyx_RaiseArgtupleInvalid("getElementVolumeTriangle", 1, 3, 3, 2); __PYX_ERR(0, 523, __pyx_L3_error)
8489  }
8490  }
8491  if (unlikely(kw_args > 0)) {
8492  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getElementVolumeTriangle") < 0)) __PYX_ERR(0, 523, __pyx_L3_error)
8493  }
8494  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
8495  goto __pyx_L5_argtuple_error;
8496  } else {
8497  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8498  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8499  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8500  }
8501  __pyx_v_nA = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nA.memview)) __PYX_ERR(0, 523, __pyx_L3_error)
8502  __pyx_v_nB = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nB.memview)) __PYX_ERR(0, 524, __pyx_L3_error)
8503  __pyx_v_nC = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nC.memview)) __PYX_ERR(0, 525, __pyx_L3_error)
8504  }
8505  goto __pyx_L4_argument_unpacking_done;
8506  __pyx_L5_argtuple_error:;
8507  __Pyx_RaiseArgtupleInvalid("getElementVolumeTriangle", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 523, __pyx_L3_error)
8508  __pyx_L3_error:;
8509  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementVolumeTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8510  __Pyx_RefNannyFinishContext();
8511  return NULL;
8512  __pyx_L4_argument_unpacking_done:;
8513  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_44getElementVolumeTriangle(__pyx_self, __pyx_v_nA, __pyx_v_nB, __pyx_v_nC);
8514 
8515  /* function exit code */
8516  __Pyx_RefNannyFinishContext();
8517  return __pyx_r;
8518 }
8519 
8520 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_44getElementVolumeTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nA, __Pyx_memviewslice __pyx_v_nB, __Pyx_memviewslice __pyx_v_nC) {
8521  PyObject *__pyx_r = NULL;
8522  __Pyx_RefNannyDeclarations
8523  PyObject *__pyx_t_1 = NULL;
8524  int __pyx_lineno = 0;
8525  const char *__pyx_filename = NULL;
8526  int __pyx_clineno = 0;
8527  __Pyx_RefNannySetupContext("getElementVolumeTriangle", 0);
8528 
8529  /* "mprans/MeshSmoothing.pyx":526
8530  * double[:] nB,
8531  * double[:] nC):
8532  * return cyGetElementVolumeTriangle(nA=nA, # <<<<<<<<<<<<<<
8533  * nB=nB,
8534  * nC=nC)
8535  */
8536  __Pyx_XDECREF(__pyx_r);
8537 
8538  /* "mprans/MeshSmoothing.pyx":528
8539  * return cyGetElementVolumeTriangle(nA=nA,
8540  * nB=nB,
8541  * nC=nC) # <<<<<<<<<<<<<<
8542  *
8543  * def updateElementVolumesTetra(double[:] elementVolumesArray_,
8544  */
8545  __pyx_t_1 = PyFloat_FromDouble(__pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__pyx_v_nA, __pyx_v_nB, __pyx_v_nC)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
8546  __Pyx_GOTREF(__pyx_t_1);
8547  __pyx_r = __pyx_t_1;
8548  __pyx_t_1 = 0;
8549  goto __pyx_L0;
8550 
8551  /* "mprans/MeshSmoothing.pyx":523
8552  * nElements=nElements)
8553  *
8554  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
8555  * double[:] nB,
8556  * double[:] nC):
8557  */
8558 
8559  /* function exit code */
8560  __pyx_L1_error:;
8561  __Pyx_XDECREF(__pyx_t_1);
8562  __Pyx_AddTraceback("mprans.MeshSmoothing.getElementVolumeTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8563  __pyx_r = NULL;
8564  __pyx_L0:;
8565  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
8566  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
8567  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
8568  __Pyx_XGIVEREF(__pyx_r);
8569  __Pyx_RefNannyFinishContext();
8570  return __pyx_r;
8571 }
8572 
8573 /* "mprans/MeshSmoothing.pyx":530
8574  * nC=nC)
8575  *
8576  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8577  * int[:,:] elementNodesArray,
8578  * double[:,:] nodeArray,
8579  */
8580 
8581 /* Python wrapper */
8582 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_47updateElementVolumesTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8583 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_47updateElementVolumesTetra = {"updateElementVolumesTetra", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_47updateElementVolumesTetra, METH_VARARGS|METH_KEYWORDS, 0};
8584 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_47updateElementVolumesTetra(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8585  __Pyx_memviewslice __pyx_v_elementVolumesArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
8586  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8587  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8588  int __pyx_v_nElements;
8589  int __pyx_lineno = 0;
8590  const char *__pyx_filename = NULL;
8591  int __pyx_clineno = 0;
8592  PyObject *__pyx_r = 0;
8593  __Pyx_RefNannyDeclarations
8594  __Pyx_RefNannySetupContext("updateElementVolumesTetra (wrapper)", 0);
8595  {
8596  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementVolumesArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nElements,0};
8597  PyObject* values[4] = {0,0,0,0};
8598  if (unlikely(__pyx_kwds)) {
8599  Py_ssize_t kw_args;
8600  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8601  switch (pos_args) {
8602  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8603  CYTHON_FALLTHROUGH;
8604  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8605  CYTHON_FALLTHROUGH;
8606  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8607  CYTHON_FALLTHROUGH;
8608  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8609  CYTHON_FALLTHROUGH;
8610  case 0: break;
8611  default: goto __pyx_L5_argtuple_error;
8612  }
8613  kw_args = PyDict_Size(__pyx_kwds);
8614  switch (pos_args) {
8615  case 0:
8616  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementVolumesArray_2)) != 0)) kw_args--;
8617  else goto __pyx_L5_argtuple_error;
8618  CYTHON_FALLTHROUGH;
8619  case 1:
8620  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
8621  else {
8622  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, 1); __PYX_ERR(0, 530, __pyx_L3_error)
8623  }
8624  CYTHON_FALLTHROUGH;
8625  case 2:
8626  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8627  else {
8628  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, 2); __PYX_ERR(0, 530, __pyx_L3_error)
8629  }
8630  CYTHON_FALLTHROUGH;
8631  case 3:
8632  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
8633  else {
8634  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, 3); __PYX_ERR(0, 530, __pyx_L3_error)
8635  }
8636  }
8637  if (unlikely(kw_args > 0)) {
8638  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementVolumesTetra") < 0)) __PYX_ERR(0, 530, __pyx_L3_error)
8639  }
8640  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8641  goto __pyx_L5_argtuple_error;
8642  } else {
8643  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8644  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8645  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8646  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8647  }
8648  __pyx_v_elementVolumesArray_ = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementVolumesArray_.memview)) __PYX_ERR(0, 530, __pyx_L3_error)
8649  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 531, __pyx_L3_error)
8650  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 532, __pyx_L3_error)
8651  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L3_error)
8652  }
8653  goto __pyx_L4_argument_unpacking_done;
8654  __pyx_L5_argtuple_error:;
8655  __Pyx_RaiseArgtupleInvalid("updateElementVolumesTetra", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 530, __pyx_L3_error)
8656  __pyx_L3_error:;
8657  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementVolumesTetra", __pyx_clineno, __pyx_lineno, __pyx_filename);
8658  __Pyx_RefNannyFinishContext();
8659  return NULL;
8660  __pyx_L4_argument_unpacking_done:;
8661  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_46updateElementVolumesTetra(__pyx_self, __pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8662 
8663  /* function exit code */
8664  __Pyx_RefNannyFinishContext();
8665  return __pyx_r;
8666 }
8667 
8668 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_46updateElementVolumesTetra(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
8669  PyObject *__pyx_r = NULL;
8670  __Pyx_RefNannyDeclarations
8671  __Pyx_RefNannySetupContext("updateElementVolumesTetra", 0);
8672 
8673  /* "mprans/MeshSmoothing.pyx":534
8674  * double[:,:] nodeArray,
8675  * int nElements):
8676  * cyUpdateElementVolumesTetra(elementVolumesArray_=elementVolumesArray_, # <<<<<<<<<<<<<<
8677  * elementNodesArray=elementNodesArray,
8678  * nodeArray=nodeArray,
8679  */
8680  __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra(__pyx_v_elementVolumesArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8681 
8682  /* "mprans/MeshSmoothing.pyx":530
8683  * nC=nC)
8684  *
8685  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
8686  * int[:,:] elementNodesArray,
8687  * double[:,:] nodeArray,
8688  */
8689 
8690  /* function exit code */
8691  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8692  __PYX_XDEC_MEMVIEW(&__pyx_v_elementVolumesArray_, 1);
8693  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
8694  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8695  __Pyx_XGIVEREF(__pyx_r);
8696  __Pyx_RefNannyFinishContext();
8697  return __pyx_r;
8698 }
8699 
8700 /* "mprans/MeshSmoothing.pyx":539
8701  * nElements=nElements)
8702  *
8703  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
8704  * int[:,:] elementNodesArray,
8705  * double[:,:] nodeArray,
8706  */
8707 
8708 /* Python wrapper */
8709 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_49updateElementBarycenters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8710 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_49updateElementBarycenters = {"updateElementBarycenters", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_49updateElementBarycenters, METH_VARARGS|METH_KEYWORDS, 0};
8711 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_49updateElementBarycenters(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8712  __Pyx_memviewslice __pyx_v_elementBarycentersArray_ = { 0, 0, { 0 }, { 0 }, { 0 } };
8713  __Pyx_memviewslice __pyx_v_elementNodesArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8714  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8715  int __pyx_v_nElements;
8716  int __pyx_lineno = 0;
8717  const char *__pyx_filename = NULL;
8718  int __pyx_clineno = 0;
8719  PyObject *__pyx_r = 0;
8720  __Pyx_RefNannyDeclarations
8721  __Pyx_RefNannySetupContext("updateElementBarycenters (wrapper)", 0);
8722  {
8723  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_elementBarycentersArray_2,&__pyx_n_s_elementNodesArray,&__pyx_n_s_nodeArray_2,&__pyx_n_s_nElements,0};
8724  PyObject* values[4] = {0,0,0,0};
8725  if (unlikely(__pyx_kwds)) {
8726  Py_ssize_t kw_args;
8727  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8728  switch (pos_args) {
8729  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8730  CYTHON_FALLTHROUGH;
8731  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8732  CYTHON_FALLTHROUGH;
8733  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8734  CYTHON_FALLTHROUGH;
8735  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8736  CYTHON_FALLTHROUGH;
8737  case 0: break;
8738  default: goto __pyx_L5_argtuple_error;
8739  }
8740  kw_args = PyDict_Size(__pyx_kwds);
8741  switch (pos_args) {
8742  case 0:
8743  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementBarycentersArray_2)) != 0)) kw_args--;
8744  else goto __pyx_L5_argtuple_error;
8745  CYTHON_FALLTHROUGH;
8746  case 1:
8747  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_elementNodesArray)) != 0)) kw_args--;
8748  else {
8749  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, 1); __PYX_ERR(0, 539, __pyx_L3_error)
8750  }
8751  CYTHON_FALLTHROUGH;
8752  case 2:
8753  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8754  else {
8755  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, 2); __PYX_ERR(0, 539, __pyx_L3_error)
8756  }
8757  CYTHON_FALLTHROUGH;
8758  case 3:
8759  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nElements)) != 0)) kw_args--;
8760  else {
8761  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, 3); __PYX_ERR(0, 539, __pyx_L3_error)
8762  }
8763  }
8764  if (unlikely(kw_args > 0)) {
8765  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "updateElementBarycenters") < 0)) __PYX_ERR(0, 539, __pyx_L3_error)
8766  }
8767  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
8768  goto __pyx_L5_argtuple_error;
8769  } else {
8770  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8771  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8772  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8773  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8774  }
8775  __pyx_v_elementBarycentersArray_ = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementBarycentersArray_.memview)) __PYX_ERR(0, 539, __pyx_L3_error)
8776  __pyx_v_elementNodesArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_elementNodesArray.memview)) __PYX_ERR(0, 540, __pyx_L3_error)
8777  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 541, __pyx_L3_error)
8778  __pyx_v_nElements = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_nElements == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L3_error)
8779  }
8780  goto __pyx_L4_argument_unpacking_done;
8781  __pyx_L5_argtuple_error:;
8782  __Pyx_RaiseArgtupleInvalid("updateElementBarycenters", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 539, __pyx_L3_error)
8783  __pyx_L3_error:;
8784  __Pyx_AddTraceback("mprans.MeshSmoothing.updateElementBarycenters", __pyx_clineno, __pyx_lineno, __pyx_filename);
8785  __Pyx_RefNannyFinishContext();
8786  return NULL;
8787  __pyx_L4_argument_unpacking_done:;
8788  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_48updateElementBarycenters(__pyx_self, __pyx_v_elementBarycentersArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8789 
8790  /* function exit code */
8791  __Pyx_RefNannyFinishContext();
8792  return __pyx_r;
8793 }
8794 
8795 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_48updateElementBarycenters(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_elementBarycentersArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
8796  PyObject *__pyx_r = NULL;
8797  __Pyx_RefNannyDeclarations
8798  __Pyx_RefNannySetupContext("updateElementBarycenters", 0);
8799 
8800  /* "mprans/MeshSmoothing.pyx":543
8801  * double[:,:] nodeArray,
8802  * int nElements):
8803  * cyUpdateElementBarycenters(elementBarycentersArray_=elementBarycentersArray_, # <<<<<<<<<<<<<<
8804  * elementNodesArray=elementNodesArray,
8805  * nodeArray=nodeArray,
8806  */
8807  __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters(__pyx_v_elementBarycentersArray_, __pyx_v_elementNodesArray, __pyx_v_nodeArray, __pyx_v_nElements);
8808 
8809  /* "mprans/MeshSmoothing.pyx":539
8810  * nElements=nElements)
8811  *
8812  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
8813  * int[:,:] elementNodesArray,
8814  * double[:,:] nodeArray,
8815  */
8816 
8817  /* function exit code */
8818  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8819  __PYX_XDEC_MEMVIEW(&__pyx_v_elementBarycentersArray_, 1);
8820  __PYX_XDEC_MEMVIEW(&__pyx_v_elementNodesArray, 1);
8821  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8822  __Pyx_XGIVEREF(__pyx_r);
8823  __Pyx_RefNannyFinishContext();
8824  return __pyx_r;
8825 }
8826 
8827 /* "mprans/MeshSmoothing.pyx":548
8828  * nElements=nElements)
8829  *
8830  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8831  * int[:] nodeStarArray,
8832  * int[:] nodeStarOffsets,
8833  */
8834 
8835 /* Python wrapper */
8836 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_51getCornerNodesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8837 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_51getCornerNodesTriangle = {"getCornerNodesTriangle", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_51getCornerNodesTriangle, METH_VARARGS|METH_KEYWORDS, 0};
8838 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_51getCornerNodesTriangle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8839  __Pyx_memviewslice __pyx_v_nodeArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8840  __Pyx_memviewslice __pyx_v_nodeStarArray = { 0, 0, { 0 }, { 0 }, { 0 } };
8841  __Pyx_memviewslice __pyx_v_nodeStarOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
8842  __Pyx_memviewslice __pyx_v_nodeMaterialTypes = { 0, 0, { 0 }, { 0 }, { 0 } };
8843  int __pyx_v_nNodes;
8844  int __pyx_lineno = 0;
8845  const char *__pyx_filename = NULL;
8846  int __pyx_clineno = 0;
8847  PyObject *__pyx_r = 0;
8848  __Pyx_RefNannyDeclarations
8849  __Pyx_RefNannySetupContext("getCornerNodesTriangle (wrapper)", 0);
8850  {
8851  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nodeArray_2,&__pyx_n_s_nodeStarArray,&__pyx_n_s_nodeStarOffsets,&__pyx_n_s_nodeMaterialTypes,&__pyx_n_s_nNodes,0};
8852  PyObject* values[5] = {0,0,0,0,0};
8853  if (unlikely(__pyx_kwds)) {
8854  Py_ssize_t kw_args;
8855  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8856  switch (pos_args) {
8857  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8858  CYTHON_FALLTHROUGH;
8859  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8860  CYTHON_FALLTHROUGH;
8861  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8862  CYTHON_FALLTHROUGH;
8863  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8864  CYTHON_FALLTHROUGH;
8865  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8866  CYTHON_FALLTHROUGH;
8867  case 0: break;
8868  default: goto __pyx_L5_argtuple_error;
8869  }
8870  kw_args = PyDict_Size(__pyx_kwds);
8871  switch (pos_args) {
8872  case 0:
8873  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeArray_2)) != 0)) kw_args--;
8874  else goto __pyx_L5_argtuple_error;
8875  CYTHON_FALLTHROUGH;
8876  case 1:
8877  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarArray)) != 0)) kw_args--;
8878  else {
8879  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 1); __PYX_ERR(0, 548, __pyx_L3_error)
8880  }
8881  CYTHON_FALLTHROUGH;
8882  case 2:
8883  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeStarOffsets)) != 0)) kw_args--;
8884  else {
8885  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 2); __PYX_ERR(0, 548, __pyx_L3_error)
8886  }
8887  CYTHON_FALLTHROUGH;
8888  case 3:
8889  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeMaterialTypes)) != 0)) kw_args--;
8890  else {
8891  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 3); __PYX_ERR(0, 548, __pyx_L3_error)
8892  }
8893  CYTHON_FALLTHROUGH;
8894  case 4:
8895  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes)) != 0)) kw_args--;
8896  else {
8897  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, 4); __PYX_ERR(0, 548, __pyx_L3_error)
8898  }
8899  }
8900  if (unlikely(kw_args > 0)) {
8901  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCornerNodesTriangle") < 0)) __PYX_ERR(0, 548, __pyx_L3_error)
8902  }
8903  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
8904  goto __pyx_L5_argtuple_error;
8905  } else {
8906  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8907  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8908  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8909  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8910  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8911  }
8912  __pyx_v_nodeArray = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeArray.memview)) __PYX_ERR(0, 548, __pyx_L3_error)
8913  __pyx_v_nodeStarArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarArray.memview)) __PYX_ERR(0, 549, __pyx_L3_error)
8914  __pyx_v_nodeStarOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeStarOffsets.memview)) __PYX_ERR(0, 550, __pyx_L3_error)
8915  __pyx_v_nodeMaterialTypes = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeMaterialTypes.memview)) __PYX_ERR(0, 551, __pyx_L3_error)
8916  __pyx_v_nNodes = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nNodes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 552, __pyx_L3_error)
8917  }
8918  goto __pyx_L4_argument_unpacking_done;
8919  __pyx_L5_argtuple_error:;
8920  __Pyx_RaiseArgtupleInvalid("getCornerNodesTriangle", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 548, __pyx_L3_error)
8921  __pyx_L3_error:;
8922  __Pyx_AddTraceback("mprans.MeshSmoothing.getCornerNodesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8923  __Pyx_RefNannyFinishContext();
8924  return NULL;
8925  __pyx_L4_argument_unpacking_done:;
8926  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_50getCornerNodesTriangle(__pyx_self, __pyx_v_nodeArray, __pyx_v_nodeStarArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes);
8927 
8928  /* function exit code */
8929  __Pyx_RefNannyFinishContext();
8930  return __pyx_r;
8931 }
8932 
8933 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_50getCornerNodesTriangle(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes) {
8934  PyObject *__pyx_r = NULL;
8935  __Pyx_RefNannyDeclarations
8936  PyObject *__pyx_t_1 = NULL;
8937  int __pyx_lineno = 0;
8938  const char *__pyx_filename = NULL;
8939  int __pyx_clineno = 0;
8940  __Pyx_RefNannySetupContext("getCornerNodesTriangle", 0);
8941 
8942  /* "mprans/MeshSmoothing.pyx":553
8943  * int[:] nodeMaterialTypes,
8944  * int nNodes):
8945  * return cyGetCornerNodesTriangle(nodeArray=nodeArray, # <<<<<<<<<<<<<<
8946  * nodeStarArray=nodeStarArray,
8947  * nodeStarOffsets=nodeStarOffsets,
8948  */
8949  __Pyx_XDECREF(__pyx_r);
8950 
8951  /* "mprans/MeshSmoothing.pyx":557
8952  * nodeStarOffsets=nodeStarOffsets,
8953  * nodeMaterialTypes=nodeMaterialTypes,
8954  * nNodes=nNodes) # <<<<<<<<<<<<<<
8955  *
8956  * def getNonOwnedNodeValues(args_,
8957  */
8958  __pyx_t_1 = ((PyObject *)__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle(__pyx_v_nodeArray, __pyx_v_nodeStarArray, __pyx_v_nodeStarOffsets, __pyx_v_nodeMaterialTypes, __pyx_v_nNodes)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 553, __pyx_L1_error)
8959  __Pyx_GOTREF(__pyx_t_1);
8960  __pyx_r = __pyx_t_1;
8961  __pyx_t_1 = 0;
8962  goto __pyx_L0;
8963 
8964  /* "mprans/MeshSmoothing.pyx":548
8965  * nElements=nElements)
8966  *
8967  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
8968  * int[:] nodeStarArray,
8969  * int[:] nodeStarOffsets,
8970  */
8971 
8972  /* function exit code */
8973  __pyx_L1_error:;
8974  __Pyx_XDECREF(__pyx_t_1);
8975  __Pyx_AddTraceback("mprans.MeshSmoothing.getCornerNodesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
8976  __pyx_r = NULL;
8977  __pyx_L0:;
8978  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray, 1);
8979  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarArray, 1);
8980  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeStarOffsets, 1);
8981  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeMaterialTypes, 1);
8982  __Pyx_XGIVEREF(__pyx_r);
8983  __Pyx_RefNannyFinishContext();
8984  return __pyx_r;
8985 }
8986 
8987 /* "mprans/MeshSmoothing.pyx":559
8988  * nNodes=nNodes)
8989  *
8990  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
8991  * int nNodes_owned,
8992  * int nNodes_global,
8993  */
8994 
8995 /* Python wrapper */
8996 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_53getNonOwnedNodeValues(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8997 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_53getNonOwnedNodeValues = {"getNonOwnedNodeValues", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_53getNonOwnedNodeValues, METH_VARARGS|METH_KEYWORDS, 0};
8998 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_53getNonOwnedNodeValues(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8999  PyObject *__pyx_v_args_ = 0;
9000  int __pyx_v_nNodes_owned;
9001  int __pyx_v_nNodes_global;
9002  __Pyx_memviewslice __pyx_v_nodeNumbering_subdomain2global = { 0, 0, { 0 }, { 0 }, { 0 } };
9003  __Pyx_memviewslice __pyx_v_nodeOffsets_subdomain_owned = { 0, 0, { 0 }, { 0 }, { 0 } };
9004  int __pyx_lineno = 0;
9005  const char *__pyx_filename = NULL;
9006  int __pyx_clineno = 0;
9007  PyObject *__pyx_r = 0;
9008  __Pyx_RefNannyDeclarations
9009  __Pyx_RefNannySetupContext("getNonOwnedNodeValues (wrapper)", 0);
9010  {
9011  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_args,&__pyx_n_s_nNodes_owned,&__pyx_n_s_nNodes_global,&__pyx_n_s_nodeNumbering_subdomain2global,&__pyx_n_s_nodeOffsets_subdomain_owned,0};
9012  PyObject* values[5] = {0,0,0,0,0};
9013  if (unlikely(__pyx_kwds)) {
9014  Py_ssize_t kw_args;
9015  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9016  switch (pos_args) {
9017  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9018  CYTHON_FALLTHROUGH;
9019  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9020  CYTHON_FALLTHROUGH;
9021  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9022  CYTHON_FALLTHROUGH;
9023  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9024  CYTHON_FALLTHROUGH;
9025  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9026  CYTHON_FALLTHROUGH;
9027  case 0: break;
9028  default: goto __pyx_L5_argtuple_error;
9029  }
9030  kw_args = PyDict_Size(__pyx_kwds);
9031  switch (pos_args) {
9032  case 0:
9033  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--;
9034  else goto __pyx_L5_argtuple_error;
9035  CYTHON_FALLTHROUGH;
9036  case 1:
9037  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_owned)) != 0)) kw_args--;
9038  else {
9039  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 1); __PYX_ERR(0, 559, __pyx_L3_error)
9040  }
9041  CYTHON_FALLTHROUGH;
9042  case 2:
9043  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes_global)) != 0)) kw_args--;
9044  else {
9045  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 2); __PYX_ERR(0, 559, __pyx_L3_error)
9046  }
9047  CYTHON_FALLTHROUGH;
9048  case 3:
9049  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeNumbering_subdomain2global)) != 0)) kw_args--;
9050  else {
9051  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 3); __PYX_ERR(0, 559, __pyx_L3_error)
9052  }
9053  CYTHON_FALLTHROUGH;
9054  case 4:
9055  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeOffsets_subdomain_owned)) != 0)) kw_args--;
9056  else {
9057  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, 4); __PYX_ERR(0, 559, __pyx_L3_error)
9058  }
9059  }
9060  if (unlikely(kw_args > 0)) {
9061  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getNonOwnedNodeValues") < 0)) __PYX_ERR(0, 559, __pyx_L3_error)
9062  }
9063  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
9064  goto __pyx_L5_argtuple_error;
9065  } else {
9066  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9067  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9068  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9069  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9070  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9071  }
9072  __pyx_v_args_ = values[0];
9073  __pyx_v_nNodes_owned = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_nNodes_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 560, __pyx_L3_error)
9074  __pyx_v_nNodes_global = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nNodes_global == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 561, __pyx_L3_error)
9075  __pyx_v_nodeNumbering_subdomain2global = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeNumbering_subdomain2global.memview)) __PYX_ERR(0, 562, __pyx_L3_error)
9076  __pyx_v_nodeOffsets_subdomain_owned = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeOffsets_subdomain_owned.memview)) __PYX_ERR(0, 563, __pyx_L3_error)
9077  }
9078  goto __pyx_L4_argument_unpacking_done;
9079  __pyx_L5_argtuple_error:;
9080  __Pyx_RaiseArgtupleInvalid("getNonOwnedNodeValues", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 559, __pyx_L3_error)
9081  __pyx_L3_error:;
9082  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
9083  __Pyx_RefNannyFinishContext();
9084  return NULL;
9085  __pyx_L4_argument_unpacking_done:;
9086  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_52getNonOwnedNodeValues(__pyx_self, __pyx_v_args_, __pyx_v_nNodes_owned, __pyx_v_nNodes_global, __pyx_v_nodeNumbering_subdomain2global, __pyx_v_nodeOffsets_subdomain_owned);
9087 
9088  /* function exit code */
9089  __Pyx_RefNannyFinishContext();
9090  return __pyx_r;
9091 }
9092 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
9093 
9094 /* "mprans/MeshSmoothing.pyx":625
9095  * comm.Gatherv(my_size,
9096  * [counts_in,
9097  * tuple(1 for i in range(comm_size)), # <<<<<<<<<<<<<<
9098  * tuple(i for i in range(comm_size)),
9099  * MPI.INT],
9100  */
9101 
9102 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_genexpr(PyObject *__pyx_self) {
9103  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
9104  PyObject *__pyx_r = NULL;
9105  __Pyx_RefNannyDeclarations
9106  int __pyx_lineno = 0;
9107  const char *__pyx_filename = NULL;
9108  int __pyx_clineno = 0;
9109  __Pyx_RefNannySetupContext("genexpr", 0);
9110  __pyx_cur_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL);
9111  if (unlikely(!__pyx_cur_scope)) {
9112  __pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)Py_None);
9113  __Pyx_INCREF(Py_None);
9114  __PYX_ERR(0, 625, __pyx_L1_error)
9115  } else {
9116  __Pyx_GOTREF(__pyx_cur_scope);
9117  }
9118  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *) __pyx_self;
9119  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
9120  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
9121  {
9122  __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_getNonOwnedNodeValues_locals_gen, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!gen)) __PYX_ERR(0, 625, __pyx_L1_error)
9123  __Pyx_DECREF(__pyx_cur_scope);
9124  __Pyx_RefNannyFinishContext();
9125  return (PyObject *) gen;
9126  }
9127 
9128  /* function exit code */
9129  __pyx_L1_error:;
9130  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9131  __pyx_r = NULL;
9132  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
9133  __Pyx_XGIVEREF(__pyx_r);
9134  __Pyx_RefNannyFinishContext();
9135  return __pyx_r;
9136 }
9137 
9138 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
9139 {
9140  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
9141  PyObject *__pyx_r = NULL;
9142  int __pyx_t_1;
9143  int __pyx_t_2;
9144  int __pyx_t_3;
9145  int __pyx_lineno = 0;
9146  const char *__pyx_filename = NULL;
9147  int __pyx_clineno = 0;
9148  __Pyx_RefNannyDeclarations
9149  __Pyx_RefNannySetupContext("genexpr", 0);
9150  switch (__pyx_generator->resume_label) {
9151  case 0: goto __pyx_L3_first_run;
9152  case 1: goto __pyx_L6_resume_from_yield;
9153  default: /* CPython raises the right error here */
9154  __Pyx_RefNannyFinishContext();
9155  return NULL;
9156  }
9157  __pyx_L3_first_run:;
9158  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 625, __pyx_L1_error)
9159  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_comm_size;
9160  __pyx_t_2 = __pyx_t_1;
9161  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
9162  __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
9163  __Pyx_INCREF(__pyx_int_1);
9164  __pyx_r = __pyx_int_1;
9165  __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
9166  __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
9167  __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
9168  __Pyx_XGIVEREF(__pyx_r);
9169  __Pyx_RefNannyFinishContext();
9170  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9171  /* return from generator, yielding value */
9172  __pyx_generator->resume_label = 1;
9173  return __pyx_r;
9174  __pyx_L6_resume_from_yield:;
9175  __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
9176  __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
9177  __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
9178  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 625, __pyx_L1_error)
9179  }
9180  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
9181 
9182  /* function exit code */
9183  PyErr_SetNone(PyExc_StopIteration);
9184  goto __pyx_L0;
9185  __pyx_L1_error:;
9186  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9187  __pyx_L0:;
9188  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
9189  #if !CYTHON_USE_EXC_INFO_STACK
9190  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9191  #endif
9192  __pyx_generator->resume_label = -1;
9193  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
9194  __Pyx_RefNannyFinishContext();
9195  return __pyx_r;
9196 }
9197 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */
9198 
9199 /* "mprans/MeshSmoothing.pyx":626
9200  * [counts_in,
9201  * tuple(1 for i in range(comm_size)),
9202  * tuple(i for i in range(comm_size)), # <<<<<<<<<<<<<<
9203  * MPI.INT],
9204  * root=rank_recv
9205  */
9206 
9207 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_3genexpr(PyObject *__pyx_self) {
9208  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
9209  PyObject *__pyx_r = NULL;
9210  __Pyx_RefNannyDeclarations
9211  int __pyx_lineno = 0;
9212  const char *__pyx_filename = NULL;
9213  int __pyx_clineno = 0;
9214  __Pyx_RefNannySetupContext("genexpr", 0);
9215  __pyx_cur_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL);
9216  if (unlikely(!__pyx_cur_scope)) {
9217  __pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)Py_None);
9218  __Pyx_INCREF(Py_None);
9219  __PYX_ERR(0, 626, __pyx_L1_error)
9220  } else {
9221  __Pyx_GOTREF(__pyx_cur_scope);
9222  }
9223  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *) __pyx_self;
9224  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope));
9225  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope);
9226  {
9227  __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1, NULL, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_getNonOwnedNodeValues_locals_gen, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!gen)) __PYX_ERR(0, 626, __pyx_L1_error)
9228  __Pyx_DECREF(__pyx_cur_scope);
9229  __Pyx_RefNannyFinishContext();
9230  return (PyObject *) gen;
9231  }
9232 
9233  /* function exit code */
9234  __pyx_L1_error:;
9235  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9236  __pyx_r = NULL;
9237  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
9238  __Pyx_XGIVEREF(__pyx_r);
9239  __Pyx_RefNannyFinishContext();
9240  return __pyx_r;
9241 }
9242 
9243 static PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
9244 {
9245  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
9246  PyObject *__pyx_r = NULL;
9247  int __pyx_t_1;
9248  int __pyx_t_2;
9249  int __pyx_t_3;
9250  PyObject *__pyx_t_4 = NULL;
9251  int __pyx_lineno = 0;
9252  const char *__pyx_filename = NULL;
9253  int __pyx_clineno = 0;
9254  __Pyx_RefNannyDeclarations
9255  __Pyx_RefNannySetupContext("genexpr", 0);
9256  switch (__pyx_generator->resume_label) {
9257  case 0: goto __pyx_L3_first_run;
9258  case 1: goto __pyx_L6_resume_from_yield;
9259  default: /* CPython raises the right error here */
9260  __Pyx_RefNannyFinishContext();
9261  return NULL;
9262  }
9263  __pyx_L3_first_run:;
9264  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 626, __pyx_L1_error)
9265  __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_comm_size;
9266  __pyx_t_2 = __pyx_t_1;
9267  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
9268  __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
9269  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
9270  __Pyx_GOTREF(__pyx_t_4);
9271  __pyx_r = __pyx_t_4;
9272  __pyx_t_4 = 0;
9273  __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
9274  __pyx_cur_scope->__pyx_t_1 = __pyx_t_2;
9275  __pyx_cur_scope->__pyx_t_2 = __pyx_t_3;
9276  __Pyx_XGIVEREF(__pyx_r);
9277  __Pyx_RefNannyFinishContext();
9278  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9279  /* return from generator, yielding value */
9280  __pyx_generator->resume_label = 1;
9281  return __pyx_r;
9282  __pyx_L6_resume_from_yield:;
9283  __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
9284  __pyx_t_2 = __pyx_cur_scope->__pyx_t_1;
9285  __pyx_t_3 = __pyx_cur_scope->__pyx_t_2;
9286  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 626, __pyx_L1_error)
9287  }
9288  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
9289 
9290  /* function exit code */
9291  PyErr_SetNone(PyExc_StopIteration);
9292  goto __pyx_L0;
9293  __pyx_L1_error:;
9294  __Pyx_XDECREF(__pyx_t_4);
9295  __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
9296  __pyx_L0:;
9297  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
9298  #if !CYTHON_USE_EXC_INFO_STACK
9299  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
9300  #endif
9301  __pyx_generator->resume_label = -1;
9302  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
9303  __Pyx_RefNannyFinishContext();
9304  return __pyx_r;
9305 }
9306 
9307 /* "mprans/MeshSmoothing.pyx":559
9308  * nNodes=nNodes)
9309  *
9310  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
9311  * int nNodes_owned,
9312  * int nNodes_global,
9313  */
9314 
9315 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_52getNonOwnedNodeValues(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_args_, int __pyx_v_nNodes_owned, int __pyx_v_nNodes_global, __Pyx_memviewslice __pyx_v_nodeNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_nodeOffsets_subdomain_owned) {
9316  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_cur_scope;
9317  PyObject *__pyx_v_Comm = NULL;
9318  PyObject *__pyx_v_comm = 0;
9319  int __pyx_v_my_rank;
9320  PyObject *__pyx_v_arg_2rank = 0;
9321  PyObject *__pyx_v_nodes_2rank = 0;
9322  __Pyx_memviewslice __pyx_v_result = { 0, 0, { 0 }, { 0 }, { 0 } };
9323  __Pyx_memviewslice __pyx_v_counts_in = { 0, 0, { 0 }, { 0 }, { 0 } };
9324  __Pyx_memviewslice __pyx_v_displacements_in = { 0, 0, { 0 }, { 0 }, { 0 } };
9325  __Pyx_memviewslice __pyx_v_counts_out = { 0, 0, { 0 }, { 0 }, { 0 } };
9326  __Pyx_memviewslice __pyx_v_displacements_out = { 0, 0, { 0 }, { 0 }, { 0 } };
9327  __Pyx_memviewslice __pyx_v_arg_shape = { 0, 0, { 0 }, { 0 }, { 0 } };
9328  __Pyx_memviewslice __pyx_v_arg_shape_copy = { 0, 0, { 0 }, { 0 }, { 0 } };
9329  int __pyx_v_arg_shape_len;
9330  int __pyx_v_shape_factor;
9331  int __pyx_v_disp;
9332  int __pyx_v_rank;
9333  int __pyx_v_rank_recv;
9334  int __pyx_v_ii;
9335  int __pyx_v_ir;
9336  int __pyx_v_iN;
9337  int __pyx_v_node_new_rank;
9338  int __pyx_v_new_rank;
9339  int __pyx_v_sumtot;
9340  __Pyx_memviewslice __pyx_v_nodes_2rank_values = { 0, 0, { 0 }, { 0 }, { 0 } };
9341  __Pyx_memviewslice __pyx_v_nodes_2doArray = { 0, 0, { 0 }, { 0 }, { 0 } };
9342  long __pyx_v_i;
9343  int __pyx_v_node;
9344  Py_ssize_t __pyx_v_nodes_2rank_len;
9345  PyObject *__pyx_v_array_size = NULL;
9346  PyObject *__pyx_v_my_size = NULL;
9347  PyObject *__pyx_v_arg_2rank_values = NULL;
9348  PyObject *__pyx_v_arg_2doArray = NULL;
9349  PyObject *__pyx_v_datatype = NULL;
9350  PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator = 0;
9351  PyObject *__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1 = 0;
9352  PyObject *__pyx_r = NULL;
9353  __Pyx_RefNannyDeclarations
9354  PyObject *__pyx_t_1 = NULL;
9355  PyObject *__pyx_t_2 = NULL;
9356  PyObject *__pyx_t_3 = NULL;
9357  PyObject *__pyx_t_4 = NULL;
9358  PyObject *__pyx_t_5 = NULL;
9359  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
9360  int __pyx_t_7;
9361  size_t __pyx_t_8;
9362  int __pyx_t_9;
9363  int __pyx_t_10;
9364  long __pyx_t_11;
9365  Py_ssize_t __pyx_t_12;
9366  int __pyx_t_13;
9367  int __pyx_t_14;
9368  PyObject *__pyx_t_15 = NULL;
9369  Py_ssize_t __pyx_t_16;
9370  Py_ssize_t __pyx_t_17;
9371  int __pyx_t_18;
9372  int __pyx_t_19;
9373  PyObject *__pyx_t_20 = NULL;
9374  int __pyx_t_21;
9375  int __pyx_t_22;
9376  int __pyx_t_23;
9377  int __pyx_lineno = 0;
9378  const char *__pyx_filename = NULL;
9379  int __pyx_clineno = 0;
9380  __Pyx_RefNannySetupContext("getNonOwnedNodeValues", 0);
9381  __pyx_cur_scope = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *)__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(__pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues, __pyx_empty_tuple, NULL);
9382  if (unlikely(!__pyx_cur_scope)) {
9383  __pyx_cur_scope = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *)Py_None);
9384  __Pyx_INCREF(Py_None);
9385  __PYX_ERR(0, 559, __pyx_L1_error)
9386  } else {
9387  __Pyx_GOTREF(__pyx_cur_scope);
9388  }
9389 
9390  /* "mprans/MeshSmoothing.pyx":564
9391  * int[:] nodeNumbering_subdomain2global,
9392  * int[:] nodeOffsets_subdomain_owned):
9393  * nodeNumbering_subdomain2global = np.array(nodeNumbering_subdomain2global, dtype=np.int32) # <<<<<<<<<<<<<<
9394  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32)
9395  * from proteus import Comm
9396  */
9397  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
9398  __Pyx_GOTREF(__pyx_t_1);
9399  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
9400  __Pyx_GOTREF(__pyx_t_2);
9401  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9402  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_nodeNumbering_subdomain2global, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
9403  __Pyx_GOTREF(__pyx_t_1);
9404  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
9405  __Pyx_GOTREF(__pyx_t_3);
9406  __Pyx_GIVEREF(__pyx_t_1);
9407  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
9408  __pyx_t_1 = 0;
9409  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
9410  __Pyx_GOTREF(__pyx_t_1);
9411  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error)
9412  __Pyx_GOTREF(__pyx_t_4);
9413  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
9414  __Pyx_GOTREF(__pyx_t_5);
9415  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9416  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
9417  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9418  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
9419  __Pyx_GOTREF(__pyx_t_5);
9420  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9421  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9422  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9423  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 564, __pyx_L1_error)
9424  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9425  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeNumbering_subdomain2global, 1);
9426  __pyx_v_nodeNumbering_subdomain2global = __pyx_t_6;
9427  __pyx_t_6.memview = NULL;
9428  __pyx_t_6.data = NULL;
9429 
9430  /* "mprans/MeshSmoothing.pyx":565
9431  * int[:] nodeOffsets_subdomain_owned):
9432  * nodeNumbering_subdomain2global = np.array(nodeNumbering_subdomain2global, dtype=np.int32)
9433  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32) # <<<<<<<<<<<<<<
9434  * from proteus import Comm
9435  * cdef object comm = Comm.get().comm.tompi4py()
9436  */
9437  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
9438  __Pyx_GOTREF(__pyx_t_5);
9439  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 565, __pyx_L1_error)
9440  __Pyx_GOTREF(__pyx_t_1);
9441  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9442  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_nodeOffsets_subdomain_owned, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
9443  __Pyx_GOTREF(__pyx_t_5);
9444  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 565, __pyx_L1_error)
9445  __Pyx_GOTREF(__pyx_t_3);
9446  __Pyx_GIVEREF(__pyx_t_5);
9447  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
9448  __pyx_t_5 = 0;
9449  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 565, __pyx_L1_error)
9450  __Pyx_GOTREF(__pyx_t_5);
9451  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 565, __pyx_L1_error)
9452  __Pyx_GOTREF(__pyx_t_2);
9453  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error)
9454  __Pyx_GOTREF(__pyx_t_4);
9455  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9456  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 565, __pyx_L1_error)
9457  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9458  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __pyx_L1_error)
9459  __Pyx_GOTREF(__pyx_t_4);
9460  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9461  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9462  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9463  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 565, __pyx_L1_error)
9464  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9465  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeOffsets_subdomain_owned, 1);
9466  __pyx_v_nodeOffsets_subdomain_owned = __pyx_t_6;
9467  __pyx_t_6.memview = NULL;
9468  __pyx_t_6.data = NULL;
9469 
9470  /* "mprans/MeshSmoothing.pyx":566
9471  * nodeNumbering_subdomain2global = np.array(nodeNumbering_subdomain2global, dtype=np.int32)
9472  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32)
9473  * from proteus import Comm # <<<<<<<<<<<<<<
9474  * cdef object comm = Comm.get().comm.tompi4py()
9475  * cdef int comm_size = comm.size
9476  */
9477  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error)
9478  __Pyx_GOTREF(__pyx_t_4);
9479  __Pyx_INCREF(__pyx_n_s_Comm);
9480  __Pyx_GIVEREF(__pyx_n_s_Comm);
9481  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_Comm);
9482  __pyx_t_5 = __Pyx_Import(__pyx_n_s_proteus, __pyx_t_4, -1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 566, __pyx_L1_error)
9483  __Pyx_GOTREF(__pyx_t_5);
9484  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9485  __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_Comm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 566, __pyx_L1_error)
9486  __Pyx_GOTREF(__pyx_t_4);
9487  __Pyx_INCREF(__pyx_t_4);
9488  __pyx_v_Comm = __pyx_t_4;
9489  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9490  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9491 
9492  /* "mprans/MeshSmoothing.pyx":567
9493  * nodeOffsets_subdomain_owned = np.array(nodeOffsets_subdomain_owned, dtype=np.int32)
9494  * from proteus import Comm
9495  * cdef object comm = Comm.get().comm.tompi4py() # <<<<<<<<<<<<<<
9496  * cdef int comm_size = comm.size
9497  * cdef int my_rank = comm.rank
9498  */
9499  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Comm, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
9500  __Pyx_GOTREF(__pyx_t_3);
9501  __pyx_t_1 = NULL;
9502  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
9503  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
9504  if (likely(__pyx_t_1)) {
9505  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
9506  __Pyx_INCREF(__pyx_t_1);
9507  __Pyx_INCREF(function);
9508  __Pyx_DECREF_SET(__pyx_t_3, function);
9509  }
9510  }
9511  __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
9512  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
9513  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 567, __pyx_L1_error)
9514  __Pyx_GOTREF(__pyx_t_4);
9515  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9516  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_comm); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 567, __pyx_L1_error)
9517  __Pyx_GOTREF(__pyx_t_3);
9518  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9519  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_tompi4py); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 567, __pyx_L1_error)
9520  __Pyx_GOTREF(__pyx_t_4);
9521  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9522  __pyx_t_3 = NULL;
9523  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
9524  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
9525  if (likely(__pyx_t_3)) {
9526  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9527  __Pyx_INCREF(__pyx_t_3);
9528  __Pyx_INCREF(function);
9529  __Pyx_DECREF_SET(__pyx_t_4, function);
9530  }
9531  }
9532  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
9533  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
9534  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 567, __pyx_L1_error)
9535  __Pyx_GOTREF(__pyx_t_5);
9536  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9537  __pyx_v_comm = __pyx_t_5;
9538  __pyx_t_5 = 0;
9539 
9540  /* "mprans/MeshSmoothing.pyx":568
9541  * from proteus import Comm
9542  * cdef object comm = Comm.get().comm.tompi4py()
9543  * cdef int comm_size = comm.size # <<<<<<<<<<<<<<
9544  * cdef int my_rank = comm.rank
9545  * cdef dict arg_2rank = {}
9546  */
9547  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 568, __pyx_L1_error)
9548  __Pyx_GOTREF(__pyx_t_5);
9549  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L1_error)
9550  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9551  __pyx_cur_scope->__pyx_v_comm_size = __pyx_t_7;
9552 
9553  /* "mprans/MeshSmoothing.pyx":569
9554  * cdef object comm = Comm.get().comm.tompi4py()
9555  * cdef int comm_size = comm.size
9556  * cdef int my_rank = comm.rank # <<<<<<<<<<<<<<
9557  * cdef dict arg_2rank = {}
9558  * cdef dict nodes_2rank = {}
9559  */
9560  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 569, __pyx_L1_error)
9561  __Pyx_GOTREF(__pyx_t_5);
9562  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 569, __pyx_L1_error)
9563  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9564  __pyx_v_my_rank = __pyx_t_7;
9565 
9566  /* "mprans/MeshSmoothing.pyx":570
9567  * cdef int comm_size = comm.size
9568  * cdef int my_rank = comm.rank
9569  * cdef dict arg_2rank = {} # <<<<<<<<<<<<<<
9570  * cdef dict nodes_2rank = {}
9571  * cdef int[:] result
9572  */
9573  __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 570, __pyx_L1_error)
9574  __Pyx_GOTREF(__pyx_t_5);
9575  __pyx_v_arg_2rank = ((PyObject*)__pyx_t_5);
9576  __pyx_t_5 = 0;
9577 
9578  /* "mprans/MeshSmoothing.pyx":571
9579  * cdef int my_rank = comm.rank
9580  * cdef dict arg_2rank = {}
9581  * cdef dict nodes_2rank = {} # <<<<<<<<<<<<<<
9582  * cdef int[:] result
9583  * # the counts and displacements for nodes coming in from other processors
9584  */
9585  __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 571, __pyx_L1_error)
9586  __Pyx_GOTREF(__pyx_t_5);
9587  __pyx_v_nodes_2rank = ((PyObject*)__pyx_t_5);
9588  __pyx_t_5 = 0;
9589 
9590  /* "mprans/MeshSmoothing.pyx":574
9591  * cdef int[:] result
9592  * # the counts and displacements for nodes coming in from other processors
9593  * cdef int[:] counts_in = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9594  * cdef int[:] displacements_in = np.zeros(comm_size, dtype=np.int32)
9595  * # the counts and displacements args_ coming back from other processors
9596  */
9597  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
9598  __Pyx_GOTREF(__pyx_t_5);
9599  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
9600  __Pyx_GOTREF(__pyx_t_4);
9601  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9602  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
9603  __Pyx_GOTREF(__pyx_t_5);
9604  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
9605  __Pyx_GOTREF(__pyx_t_3);
9606  __Pyx_GIVEREF(__pyx_t_5);
9607  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
9608  __pyx_t_5 = 0;
9609  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
9610  __Pyx_GOTREF(__pyx_t_5);
9611  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
9612  __Pyx_GOTREF(__pyx_t_1);
9613  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
9614  __Pyx_GOTREF(__pyx_t_2);
9615  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9616  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 574, __pyx_L1_error)
9617  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9618  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
9619  __Pyx_GOTREF(__pyx_t_2);
9620  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9621  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9622  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9623  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 574, __pyx_L1_error)
9624  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9625  __pyx_v_counts_in = __pyx_t_6;
9626  __pyx_t_6.memview = NULL;
9627  __pyx_t_6.data = NULL;
9628 
9629  /* "mprans/MeshSmoothing.pyx":575
9630  * # the counts and displacements for nodes coming in from other processors
9631  * cdef int[:] counts_in = np.zeros(comm_size, dtype=np.int32)
9632  * cdef int[:] displacements_in = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9633  * # the counts and displacements args_ coming back from other processors
9634  * cdef int[:] counts_out = np.zeros(comm_size, dtype=np.int32)
9635  */
9636  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
9637  __Pyx_GOTREF(__pyx_t_2);
9638  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 575, __pyx_L1_error)
9639  __Pyx_GOTREF(__pyx_t_5);
9640  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9641  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
9642  __Pyx_GOTREF(__pyx_t_2);
9643  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
9644  __Pyx_GOTREF(__pyx_t_3);
9645  __Pyx_GIVEREF(__pyx_t_2);
9646  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
9647  __pyx_t_2 = 0;
9648  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
9649  __Pyx_GOTREF(__pyx_t_2);
9650  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error)
9651  __Pyx_GOTREF(__pyx_t_4);
9652  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
9653  __Pyx_GOTREF(__pyx_t_1);
9654  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9655  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
9656  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9657  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
9658  __Pyx_GOTREF(__pyx_t_1);
9659  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9660  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9661  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9662  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 575, __pyx_L1_error)
9663  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9664  __pyx_v_displacements_in = __pyx_t_6;
9665  __pyx_t_6.memview = NULL;
9666  __pyx_t_6.data = NULL;
9667 
9668  /* "mprans/MeshSmoothing.pyx":577
9669  * cdef int[:] displacements_in = np.zeros(comm_size, dtype=np.int32)
9670  * # the counts and displacements args_ coming back from other processors
9671  * cdef int[:] counts_out = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9672  * cdef int[:] displacements_out = np.zeros(comm_size, dtype=np.int32)
9673  * # shape of the argument
9674  */
9675  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
9676  __Pyx_GOTREF(__pyx_t_1);
9677  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
9678  __Pyx_GOTREF(__pyx_t_2);
9679  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9680  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
9681  __Pyx_GOTREF(__pyx_t_1);
9682  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 577, __pyx_L1_error)
9683  __Pyx_GOTREF(__pyx_t_3);
9684  __Pyx_GIVEREF(__pyx_t_1);
9685  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
9686  __pyx_t_1 = 0;
9687  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 577, __pyx_L1_error)
9688  __Pyx_GOTREF(__pyx_t_1);
9689  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 577, __pyx_L1_error)
9690  __Pyx_GOTREF(__pyx_t_5);
9691  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
9692  __Pyx_GOTREF(__pyx_t_4);
9693  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9694  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 577, __pyx_L1_error)
9695  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9696  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
9697  __Pyx_GOTREF(__pyx_t_4);
9698  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9699  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9700  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9701  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 577, __pyx_L1_error)
9702  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9703  __pyx_v_counts_out = __pyx_t_6;
9704  __pyx_t_6.memview = NULL;
9705  __pyx_t_6.data = NULL;
9706 
9707  /* "mprans/MeshSmoothing.pyx":578
9708  * # the counts and displacements args_ coming back from other processors
9709  * cdef int[:] counts_out = np.zeros(comm_size, dtype=np.int32)
9710  * cdef int[:] displacements_out = np.zeros(comm_size, dtype=np.int32) # <<<<<<<<<<<<<<
9711  * # shape of the argument
9712  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32)
9713  */
9714  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
9715  __Pyx_GOTREF(__pyx_t_4);
9716  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 578, __pyx_L1_error)
9717  __Pyx_GOTREF(__pyx_t_1);
9718  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9719  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_cur_scope->__pyx_v_comm_size); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
9720  __Pyx_GOTREF(__pyx_t_4);
9721  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 578, __pyx_L1_error)
9722  __Pyx_GOTREF(__pyx_t_3);
9723  __Pyx_GIVEREF(__pyx_t_4);
9724  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
9725  __pyx_t_4 = 0;
9726  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 578, __pyx_L1_error)
9727  __Pyx_GOTREF(__pyx_t_4);
9728  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 578, __pyx_L1_error)
9729  __Pyx_GOTREF(__pyx_t_2);
9730  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error)
9731  __Pyx_GOTREF(__pyx_t_5);
9732  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9733  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 578, __pyx_L1_error)
9734  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9735  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 578, __pyx_L1_error)
9736  __Pyx_GOTREF(__pyx_t_5);
9737  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9738  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9739  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9740  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 578, __pyx_L1_error)
9741  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9742  __pyx_v_displacements_out = __pyx_t_6;
9743  __pyx_t_6.memview = NULL;
9744  __pyx_t_6.data = NULL;
9745 
9746  /* "mprans/MeshSmoothing.pyx":580
9747  * cdef int[:] displacements_out = np.zeros(comm_size, dtype=np.int32)
9748  * # shape of the argument
9749  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32) # <<<<<<<<<<<<<<
9750  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32)
9751  * cdef int arg_shape_len = len(arg_shape)
9752  */
9753  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
9754  __Pyx_GOTREF(__pyx_t_5);
9755  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 580, __pyx_L1_error)
9756  __Pyx_GOTREF(__pyx_t_4);
9757  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9758  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_args_, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
9759  __Pyx_GOTREF(__pyx_t_5);
9760  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 580, __pyx_L1_error)
9761  __Pyx_GOTREF(__pyx_t_3);
9762  __Pyx_GIVEREF(__pyx_t_5);
9763  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
9764  __pyx_t_5 = 0;
9765  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 580, __pyx_L1_error)
9766  __Pyx_GOTREF(__pyx_t_5);
9767  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 580, __pyx_L1_error)
9768  __Pyx_GOTREF(__pyx_t_1);
9769  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error)
9770  __Pyx_GOTREF(__pyx_t_2);
9771  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9772  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_2) < 0) __PYX_ERR(0, 580, __pyx_L1_error)
9773  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9774  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 580, __pyx_L1_error)
9775  __Pyx_GOTREF(__pyx_t_2);
9776  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9777  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9778  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9779  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_2, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 580, __pyx_L1_error)
9780  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9781  __pyx_v_arg_shape = __pyx_t_6;
9782  __pyx_t_6.memview = NULL;
9783  __pyx_t_6.data = NULL;
9784 
9785  /* "mprans/MeshSmoothing.pyx":581
9786  * # shape of the argument
9787  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32)
9788  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32) # <<<<<<<<<<<<<<
9789  * cdef int arg_shape_len = len(arg_shape)
9790  * cdef int shape_factor = 1
9791  */
9792  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
9793  __Pyx_GOTREF(__pyx_t_2);
9794  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 581, __pyx_L1_error)
9795  __Pyx_GOTREF(__pyx_t_5);
9796  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9797  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_args_, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
9798  __Pyx_GOTREF(__pyx_t_2);
9799  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 581, __pyx_L1_error)
9800  __Pyx_GOTREF(__pyx_t_3);
9801  __Pyx_GIVEREF(__pyx_t_2);
9802  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
9803  __pyx_t_2 = 0;
9804  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 581, __pyx_L1_error)
9805  __Pyx_GOTREF(__pyx_t_2);
9806  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 581, __pyx_L1_error)
9807  __Pyx_GOTREF(__pyx_t_4);
9808  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
9809  __Pyx_GOTREF(__pyx_t_1);
9810  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9811  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 581, __pyx_L1_error)
9812  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9813  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 581, __pyx_L1_error)
9814  __Pyx_GOTREF(__pyx_t_1);
9815  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9816  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9817  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9818  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 581, __pyx_L1_error)
9819  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9820  __pyx_v_arg_shape_copy = __pyx_t_6;
9821  __pyx_t_6.memview = NULL;
9822  __pyx_t_6.data = NULL;
9823 
9824  /* "mprans/MeshSmoothing.pyx":582
9825  * cdef int[:] arg_shape = np.array(args_.shape, dtype=np.int32)
9826  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32)
9827  * cdef int arg_shape_len = len(arg_shape) # <<<<<<<<<<<<<<
9828  * cdef int shape_factor = 1
9829  * cdef int disp = 0
9830  */
9831  __pyx_t_8 = __Pyx_MemoryView_Len(__pyx_v_arg_shape);
9832  __pyx_v_arg_shape_len = __pyx_t_8;
9833 
9834  /* "mprans/MeshSmoothing.pyx":583
9835  * cdef int[:] arg_shape_copy = np.array(args_.shape, dtype=np.int32)
9836  * cdef int arg_shape_len = len(arg_shape)
9837  * cdef int shape_factor = 1 # <<<<<<<<<<<<<<
9838  * cdef int disp = 0
9839  * cdef int rank, rank_recv, ii, ir, iN, node_new_rank, new_rank
9840  */
9841  __pyx_v_shape_factor = 1;
9842 
9843  /* "mprans/MeshSmoothing.pyx":584
9844  * cdef int arg_shape_len = len(arg_shape)
9845  * cdef int shape_factor = 1
9846  * cdef int disp = 0 # <<<<<<<<<<<<<<
9847  * cdef int rank, rank_recv, ii, ir, iN, node_new_rank, new_rank
9848  * cdef int sumtot
9849  */
9850  __pyx_v_disp = 0;
9851 
9852  /* "mprans/MeshSmoothing.pyx":588
9853  * cdef int sumtot
9854  * cdef int[:] nodes_2rank_values
9855  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32) # <<<<<<<<<<<<<<
9856  * if arg_shape_len > 1:
9857  * for i in range(1, arg_shape_len):
9858  */
9859  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
9860  __Pyx_GOTREF(__pyx_t_1);
9861  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 588, __pyx_L1_error)
9862  __Pyx_GOTREF(__pyx_t_2);
9863  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9864  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
9865  __Pyx_GOTREF(__pyx_t_1);
9866  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 588, __pyx_L1_error)
9867  __Pyx_GOTREF(__pyx_t_3);
9868  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
9869  __Pyx_GOTREF(__pyx_t_5);
9870  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9871  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 588, __pyx_L1_error)
9872  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9873  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 588, __pyx_L1_error)
9874  __Pyx_GOTREF(__pyx_t_5);
9875  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9876  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9877  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_5, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 588, __pyx_L1_error)
9878  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9879  __pyx_v_nodes_2doArray = __pyx_t_6;
9880  __pyx_t_6.memview = NULL;
9881  __pyx_t_6.data = NULL;
9882 
9883  /* "mprans/MeshSmoothing.pyx":589
9884  * cdef int[:] nodes_2rank_values
9885  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32)
9886  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
9887  * for i in range(1, arg_shape_len):
9888  * shape_factor = shape_factor*arg_shape[i]
9889  */
9890  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
9891  if (__pyx_t_9) {
9892 
9893  /* "mprans/MeshSmoothing.pyx":590
9894  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32)
9895  * if arg_shape_len > 1:
9896  * for i in range(1, arg_shape_len): # <<<<<<<<<<<<<<
9897  * shape_factor = shape_factor*arg_shape[i]
9898  * if comm_size > 1:
9899  */
9900  __pyx_t_7 = __pyx_v_arg_shape_len;
9901  __pyx_t_10 = __pyx_t_7;
9902  for (__pyx_t_11 = 1; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
9903  __pyx_v_i = __pyx_t_11;
9904 
9905  /* "mprans/MeshSmoothing.pyx":591
9906  * if arg_shape_len > 1:
9907  * for i in range(1, arg_shape_len):
9908  * shape_factor = shape_factor*arg_shape[i] # <<<<<<<<<<<<<<
9909  * if comm_size > 1:
9910  * for rank in range(comm_size):
9911  */
9912  __pyx_t_12 = __pyx_v_i;
9913  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_arg_shape.shape[0];
9914  __pyx_v_shape_factor = (__pyx_v_shape_factor * (*((int *) ( /* dim=0 */ (__pyx_v_arg_shape.data + __pyx_t_12 * __pyx_v_arg_shape.strides[0]) ))));
9915  }
9916 
9917  /* "mprans/MeshSmoothing.pyx":589
9918  * cdef int[:] nodes_2rank_values
9919  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32)
9920  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
9921  * for i in range(1, arg_shape_len):
9922  * shape_factor = shape_factor*arg_shape[i]
9923  */
9924  }
9925 
9926  /* "mprans/MeshSmoothing.pyx":592
9927  * for i in range(1, arg_shape_len):
9928  * shape_factor = shape_factor*arg_shape[i]
9929  * if comm_size > 1: # <<<<<<<<<<<<<<
9930  * for rank in range(comm_size):
9931  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9932  */
9933  __pyx_t_9 = ((__pyx_cur_scope->__pyx_v_comm_size > 1) != 0);
9934  if (__pyx_t_9) {
9935 
9936  /* "mprans/MeshSmoothing.pyx":593
9937  * shape_factor = shape_factor*arg_shape[i]
9938  * if comm_size > 1:
9939  * for rank in range(comm_size): # <<<<<<<<<<<<<<
9940  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9941  * for node in range(nNodes_owned, nNodes_global):
9942  */
9943  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
9944  __pyx_t_10 = __pyx_t_7;
9945  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
9946  __pyx_v_rank = __pyx_t_13;
9947 
9948  /* "mprans/MeshSmoothing.pyx":594
9949  * if comm_size > 1:
9950  * for rank in range(comm_size):
9951  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32) # <<<<<<<<<<<<<<
9952  * for node in range(nNodes_owned, nNodes_global):
9953  * result = cyCheckOwnedVariable(variable_nb_local=node,
9954  */
9955  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
9956  __Pyx_GOTREF(__pyx_t_5);
9957  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 594, __pyx_L1_error)
9958  __Pyx_GOTREF(__pyx_t_1);
9959  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9960  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
9961  __Pyx_GOTREF(__pyx_t_5);
9962  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 594, __pyx_L1_error)
9963  __Pyx_GOTREF(__pyx_t_2);
9964  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
9965  __Pyx_GOTREF(__pyx_t_3);
9966  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9967  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 594, __pyx_L1_error)
9968  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9969  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__3, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 594, __pyx_L1_error)
9970  __Pyx_GOTREF(__pyx_t_3);
9971  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9972  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9973  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 594, __pyx_L1_error)
9974  __Pyx_GOTREF(__pyx_t_5);
9975  if (unlikely(PyDict_SetItem(__pyx_v_nodes_2rank, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 594, __pyx_L1_error)
9976  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9977  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9978  }
9979 
9980  /* "mprans/MeshSmoothing.pyx":595
9981  * for rank in range(comm_size):
9982  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9983  * for node in range(nNodes_owned, nNodes_global): # <<<<<<<<<<<<<<
9984  * result = cyCheckOwnedVariable(variable_nb_local=node,
9985  * rank=my_rank,
9986  */
9987  __pyx_t_7 = __pyx_v_nNodes_global;
9988  __pyx_t_10 = __pyx_t_7;
9989  for (__pyx_t_13 = __pyx_v_nNodes_owned; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
9990  __pyx_v_node = __pyx_t_13;
9991 
9992  /* "mprans/MeshSmoothing.pyx":596
9993  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
9994  * for node in range(nNodes_owned, nNodes_global):
9995  * result = cyCheckOwnedVariable(variable_nb_local=node, # <<<<<<<<<<<<<<
9996  * rank=my_rank,
9997  * nVariables_owned=nNodes_owned,
9998  */
9999  __pyx_t_6 = __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(__pyx_v_node, __pyx_v_my_rank, __pyx_v_nNodes_owned, __pyx_v_nodeNumbering_subdomain2global, __pyx_v_nodeOffsets_subdomain_owned); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 596, __pyx_L1_error)
10000  __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1);
10001  __pyx_v_result = __pyx_t_6;
10002  __pyx_t_6.memview = NULL;
10003  __pyx_t_6.data = NULL;
10004 
10005  /* "mprans/MeshSmoothing.pyx":601
10006  * variableNumbering_subdomain2global=nodeNumbering_subdomain2global,
10007  * variableOffsets_subdomain_owned=nodeOffsets_subdomain_owned)
10008  * node_new_rank = result[0] # <<<<<<<<<<<<<<
10009  * new_rank = result[1]
10010  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank)
10011  */
10012  __pyx_t_12 = 0;
10013  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_result.shape[0];
10014  __pyx_v_node_new_rank = (*((int *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_12 * __pyx_v_result.strides[0]) )));
10015 
10016  /* "mprans/MeshSmoothing.pyx":602
10017  * variableOffsets_subdomain_owned=nodeOffsets_subdomain_owned)
10018  * node_new_rank = result[0]
10019  * new_rank = result[1] # <<<<<<<<<<<<<<
10020  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank)
10021  * # SEND THOSE NODES TO RELEVANT PROCESSORS
10022  */
10023  __pyx_t_12 = 1;
10024  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_result.shape[0];
10025  __pyx_v_new_rank = (*((int *) ( /* dim=0 */ (__pyx_v_result.data + __pyx_t_12 * __pyx_v_result.strides[0]) )));
10026 
10027  /* "mprans/MeshSmoothing.pyx":603
10028  * node_new_rank = result[0]
10029  * new_rank = result[1]
10030  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank) # <<<<<<<<<<<<<<
10031  * # SEND THOSE NODES TO RELEVANT PROCESSORS
10032  * for rank_recv in range(comm_size):
10033  */
10034  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
10035  __Pyx_GOTREF(__pyx_t_5);
10036  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error)
10037  __Pyx_GOTREF(__pyx_t_1);
10038  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10039  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_new_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
10040  __Pyx_GOTREF(__pyx_t_5);
10041  __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_nodes_2rank, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error)
10042  __Pyx_GOTREF(__pyx_t_2);
10043  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10044  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_node_new_rank); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
10045  __Pyx_GOTREF(__pyx_t_5);
10046  __pyx_t_4 = NULL;
10047  __pyx_t_14 = 0;
10048  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
10049  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
10050  if (likely(__pyx_t_4)) {
10051  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
10052  __Pyx_INCREF(__pyx_t_4);
10053  __Pyx_INCREF(function);
10054  __Pyx_DECREF_SET(__pyx_t_1, function);
10055  __pyx_t_14 = 1;
10056  }
10057  }
10058  #if CYTHON_FAST_PYCALL
10059  if (PyFunction_Check(__pyx_t_1)) {
10060  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_5};
10061  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
10062  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10063  __Pyx_GOTREF(__pyx_t_3);
10064  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10065  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10066  } else
10067  #endif
10068  #if CYTHON_FAST_PYCCALL
10069  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
10070  PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_2, __pyx_t_5};
10071  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
10072  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10073  __Pyx_GOTREF(__pyx_t_3);
10074  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10075  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10076  } else
10077  #endif
10078  {
10079  __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 603, __pyx_L1_error)
10080  __Pyx_GOTREF(__pyx_t_15);
10081  if (__pyx_t_4) {
10082  __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_4); __pyx_t_4 = NULL;
10083  }
10084  __Pyx_GIVEREF(__pyx_t_2);
10085  PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_2);
10086  __Pyx_GIVEREF(__pyx_t_5);
10087  PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_5);
10088  __pyx_t_2 = 0;
10089  __pyx_t_5 = 0;
10090  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 603, __pyx_L1_error)
10091  __Pyx_GOTREF(__pyx_t_3);
10092  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10093  }
10094  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10095  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_new_rank); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 603, __pyx_L1_error)
10096  __Pyx_GOTREF(__pyx_t_1);
10097  if (unlikely(PyDict_SetItem(__pyx_v_nodes_2rank, __pyx_t_1, __pyx_t_3) < 0)) __PYX_ERR(0, 603, __pyx_L1_error)
10098  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10099  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10100  }
10101 
10102  /* "mprans/MeshSmoothing.pyx":605
10103  * nodes_2rank[new_rank] = np.append(nodes_2rank[new_rank], node_new_rank)
10104  * # SEND THOSE NODES TO RELEVANT PROCESSORS
10105  * for rank_recv in range(comm_size): # <<<<<<<<<<<<<<
10106  * # -----
10107  * # find length of array to do on processor rank_recv
10108  */
10109  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10110  __pyx_t_10 = __pyx_t_7;
10111  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10112  __pyx_v_rank_recv = __pyx_t_13;
10113 
10114  /* "mprans/MeshSmoothing.pyx":608
10115  * # -----
10116  * # find length of array to do on processor rank_recv
10117  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32) # <<<<<<<<<<<<<<
10118  * nodes_2rank_len = len(nodes_2rank_values)
10119  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
10120  */
10121  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
10122  __Pyx_GOTREF(__pyx_t_1);
10123  __pyx_t_15 = __Pyx_PyDict_GetItem(__pyx_v_nodes_2rank, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 608, __pyx_L1_error)
10124  __Pyx_GOTREF(__pyx_t_15);
10125  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10126  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_15, 0, 0, NULL, NULL, &__pyx_slice__4, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
10127  __Pyx_GOTREF(__pyx_t_1);
10128  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10129  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_astype); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 608, __pyx_L1_error)
10130  __Pyx_GOTREF(__pyx_t_15);
10131  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10132  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
10133  __Pyx_GOTREF(__pyx_t_1);
10134  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
10135  __Pyx_GOTREF(__pyx_t_5);
10136  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10137  __pyx_t_1 = NULL;
10138  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
10139  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15);
10140  if (likely(__pyx_t_1)) {
10141  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
10142  __Pyx_INCREF(__pyx_t_1);
10143  __Pyx_INCREF(function);
10144  __Pyx_DECREF_SET(__pyx_t_15, function);
10145  }
10146  }
10147  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_1, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_5);
10148  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10149  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10150  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
10151  __Pyx_GOTREF(__pyx_t_3);
10152  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10153  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 608, __pyx_L1_error)
10154  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10155  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2rank_values, 1);
10156  __pyx_v_nodes_2rank_values = __pyx_t_6;
10157  __pyx_t_6.memview = NULL;
10158  __pyx_t_6.data = NULL;
10159 
10160  /* "mprans/MeshSmoothing.pyx":609
10161  * # find length of array to do on processor rank_recv
10162  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32)
10163  * nodes_2rank_len = len(nodes_2rank_values) # <<<<<<<<<<<<<<
10164  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
10165  * # initialise node_2doArray on receiving processor
10166  */
10167  __pyx_t_8 = __Pyx_MemoryView_Len(__pyx_v_nodes_2rank_values);
10168  __pyx_v_nodes_2rank_len = __pyx_t_8;
10169 
10170  /* "mprans/MeshSmoothing.pyx":610
10171  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32)
10172  * nodes_2rank_len = len(nodes_2rank_values)
10173  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM) # <<<<<<<<<<<<<<
10174  * # initialise node_2doArray on receiving processor
10175  * if rank_recv == my_rank:
10176  */
10177  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_allreduce); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
10178  __Pyx_GOTREF(__pyx_t_3);
10179  __pyx_t_15 = PyInt_FromSsize_t(__pyx_v_nodes_2rank_len); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 610, __pyx_L1_error)
10180  __Pyx_GOTREF(__pyx_t_15);
10181  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
10182  __Pyx_GOTREF(__pyx_t_5);
10183  __Pyx_GIVEREF(__pyx_t_15);
10184  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_15);
10185  __pyx_t_15 = 0;
10186  __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 610, __pyx_L1_error)
10187  __Pyx_GOTREF(__pyx_t_15);
10188  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
10189  __Pyx_GOTREF(__pyx_t_1);
10190  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_SUM); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
10191  __Pyx_GOTREF(__pyx_t_2);
10192  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10193  if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_op, __pyx_t_2) < 0) __PYX_ERR(0, 610, __pyx_L1_error)
10194  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10195  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
10196  __Pyx_GOTREF(__pyx_t_2);
10197  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10198  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10199  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10200  __Pyx_XDECREF_SET(__pyx_v_array_size, __pyx_t_2);
10201  __pyx_t_2 = 0;
10202 
10203  /* "mprans/MeshSmoothing.pyx":612
10204  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
10205  * # initialise node_2doArray on receiving processor
10206  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10207  * nodes_2doArray = np.zeros(array_size, dtype=np.int32)
10208  * # -----
10209  */
10210  __pyx_t_9 = ((__pyx_v_rank_recv == __pyx_v_my_rank) != 0);
10211  if (__pyx_t_9) {
10212 
10213  /* "mprans/MeshSmoothing.pyx":613
10214  * # initialise node_2doArray on receiving processor
10215  * if rank_recv == my_rank:
10216  * nodes_2doArray = np.zeros(array_size, dtype=np.int32) # <<<<<<<<<<<<<<
10217  * # -----
10218  * # get count and disp info for retrieving info from rank_recv later
10219  */
10220  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
10221  __Pyx_GOTREF(__pyx_t_2);
10222  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 613, __pyx_L1_error)
10223  __Pyx_GOTREF(__pyx_t_15);
10224  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10225  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 613, __pyx_L1_error)
10226  __Pyx_GOTREF(__pyx_t_2);
10227  __Pyx_INCREF(__pyx_v_array_size);
10228  __Pyx_GIVEREF(__pyx_v_array_size);
10229  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_array_size);
10230  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 613, __pyx_L1_error)
10231  __Pyx_GOTREF(__pyx_t_5);
10232  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 613, __pyx_L1_error)
10233  __Pyx_GOTREF(__pyx_t_3);
10234  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
10235  __Pyx_GOTREF(__pyx_t_1);
10236  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10237  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_1) < 0) __PYX_ERR(0, 613, __pyx_L1_error)
10238  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10239  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 613, __pyx_L1_error)
10240  __Pyx_GOTREF(__pyx_t_1);
10241  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10242  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10243  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10244  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 613, __pyx_L1_error)
10245  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10246  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2doArray, 1);
10247  __pyx_v_nodes_2doArray = __pyx_t_6;
10248  __pyx_t_6.memview = NULL;
10249  __pyx_t_6.data = NULL;
10250 
10251  /* "mprans/MeshSmoothing.pyx":612
10252  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
10253  * # initialise node_2doArray on receiving processor
10254  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10255  * nodes_2doArray = np.zeros(array_size, dtype=np.int32)
10256  * # -----
10257  */
10258  }
10259 
10260  /* "mprans/MeshSmoothing.pyx":617
10261  * # get count and disp info for retrieving info from rank_recv later
10262  * # counts_out[rank_recv] = nodes_2rank_len
10263  * counts_out[rank_recv] = nodes_2rank_len # <<<<<<<<<<<<<<
10264  * if rank_recv > 0:
10265  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1])
10266  */
10267  __pyx_t_12 = __pyx_v_rank_recv;
10268  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_counts_out.shape[0];
10269  *((int *) ( /* dim=0 */ (__pyx_v_counts_out.data + __pyx_t_12 * __pyx_v_counts_out.strides[0]) )) = __pyx_v_nodes_2rank_len;
10270 
10271  /* "mprans/MeshSmoothing.pyx":618
10272  * # counts_out[rank_recv] = nodes_2rank_len
10273  * counts_out[rank_recv] = nodes_2rank_len
10274  * if rank_recv > 0: # <<<<<<<<<<<<<<
10275  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1])
10276  * # -----
10277  */
10278  __pyx_t_9 = ((__pyx_v_rank_recv > 0) != 0);
10279  if (__pyx_t_9) {
10280 
10281  /* "mprans/MeshSmoothing.pyx":619
10282  * counts_out[rank_recv] = nodes_2rank_len
10283  * if rank_recv > 0:
10284  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1]) # <<<<<<<<<<<<<<
10285  * # -----
10286  * # get count and disp info for receiving array on rank_recv
10287  */
10288  __pyx_t_12 = (__pyx_v_rank_recv - 1);
10289  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_displacements_out.shape[0];
10290  __pyx_t_16 = (__pyx_v_rank_recv - 1);
10291  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counts_out.shape[0];
10292  __pyx_t_17 = __pyx_v_rank_recv;
10293  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_displacements_out.shape[0];
10294  *((int *) ( /* dim=0 */ (__pyx_v_displacements_out.data + __pyx_t_17 * __pyx_v_displacements_out.strides[0]) )) = ((*((int *) ( /* dim=0 */ (__pyx_v_displacements_out.data + __pyx_t_12 * __pyx_v_displacements_out.strides[0]) ))) + (*((int *) ( /* dim=0 */ (__pyx_v_counts_out.data + __pyx_t_16 * __pyx_v_counts_out.strides[0]) ))));
10295 
10296  /* "mprans/MeshSmoothing.pyx":618
10297  * # counts_out[rank_recv] = nodes_2rank_len
10298  * counts_out[rank_recv] = nodes_2rank_len
10299  * if rank_recv > 0: # <<<<<<<<<<<<<<
10300  * displacements_out[rank_recv] = (displacements_out[rank_recv-1]+counts_out[rank_recv-1])
10301  * # -----
10302  */
10303  }
10304 
10305  /* "mprans/MeshSmoothing.pyx":622
10306  * # -----
10307  * # get count and disp info for receiving array on rank_recv
10308  * my_size = np.array([nodes_2rank_len], dtype=np.int32) # <<<<<<<<<<<<<<
10309  * comm.Gatherv(my_size,
10310  * [counts_in,
10311  */
10312  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10313  __Pyx_GOTREF(__pyx_t_1);
10314  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 622, __pyx_L1_error)
10315  __Pyx_GOTREF(__pyx_t_5);
10316  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10317  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_nodes_2rank_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10318  __Pyx_GOTREF(__pyx_t_1);
10319  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error)
10320  __Pyx_GOTREF(__pyx_t_2);
10321  __Pyx_GIVEREF(__pyx_t_1);
10322  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
10323  __pyx_t_1 = 0;
10324  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 622, __pyx_L1_error)
10325  __Pyx_GOTREF(__pyx_t_1);
10326  __Pyx_GIVEREF(__pyx_t_2);
10327  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
10328  __pyx_t_2 = 0;
10329  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 622, __pyx_L1_error)
10330  __Pyx_GOTREF(__pyx_t_2);
10331  __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 622, __pyx_L1_error)
10332  __Pyx_GOTREF(__pyx_t_15);
10333  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_int32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error)
10334  __Pyx_GOTREF(__pyx_t_3);
10335  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10336  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_3) < 0) __PYX_ERR(0, 622, __pyx_L1_error)
10337  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10338  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 622, __pyx_L1_error)
10339  __Pyx_GOTREF(__pyx_t_3);
10340  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10341  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10342  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10343  __Pyx_XDECREF_SET(__pyx_v_my_size, __pyx_t_3);
10344  __pyx_t_3 = 0;
10345 
10346  /* "mprans/MeshSmoothing.pyx":623
10347  * # get count and disp info for receiving array on rank_recv
10348  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10349  * comm.Gatherv(my_size, # <<<<<<<<<<<<<<
10350  * [counts_in,
10351  * tuple(1 for i in range(comm_size)),
10352  */
10353  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Gatherv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error)
10354  __Pyx_GOTREF(__pyx_t_3);
10355 
10356  /* "mprans/MeshSmoothing.pyx":624
10357  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10358  * comm.Gatherv(my_size,
10359  * [counts_in, # <<<<<<<<<<<<<<
10360  * tuple(1 for i in range(comm_size)),
10361  * tuple(i for i in range(comm_size)),
10362  */
10363  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_counts_in, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 624, __pyx_L1_error)
10364  __Pyx_GOTREF(__pyx_t_2);
10365 
10366  /* "mprans/MeshSmoothing.pyx":625
10367  * comm.Gatherv(my_size,
10368  * [counts_in,
10369  * tuple(1 for i in range(comm_size)), # <<<<<<<<<<<<<<
10370  * tuple(i for i in range(comm_size)),
10371  * MPI.INT],
10372  */
10373  __pyx_t_1 = __pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
10374  __Pyx_GOTREF(__pyx_t_1);
10375  __pyx_t_5 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 625, __pyx_L1_error)
10376  __Pyx_GOTREF(__pyx_t_5);
10377  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10378 
10379  /* "mprans/MeshSmoothing.pyx":626
10380  * [counts_in,
10381  * tuple(1 for i in range(comm_size)),
10382  * tuple(i for i in range(comm_size)), # <<<<<<<<<<<<<<
10383  * MPI.INT],
10384  * root=rank_recv
10385  */
10386  __pyx_t_1 = __pyx_pf_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
10387  __Pyx_GOTREF(__pyx_t_1);
10388  __pyx_t_15 = __Pyx_PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 626, __pyx_L1_error)
10389  __Pyx_GOTREF(__pyx_t_15);
10390  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10391 
10392  /* "mprans/MeshSmoothing.pyx":627
10393  * tuple(1 for i in range(comm_size)),
10394  * tuple(i for i in range(comm_size)),
10395  * MPI.INT], # <<<<<<<<<<<<<<
10396  * root=rank_recv
10397  * )
10398  */
10399  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
10400  __Pyx_GOTREF(__pyx_t_1);
10401  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
10402  __Pyx_GOTREF(__pyx_t_4);
10403  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10404 
10405  /* "mprans/MeshSmoothing.pyx":624
10406  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10407  * comm.Gatherv(my_size,
10408  * [counts_in, # <<<<<<<<<<<<<<
10409  * tuple(1 for i in range(comm_size)),
10410  * tuple(i for i in range(comm_size)),
10411  */
10412  __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
10413  __Pyx_GOTREF(__pyx_t_1);
10414  __Pyx_GIVEREF(__pyx_t_2);
10415  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
10416  __Pyx_GIVEREF(__pyx_t_5);
10417  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
10418  __Pyx_GIVEREF(__pyx_t_15);
10419  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_15);
10420  __Pyx_GIVEREF(__pyx_t_4);
10421  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
10422  __pyx_t_2 = 0;
10423  __pyx_t_5 = 0;
10424  __pyx_t_15 = 0;
10425  __pyx_t_4 = 0;
10426 
10427  /* "mprans/MeshSmoothing.pyx":623
10428  * # get count and disp info for receiving array on rank_recv
10429  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10430  * comm.Gatherv(my_size, # <<<<<<<<<<<<<<
10431  * [counts_in,
10432  * tuple(1 for i in range(comm_size)),
10433  */
10434  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 623, __pyx_L1_error)
10435  __Pyx_GOTREF(__pyx_t_4);
10436  __Pyx_INCREF(__pyx_v_my_size);
10437  __Pyx_GIVEREF(__pyx_v_my_size);
10438  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_my_size);
10439  __Pyx_GIVEREF(__pyx_t_1);
10440  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
10441  __pyx_t_1 = 0;
10442 
10443  /* "mprans/MeshSmoothing.pyx":628
10444  * tuple(i for i in range(comm_size)),
10445  * MPI.INT],
10446  * root=rank_recv # <<<<<<<<<<<<<<
10447  * )
10448  * if rank_recv == my_rank:
10449  */
10450  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
10451  __Pyx_GOTREF(__pyx_t_1);
10452  __pyx_t_15 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 628, __pyx_L1_error)
10453  __Pyx_GOTREF(__pyx_t_15);
10454  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_root, __pyx_t_15) < 0) __PYX_ERR(0, 628, __pyx_L1_error)
10455  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10456 
10457  /* "mprans/MeshSmoothing.pyx":623
10458  * # get count and disp info for receiving array on rank_recv
10459  * my_size = np.array([nodes_2rank_len], dtype=np.int32)
10460  * comm.Gatherv(my_size, # <<<<<<<<<<<<<<
10461  * [counts_in,
10462  * tuple(1 for i in range(comm_size)),
10463  */
10464  __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 623, __pyx_L1_error)
10465  __Pyx_GOTREF(__pyx_t_15);
10466  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10467  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10468  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10469  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10470 
10471  /* "mprans/MeshSmoothing.pyx":630
10472  * root=rank_recv
10473  * )
10474  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10475  * sumtot = 0
10476  * for ir in range(comm_size):
10477  */
10478  __pyx_t_9 = ((__pyx_v_rank_recv == __pyx_v_my_rank) != 0);
10479  if (__pyx_t_9) {
10480 
10481  /* "mprans/MeshSmoothing.pyx":631
10482  * )
10483  * if rank_recv == my_rank:
10484  * sumtot = 0 # <<<<<<<<<<<<<<
10485  * for ir in range(comm_size):
10486  * if ir > 0:
10487  */
10488  __pyx_v_sumtot = 0;
10489 
10490  /* "mprans/MeshSmoothing.pyx":632
10491  * if rank_recv == my_rank:
10492  * sumtot = 0
10493  * for ir in range(comm_size): # <<<<<<<<<<<<<<
10494  * if ir > 0:
10495  * sumtot += counts_in[ir-1]
10496  */
10497  __pyx_t_14 = __pyx_cur_scope->__pyx_v_comm_size;
10498  __pyx_t_18 = __pyx_t_14;
10499  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
10500  __pyx_v_ir = __pyx_t_19;
10501 
10502  /* "mprans/MeshSmoothing.pyx":633
10503  * sumtot = 0
10504  * for ir in range(comm_size):
10505  * if ir > 0: # <<<<<<<<<<<<<<
10506  * sumtot += counts_in[ir-1]
10507  * if counts_in[ir] == 0:
10508  */
10509  __pyx_t_9 = ((__pyx_v_ir > 0) != 0);
10510  if (__pyx_t_9) {
10511 
10512  /* "mprans/MeshSmoothing.pyx":634
10513  * for ir in range(comm_size):
10514  * if ir > 0:
10515  * sumtot += counts_in[ir-1] # <<<<<<<<<<<<<<
10516  * if counts_in[ir] == 0:
10517  * displacements_in[ir] = 0
10518  */
10519  __pyx_t_16 = (__pyx_v_ir - 1);
10520  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counts_in.shape[0];
10521  __pyx_v_sumtot = (__pyx_v_sumtot + (*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_16 * __pyx_v_counts_in.strides[0]) ))));
10522 
10523  /* "mprans/MeshSmoothing.pyx":635
10524  * if ir > 0:
10525  * sumtot += counts_in[ir-1]
10526  * if counts_in[ir] == 0: # <<<<<<<<<<<<<<
10527  * displacements_in[ir] = 0
10528  * else:
10529  */
10530  __pyx_t_16 = __pyx_v_ir;
10531  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counts_in.shape[0];
10532  __pyx_t_9 = (((*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_16 * __pyx_v_counts_in.strides[0]) ))) == 0) != 0);
10533  if (__pyx_t_9) {
10534 
10535  /* "mprans/MeshSmoothing.pyx":636
10536  * sumtot += counts_in[ir-1]
10537  * if counts_in[ir] == 0:
10538  * displacements_in[ir] = 0 # <<<<<<<<<<<<<<
10539  * else:
10540  * displacements_in[ir] = sumtot
10541  */
10542  __pyx_t_16 = __pyx_v_ir;
10543  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_displacements_in.shape[0];
10544  *((int *) ( /* dim=0 */ (__pyx_v_displacements_in.data + __pyx_t_16 * __pyx_v_displacements_in.strides[0]) )) = 0;
10545 
10546  /* "mprans/MeshSmoothing.pyx":635
10547  * if ir > 0:
10548  * sumtot += counts_in[ir-1]
10549  * if counts_in[ir] == 0: # <<<<<<<<<<<<<<
10550  * displacements_in[ir] = 0
10551  * else:
10552  */
10553  goto __pyx_L19;
10554  }
10555 
10556  /* "mprans/MeshSmoothing.pyx":638
10557  * displacements_in[ir] = 0
10558  * else:
10559  * displacements_in[ir] = sumtot # <<<<<<<<<<<<<<
10560  * # -----
10561  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10562  */
10563  /*else*/ {
10564  __pyx_t_16 = __pyx_v_ir;
10565  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_displacements_in.shape[0];
10566  *((int *) ( /* dim=0 */ (__pyx_v_displacements_in.data + __pyx_t_16 * __pyx_v_displacements_in.strides[0]) )) = __pyx_v_sumtot;
10567  }
10568  __pyx_L19:;
10569 
10570  /* "mprans/MeshSmoothing.pyx":633
10571  * sumtot = 0
10572  * for ir in range(comm_size):
10573  * if ir > 0: # <<<<<<<<<<<<<<
10574  * sumtot += counts_in[ir-1]
10575  * if counts_in[ir] == 0:
10576  */
10577  }
10578  }
10579 
10580  /* "mprans/MeshSmoothing.pyx":630
10581  * root=rank_recv
10582  * )
10583  * if rank_recv == my_rank: # <<<<<<<<<<<<<<
10584  * sumtot = 0
10585  * for ir in range(comm_size):
10586  */
10587  }
10588 
10589  /* "mprans/MeshSmoothing.pyx":642
10590  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10591  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10592  * comm.Gatherv(nodes_2rank_values, # <<<<<<<<<<<<<<
10593  * [nodes_2doArray,
10594  * counts_in,
10595  */
10596  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Gatherv); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 642, __pyx_L1_error)
10597  __Pyx_GOTREF(__pyx_t_15);
10598  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_nodes_2rank_values, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
10599  __Pyx_GOTREF(__pyx_t_1);
10600 
10601  /* "mprans/MeshSmoothing.pyx":643
10602  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10603  * comm.Gatherv(nodes_2rank_values,
10604  * [nodes_2doArray, # <<<<<<<<<<<<<<
10605  * counts_in,
10606  * displacements_in,
10607  */
10608  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_nodes_2doArray, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error)
10609  __Pyx_GOTREF(__pyx_t_4);
10610 
10611  /* "mprans/MeshSmoothing.pyx":644
10612  * comm.Gatherv(nodes_2rank_values,
10613  * [nodes_2doArray,
10614  * counts_in, # <<<<<<<<<<<<<<
10615  * displacements_in,
10616  * MPI.INT],
10617  */
10618  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_counts_in, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 644, __pyx_L1_error)
10619  __Pyx_GOTREF(__pyx_t_3);
10620 
10621  /* "mprans/MeshSmoothing.pyx":645
10622  * [nodes_2doArray,
10623  * counts_in,
10624  * displacements_in, # <<<<<<<<<<<<<<
10625  * MPI.INT],
10626  * root=rank_recv)
10627  */
10628  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_displacements_in, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 645, __pyx_L1_error)
10629  __Pyx_GOTREF(__pyx_t_5);
10630 
10631  /* "mprans/MeshSmoothing.pyx":646
10632  * counts_in,
10633  * displacements_in,
10634  * MPI.INT], # <<<<<<<<<<<<<<
10635  * root=rank_recv)
10636  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10637  */
10638  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MPI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
10639  __Pyx_GOTREF(__pyx_t_2);
10640  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_INT); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 646, __pyx_L1_error)
10641  __Pyx_GOTREF(__pyx_t_20);
10642  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10643 
10644  /* "mprans/MeshSmoothing.pyx":643
10645  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10646  * comm.Gatherv(nodes_2rank_values,
10647  * [nodes_2doArray, # <<<<<<<<<<<<<<
10648  * counts_in,
10649  * displacements_in,
10650  */
10651  __pyx_t_2 = PyList_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
10652  __Pyx_GOTREF(__pyx_t_2);
10653  __Pyx_GIVEREF(__pyx_t_4);
10654  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
10655  __Pyx_GIVEREF(__pyx_t_3);
10656  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
10657  __Pyx_GIVEREF(__pyx_t_5);
10658  PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
10659  __Pyx_GIVEREF(__pyx_t_20);
10660  PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_20);
10661  __pyx_t_4 = 0;
10662  __pyx_t_3 = 0;
10663  __pyx_t_5 = 0;
10664  __pyx_t_20 = 0;
10665 
10666  /* "mprans/MeshSmoothing.pyx":642
10667  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10668  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10669  * comm.Gatherv(nodes_2rank_values, # <<<<<<<<<<<<<<
10670  * [nodes_2doArray,
10671  * counts_in,
10672  */
10673  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 642, __pyx_L1_error)
10674  __Pyx_GOTREF(__pyx_t_20);
10675  __Pyx_GIVEREF(__pyx_t_1);
10676  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_1);
10677  __Pyx_GIVEREF(__pyx_t_2);
10678  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_2);
10679  __pyx_t_1 = 0;
10680  __pyx_t_2 = 0;
10681 
10682  /* "mprans/MeshSmoothing.pyx":647
10683  * displacements_in,
10684  * MPI.INT],
10685  * root=rank_recv) # <<<<<<<<<<<<<<
10686  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10687  * arg_shape_copy[0] = 0
10688  */
10689  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error)
10690  __Pyx_GOTREF(__pyx_t_2);
10691  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
10692  __Pyx_GOTREF(__pyx_t_1);
10693  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_root, __pyx_t_1) < 0) __PYX_ERR(0, 647, __pyx_L1_error)
10694  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10695 
10696  /* "mprans/MeshSmoothing.pyx":642
10697  * # get the nodes_2doArray (nodes where to retrieve values for arg)
10698  * # datatype = MPI.INT.Create_contiguous(2).Commit()
10699  * comm.Gatherv(nodes_2rank_values, # <<<<<<<<<<<<<<
10700  * [nodes_2doArray,
10701  * counts_in,
10702  */
10703  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_20, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 642, __pyx_L1_error)
10704  __Pyx_GOTREF(__pyx_t_1);
10705  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10706  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
10707  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10708  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10709  }
10710 
10711  /* "mprans/MeshSmoothing.pyx":649
10712  * root=rank_recv)
10713  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10714  * arg_shape_copy[0] = 0 # <<<<<<<<<<<<<<
10715  * for rank in range(comm_size):
10716  * # create empty arrays
10717  */
10718  __pyx_t_16 = 0;
10719  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_arg_shape_copy.shape[0];
10720  *((int *) ( /* dim=0 */ (__pyx_v_arg_shape_copy.data + __pyx_t_16 * __pyx_v_arg_shape_copy.strides[0]) )) = 0;
10721 
10722  /* "mprans/MeshSmoothing.pyx":650
10723  * # SEND VALUE BACK TO ORIGINAL PROCESSORS
10724  * arg_shape_copy[0] = 0
10725  * for rank in range(comm_size): # <<<<<<<<<<<<<<
10726  * # create empty arrays
10727  * arg_shape_copy[0] = counts_in[rank]
10728  */
10729  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10730  __pyx_t_10 = __pyx_t_7;
10731  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10732  __pyx_v_rank = __pyx_t_13;
10733 
10734  /* "mprans/MeshSmoothing.pyx":652
10735  * for rank in range(comm_size):
10736  * # create empty arrays
10737  * arg_shape_copy[0] = counts_in[rank] # <<<<<<<<<<<<<<
10738  * arg_2rank[rank] = np.zeros(arg_shape_copy)
10739  * # build array of arg to send back
10740  */
10741  __pyx_t_16 = __pyx_v_rank;
10742  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counts_in.shape[0];
10743  __pyx_t_12 = 0;
10744  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_arg_shape_copy.shape[0];
10745  *((int *) ( /* dim=0 */ (__pyx_v_arg_shape_copy.data + __pyx_t_12 * __pyx_v_arg_shape_copy.strides[0]) )) = (*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_16 * __pyx_v_counts_in.strides[0]) )));
10746 
10747  /* "mprans/MeshSmoothing.pyx":653
10748  * # create empty arrays
10749  * arg_shape_copy[0] = counts_in[rank]
10750  * arg_2rank[rank] = np.zeros(arg_shape_copy) # <<<<<<<<<<<<<<
10751  * # build array of arg to send back
10752  * for rank in range(comm_size):
10753  */
10754  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
10755  __Pyx_GOTREF(__pyx_t_2);
10756  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 653, __pyx_L1_error)
10757  __Pyx_GOTREF(__pyx_t_20);
10758  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10759  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_arg_shape_copy, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 653, __pyx_L1_error)
10760  __Pyx_GOTREF(__pyx_t_2);
10761  __pyx_t_15 = NULL;
10762  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
10763  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_20);
10764  if (likely(__pyx_t_15)) {
10765  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
10766  __Pyx_INCREF(__pyx_t_15);
10767  __Pyx_INCREF(function);
10768  __Pyx_DECREF_SET(__pyx_t_20, function);
10769  }
10770  }
10771  __pyx_t_1 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_15, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_2);
10772  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
10773  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10774  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 653, __pyx_L1_error)
10775  __Pyx_GOTREF(__pyx_t_1);
10776  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
10777  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 653, __pyx_L1_error)
10778  __Pyx_GOTREF(__pyx_t_20);
10779  if (unlikely(PyDict_SetItem(__pyx_v_arg_2rank, __pyx_t_20, __pyx_t_1) < 0)) __PYX_ERR(0, 653, __pyx_L1_error)
10780  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
10781  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10782  }
10783 
10784  /* "mprans/MeshSmoothing.pyx":655
10785  * arg_2rank[rank] = np.zeros(arg_shape_copy)
10786  * # build array of arg to send back
10787  * for rank in range(comm_size): # <<<<<<<<<<<<<<
10788  * arg_2rank_values = arg_2rank[rank]
10789  * disp = displacements_in[rank]
10790  */
10791  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10792  __pyx_t_10 = __pyx_t_7;
10793  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10794  __pyx_v_rank = __pyx_t_13;
10795 
10796  /* "mprans/MeshSmoothing.pyx":656
10797  * # build array of arg to send back
10798  * for rank in range(comm_size):
10799  * arg_2rank_values = arg_2rank[rank] # <<<<<<<<<<<<<<
10800  * disp = displacements_in[rank]
10801  * for iN in range(counts_in[rank]):
10802  */
10803  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 656, __pyx_L1_error)
10804  __Pyx_GOTREF(__pyx_t_1);
10805  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_arg_2rank, __pyx_t_1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 656, __pyx_L1_error)
10806  __Pyx_GOTREF(__pyx_t_20);
10807  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10808  __Pyx_XDECREF_SET(__pyx_v_arg_2rank_values, __pyx_t_20);
10809  __pyx_t_20 = 0;
10810 
10811  /* "mprans/MeshSmoothing.pyx":657
10812  * for rank in range(comm_size):
10813  * arg_2rank_values = arg_2rank[rank]
10814  * disp = displacements_in[rank] # <<<<<<<<<<<<<<
10815  * for iN in range(counts_in[rank]):
10816  * if arg_shape_len > 1:
10817  */
10818  __pyx_t_16 = __pyx_v_rank;
10819  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_displacements_in.shape[0];
10820  __pyx_v_disp = (*((int *) ( /* dim=0 */ (__pyx_v_displacements_in.data + __pyx_t_16 * __pyx_v_displacements_in.strides[0]) )));
10821 
10822  /* "mprans/MeshSmoothing.pyx":658
10823  * arg_2rank_values = arg_2rank[rank]
10824  * disp = displacements_in[rank]
10825  * for iN in range(counts_in[rank]): # <<<<<<<<<<<<<<
10826  * if arg_shape_len > 1:
10827  * for ii in range(arg_shape[1]):
10828  */
10829  __pyx_t_16 = __pyx_v_rank;
10830  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_counts_in.shape[0];
10831  __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_counts_in.data + __pyx_t_16 * __pyx_v_counts_in.strides[0]) )));
10832  __pyx_t_18 = __pyx_t_14;
10833  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
10834  __pyx_v_iN = __pyx_t_19;
10835 
10836  /* "mprans/MeshSmoothing.pyx":659
10837  * disp = displacements_in[rank]
10838  * for iN in range(counts_in[rank]):
10839  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
10840  * for ii in range(arg_shape[1]):
10841  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10842  */
10843  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
10844  if (__pyx_t_9) {
10845 
10846  /* "mprans/MeshSmoothing.pyx":660
10847  * for iN in range(counts_in[rank]):
10848  * if arg_shape_len > 1:
10849  * for ii in range(arg_shape[1]): # <<<<<<<<<<<<<<
10850  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10851  * else:
10852  */
10853  __pyx_t_16 = 1;
10854  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_arg_shape.shape[0];
10855  __pyx_t_21 = (*((int *) ( /* dim=0 */ (__pyx_v_arg_shape.data + __pyx_t_16 * __pyx_v_arg_shape.strides[0]) )));
10856  __pyx_t_22 = __pyx_t_21;
10857  for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) {
10858  __pyx_v_ii = __pyx_t_23;
10859 
10860  /* "mprans/MeshSmoothing.pyx":661
10861  * if arg_shape_len > 1:
10862  * for ii in range(arg_shape[1]):
10863  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii] # <<<<<<<<<<<<<<
10864  * else:
10865  * arg_2rank_values[iN] = args_[nodes_2doArray[iN+disp]]
10866  */
10867  __pyx_t_16 = (__pyx_v_iN + __pyx_v_disp);
10868  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodes_2doArray.shape[0];
10869  __pyx_t_20 = __Pyx_PyInt_From_int((*((int *) ( /* dim=0 */ (__pyx_v_nodes_2doArray.data + __pyx_t_16 * __pyx_v_nodes_2doArray.strides[0]) )))); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 661, __pyx_L1_error)
10870  __Pyx_GOTREF(__pyx_t_20);
10871  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
10872  __Pyx_GOTREF(__pyx_t_1);
10873  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
10874  __Pyx_GOTREF(__pyx_t_2);
10875  __Pyx_GIVEREF(__pyx_t_20);
10876  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_20);
10877  __Pyx_GIVEREF(__pyx_t_1);
10878  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
10879  __pyx_t_20 = 0;
10880  __pyx_t_1 = 0;
10881  __pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_args_, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 661, __pyx_L1_error)
10882  __Pyx_GOTREF(__pyx_t_1);
10883  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10884  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_iN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
10885  __Pyx_GOTREF(__pyx_t_2);
10886  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 661, __pyx_L1_error)
10887  __Pyx_GOTREF(__pyx_t_20);
10888  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 661, __pyx_L1_error)
10889  __Pyx_GOTREF(__pyx_t_15);
10890  __Pyx_GIVEREF(__pyx_t_2);
10891  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2);
10892  __Pyx_GIVEREF(__pyx_t_20);
10893  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_20);
10894  __pyx_t_2 = 0;
10895  __pyx_t_20 = 0;
10896  if (unlikely(PyObject_SetItem(__pyx_v_arg_2rank_values, __pyx_t_15, __pyx_t_1) < 0)) __PYX_ERR(0, 661, __pyx_L1_error)
10897  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10898  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10899  }
10900 
10901  /* "mprans/MeshSmoothing.pyx":659
10902  * disp = displacements_in[rank]
10903  * for iN in range(counts_in[rank]):
10904  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
10905  * for ii in range(arg_shape[1]):
10906  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10907  */
10908  goto __pyx_L26;
10909  }
10910 
10911  /* "mprans/MeshSmoothing.pyx":663
10912  * arg_2rank_values[iN, ii] = args_[nodes_2doArray[iN+disp], ii]
10913  * else:
10914  * arg_2rank_values[iN] = args_[nodes_2doArray[iN+disp]] # <<<<<<<<<<<<<<
10915  * # retrieve solution
10916  * arg_shape_copy[0] = nNodes_global-nNodes_owned
10917  */
10918  /*else*/ {
10919  __pyx_t_16 = (__pyx_v_iN + __pyx_v_disp);
10920  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodes_2doArray.shape[0];
10921  __pyx_t_21 = (*((int *) ( /* dim=0 */ (__pyx_v_nodes_2doArray.data + __pyx_t_16 * __pyx_v_nodes_2doArray.strides[0]) )));
10922  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_args_, __pyx_t_21, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
10923  __Pyx_GOTREF(__pyx_t_1);
10924  if (unlikely(__Pyx_SetItemInt(__pyx_v_arg_2rank_values, __pyx_v_iN, __pyx_t_1, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
10925  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10926  }
10927  __pyx_L26:;
10928  }
10929  }
10930 
10931  /* "mprans/MeshSmoothing.pyx":665
10932  * arg_2rank_values[iN] = args_[nodes_2doArray[iN+disp]]
10933  * # retrieve solution
10934  * arg_shape_copy[0] = nNodes_global-nNodes_owned # <<<<<<<<<<<<<<
10935  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double)
10936  * for rank_recv in range(comm_size):
10937  */
10938  __pyx_t_16 = 0;
10939  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_arg_shape_copy.shape[0];
10940  *((int *) ( /* dim=0 */ (__pyx_v_arg_shape_copy.data + __pyx_t_16 * __pyx_v_arg_shape_copy.strides[0]) )) = (__pyx_v_nNodes_global - __pyx_v_nNodes_owned);
10941 
10942  /* "mprans/MeshSmoothing.pyx":666
10943  * # retrieve solution
10944  * arg_shape_copy[0] = nNodes_global-nNodes_owned
10945  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double) # <<<<<<<<<<<<<<
10946  * for rank_recv in range(comm_size):
10947  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10948  */
10949  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
10950  __Pyx_GOTREF(__pyx_t_1);
10951  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 666, __pyx_L1_error)
10952  __Pyx_GOTREF(__pyx_t_15);
10953  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10954  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_arg_shape_copy, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
10955  __Pyx_GOTREF(__pyx_t_1);
10956  __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 666, __pyx_L1_error)
10957  __Pyx_GOTREF(__pyx_t_20);
10958  __Pyx_GIVEREF(__pyx_t_1);
10959  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_1);
10960  __pyx_t_1 = 0;
10961  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 666, __pyx_L1_error)
10962  __Pyx_GOTREF(__pyx_t_1);
10963  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
10964  __Pyx_GOTREF(__pyx_t_2);
10965  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_double); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error)
10966  __Pyx_GOTREF(__pyx_t_5);
10967  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10968  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 666, __pyx_L1_error)
10969  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10970  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_20, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 666, __pyx_L1_error)
10971  __Pyx_GOTREF(__pyx_t_5);
10972  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
10973  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
10974  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10975  __pyx_v_arg_2doArray = __pyx_t_5;
10976  __pyx_t_5 = 0;
10977 
10978  /* "mprans/MeshSmoothing.pyx":667
10979  * arg_shape_copy[0] = nNodes_global-nNodes_owned
10980  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double)
10981  * for rank_recv in range(comm_size): # <<<<<<<<<<<<<<
10982  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
10983  * if arg_shape_len > 1:
10984  */
10985  __pyx_t_7 = __pyx_cur_scope->__pyx_v_comm_size;
10986  __pyx_t_10 = __pyx_t_7;
10987  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
10988  __pyx_v_rank_recv = __pyx_t_13;
10989 
10990  /* "mprans/MeshSmoothing.pyx":668
10991  * arg_2doArray = np.zeros(arg_shape_copy, dtype=np.double)
10992  * for rank_recv in range(comm_size):
10993  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double) # <<<<<<<<<<<<<<
10994  * if arg_shape_len > 1:
10995  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
10996  */
10997  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
10998  __Pyx_GOTREF(__pyx_t_1);
10999  __pyx_t_20 = __Pyx_PyDict_GetItem(__pyx_v_arg_2rank, __pyx_t_1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 668, __pyx_L1_error)
11000  __Pyx_GOTREF(__pyx_t_20);
11001  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11002  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_astype); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 668, __pyx_L1_error)
11003  __Pyx_GOTREF(__pyx_t_1);
11004  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11005  __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_np); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 668, __pyx_L1_error)
11006  __Pyx_GOTREF(__pyx_t_20);
11007  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_double); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 668, __pyx_L1_error)
11008  __Pyx_GOTREF(__pyx_t_15);
11009  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11010  __pyx_t_20 = NULL;
11011  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
11012  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_1);
11013  if (likely(__pyx_t_20)) {
11014  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
11015  __Pyx_INCREF(__pyx_t_20);
11016  __Pyx_INCREF(function);
11017  __Pyx_DECREF_SET(__pyx_t_1, function);
11018  }
11019  }
11020  __pyx_t_5 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_20, __pyx_t_15) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_15);
11021  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
11022  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
11023  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L1_error)
11024  __Pyx_GOTREF(__pyx_t_5);
11025  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11026  __Pyx_XDECREF_SET(__pyx_v_arg_2rank_values, __pyx_t_5);
11027  __pyx_t_5 = 0;
11028 
11029  /* "mprans/MeshSmoothing.pyx":669
11030  * for rank_recv in range(comm_size):
11031  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
11032  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
11033  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
11034  * else:
11035  */
11036  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
11037  if (__pyx_t_9) {
11038 
11039  /* "mprans/MeshSmoothing.pyx":670
11040  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
11041  * if arg_shape_len > 1:
11042  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit() # <<<<<<<<<<<<<<
11043  * else:
11044  * datatype = MPI.DOUBLE
11045  */
11046  __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_MPI); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 670, __pyx_L1_error)
11047  __Pyx_GOTREF(__pyx_t_15);
11048  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 670, __pyx_L1_error)
11049  __Pyx_GOTREF(__pyx_t_20);
11050  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
11051  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_Create_contiguous); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 670, __pyx_L1_error)
11052  __Pyx_GOTREF(__pyx_t_15);
11053  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11054  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_shape_factor); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 670, __pyx_L1_error)
11055  __Pyx_GOTREF(__pyx_t_20);
11056  __pyx_t_2 = NULL;
11057  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
11058  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15);
11059  if (likely(__pyx_t_2)) {
11060  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
11061  __Pyx_INCREF(__pyx_t_2);
11062  __Pyx_INCREF(function);
11063  __Pyx_DECREF_SET(__pyx_t_15, function);
11064  }
11065  }
11066  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_15, __pyx_t_2, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_20);
11067  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
11068  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11069  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 670, __pyx_L1_error)
11070  __Pyx_GOTREF(__pyx_t_1);
11071  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
11072  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Commit); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 670, __pyx_L1_error)
11073  __Pyx_GOTREF(__pyx_t_15);
11074  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11075  __pyx_t_1 = NULL;
11076  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
11077  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_15);
11078  if (likely(__pyx_t_1)) {
11079  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
11080  __Pyx_INCREF(__pyx_t_1);
11081  __Pyx_INCREF(function);
11082  __Pyx_DECREF_SET(__pyx_t_15, function);
11083  }
11084  }
11085  __pyx_t_5 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_15);
11086  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
11087  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 670, __pyx_L1_error)
11088  __Pyx_GOTREF(__pyx_t_5);
11089  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
11090  __Pyx_XDECREF_SET(__pyx_v_datatype, __pyx_t_5);
11091  __pyx_t_5 = 0;
11092 
11093  /* "mprans/MeshSmoothing.pyx":669
11094  * for rank_recv in range(comm_size):
11095  * arg_2rank_values = arg_2rank[rank_recv].astype(np.double)
11096  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
11097  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
11098  * else:
11099  */
11100  goto __pyx_L31;
11101  }
11102 
11103  /* "mprans/MeshSmoothing.pyx":672
11104  * datatype = MPI.DOUBLE.Create_contiguous(shape_factor).Commit()
11105  * else:
11106  * datatype = MPI.DOUBLE # <<<<<<<<<<<<<<
11107  * comm.Gatherv(arg_2rank_values,
11108  * [arg_2doArray,
11109  */
11110  /*else*/ {
11111  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_MPI); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 672, __pyx_L1_error)
11112  __Pyx_GOTREF(__pyx_t_5);
11113  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_DOUBLE); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 672, __pyx_L1_error)
11114  __Pyx_GOTREF(__pyx_t_15);
11115  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11116  __Pyx_XDECREF_SET(__pyx_v_datatype, __pyx_t_15);
11117  __pyx_t_15 = 0;
11118  }
11119  __pyx_L31:;
11120 
11121  /* "mprans/MeshSmoothing.pyx":673
11122  * else:
11123  * datatype = MPI.DOUBLE
11124  * comm.Gatherv(arg_2rank_values, # <<<<<<<<<<<<<<
11125  * [arg_2doArray,
11126  * counts_out,
11127  */
11128  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_comm, __pyx_n_s_Gatherv); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 673, __pyx_L1_error)
11129  __Pyx_GOTREF(__pyx_t_15);
11130 
11131  /* "mprans/MeshSmoothing.pyx":675
11132  * comm.Gatherv(arg_2rank_values,
11133  * [arg_2doArray,
11134  * counts_out, # <<<<<<<<<<<<<<
11135  * displacements_out,
11136  * datatype],
11137  */
11138  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_counts_out, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 675, __pyx_L1_error)
11139  __Pyx_GOTREF(__pyx_t_5);
11140 
11141  /* "mprans/MeshSmoothing.pyx":676
11142  * [arg_2doArray,
11143  * counts_out,
11144  * displacements_out, # <<<<<<<<<<<<<<
11145  * datatype],
11146  * root=rank_recv)
11147  */
11148  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_displacements_out, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __pyx_L1_error)
11149  __Pyx_GOTREF(__pyx_t_1);
11150 
11151  /* "mprans/MeshSmoothing.pyx":674
11152  * datatype = MPI.DOUBLE
11153  * comm.Gatherv(arg_2rank_values,
11154  * [arg_2doArray, # <<<<<<<<<<<<<<
11155  * counts_out,
11156  * displacements_out,
11157  */
11158  __pyx_t_20 = PyList_New(4); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 674, __pyx_L1_error)
11159  __Pyx_GOTREF(__pyx_t_20);
11160  __Pyx_INCREF(__pyx_v_arg_2doArray);
11161  __Pyx_GIVEREF(__pyx_v_arg_2doArray);
11162  PyList_SET_ITEM(__pyx_t_20, 0, __pyx_v_arg_2doArray);
11163  __Pyx_GIVEREF(__pyx_t_5);
11164  PyList_SET_ITEM(__pyx_t_20, 1, __pyx_t_5);
11165  __Pyx_GIVEREF(__pyx_t_1);
11166  PyList_SET_ITEM(__pyx_t_20, 2, __pyx_t_1);
11167  __Pyx_INCREF(__pyx_v_datatype);
11168  __Pyx_GIVEREF(__pyx_v_datatype);
11169  PyList_SET_ITEM(__pyx_t_20, 3, __pyx_v_datatype);
11170  __pyx_t_5 = 0;
11171  __pyx_t_1 = 0;
11172 
11173  /* "mprans/MeshSmoothing.pyx":673
11174  * else:
11175  * datatype = MPI.DOUBLE
11176  * comm.Gatherv(arg_2rank_values, # <<<<<<<<<<<<<<
11177  * [arg_2doArray,
11178  * counts_out,
11179  */
11180  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 673, __pyx_L1_error)
11181  __Pyx_GOTREF(__pyx_t_1);
11182  __Pyx_INCREF(__pyx_v_arg_2rank_values);
11183  __Pyx_GIVEREF(__pyx_v_arg_2rank_values);
11184  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arg_2rank_values);
11185  __Pyx_GIVEREF(__pyx_t_20);
11186  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_20);
11187  __pyx_t_20 = 0;
11188 
11189  /* "mprans/MeshSmoothing.pyx":678
11190  * displacements_out,
11191  * datatype],
11192  * root=rank_recv) # <<<<<<<<<<<<<<
11193  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
11194  * for iN in range(nNodes_owned, nNodes_global):
11195  */
11196  __pyx_t_20 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 678, __pyx_L1_error)
11197  __Pyx_GOTREF(__pyx_t_20);
11198  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_rank_recv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 678, __pyx_L1_error)
11199  __Pyx_GOTREF(__pyx_t_5);
11200  if (PyDict_SetItem(__pyx_t_20, __pyx_n_s_root, __pyx_t_5) < 0) __PYX_ERR(0, 678, __pyx_L1_error)
11201  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11202 
11203  /* "mprans/MeshSmoothing.pyx":673
11204  * else:
11205  * datatype = MPI.DOUBLE
11206  * comm.Gatherv(arg_2rank_values, # <<<<<<<<<<<<<<
11207  * [arg_2doArray,
11208  * counts_out,
11209  */
11210  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_1, __pyx_t_20); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 673, __pyx_L1_error)
11211  __Pyx_GOTREF(__pyx_t_5);
11212  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
11213  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11214  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11215  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11216  }
11217 
11218  /* "mprans/MeshSmoothing.pyx":680
11219  * root=rank_recv)
11220  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
11221  * for iN in range(nNodes_owned, nNodes_global): # <<<<<<<<<<<<<<
11222  * if arg_shape_len > 1:
11223  * for ii in range(arg_shape[1]):
11224  */
11225  __pyx_t_7 = __pyx_v_nNodes_global;
11226  __pyx_t_10 = __pyx_t_7;
11227  for (__pyx_t_13 = __pyx_v_nNodes_owned; __pyx_t_13 < __pyx_t_10; __pyx_t_13+=1) {
11228  __pyx_v_iN = __pyx_t_13;
11229 
11230  /* "mprans/MeshSmoothing.pyx":681
11231  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
11232  * for iN in range(nNodes_owned, nNodes_global):
11233  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
11234  * for ii in range(arg_shape[1]):
11235  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11236  */
11237  __pyx_t_9 = ((__pyx_v_arg_shape_len > 1) != 0);
11238  if (__pyx_t_9) {
11239 
11240  /* "mprans/MeshSmoothing.pyx":682
11241  * for iN in range(nNodes_owned, nNodes_global):
11242  * if arg_shape_len > 1:
11243  * for ii in range(arg_shape[1]): # <<<<<<<<<<<<<<
11244  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11245  * else:
11246  */
11247  __pyx_t_16 = 1;
11248  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_arg_shape.shape[0];
11249  __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_arg_shape.data + __pyx_t_16 * __pyx_v_arg_shape.strides[0]) )));
11250  __pyx_t_18 = __pyx_t_14;
11251  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {
11252  __pyx_v_ii = __pyx_t_19;
11253 
11254  /* "mprans/MeshSmoothing.pyx":683
11255  * if arg_shape_len > 1:
11256  * for ii in range(arg_shape[1]):
11257  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii] # <<<<<<<<<<<<<<
11258  * else:
11259  * args_[iN] = arg_2doArray[iN-nNodes_owned]
11260  */
11261  __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_iN - __pyx_v_nNodes_owned)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
11262  __Pyx_GOTREF(__pyx_t_5);
11263  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 683, __pyx_L1_error)
11264  __Pyx_GOTREF(__pyx_t_20);
11265  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
11266  __Pyx_GOTREF(__pyx_t_1);
11267  __Pyx_GIVEREF(__pyx_t_5);
11268  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
11269  __Pyx_GIVEREF(__pyx_t_20);
11270  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_20);
11271  __pyx_t_5 = 0;
11272  __pyx_t_20 = 0;
11273  __pyx_t_20 = __Pyx_PyObject_GetItem(__pyx_v_arg_2doArray, __pyx_t_1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 683, __pyx_L1_error)
11274  __Pyx_GOTREF(__pyx_t_20);
11275  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11276  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_iN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error)
11277  __Pyx_GOTREF(__pyx_t_1);
11278  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 683, __pyx_L1_error)
11279  __Pyx_GOTREF(__pyx_t_5);
11280  __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 683, __pyx_L1_error)
11281  __Pyx_GOTREF(__pyx_t_15);
11282  __Pyx_GIVEREF(__pyx_t_1);
11283  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1);
11284  __Pyx_GIVEREF(__pyx_t_5);
11285  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_5);
11286  __pyx_t_1 = 0;
11287  __pyx_t_5 = 0;
11288  if (unlikely(PyObject_SetItem(__pyx_v_args_, __pyx_t_15, __pyx_t_20) < 0)) __PYX_ERR(0, 683, __pyx_L1_error)
11289  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
11290  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11291  }
11292 
11293  /* "mprans/MeshSmoothing.pyx":681
11294  * # FINALLY APPLY FINAL POSITION OF NON-OWNED NODES
11295  * for iN in range(nNodes_owned, nNodes_global):
11296  * if arg_shape_len > 1: # <<<<<<<<<<<<<<
11297  * for ii in range(arg_shape[1]):
11298  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11299  */
11300  goto __pyx_L34;
11301  }
11302 
11303  /* "mprans/MeshSmoothing.pyx":685
11304  * args_[iN, ii] = arg_2doArray[iN-nNodes_owned, ii]
11305  * else:
11306  * args_[iN] = arg_2doArray[iN-nNodes_owned] # <<<<<<<<<<<<<<
11307  * # logEvent('Non-owned values recovered with {comm_total} communication steps ({comm_pp}*{nproc})'.format(comm_total=str(comm_size*4),
11308  * # comm_pp=str(4),
11309  */
11310  /*else*/ {
11311  __pyx_t_14 = (__pyx_v_iN - __pyx_v_nNodes_owned);
11312  __pyx_t_20 = __Pyx_GetItemInt(__pyx_v_arg_2doArray, __pyx_t_14, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 685, __pyx_L1_error)
11313  __Pyx_GOTREF(__pyx_t_20);
11314  if (unlikely(__Pyx_SetItemInt(__pyx_v_args_, __pyx_v_iN, __pyx_t_20, int, 1, __Pyx_PyInt_From_int, 0, 1, 0) < 0)) __PYX_ERR(0, 685, __pyx_L1_error)
11315  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
11316  }
11317  __pyx_L34:;
11318  }
11319 
11320  /* "mprans/MeshSmoothing.pyx":592
11321  * for i in range(1, arg_shape_len):
11322  * shape_factor = shape_factor*arg_shape[i]
11323  * if comm_size > 1: # <<<<<<<<<<<<<<
11324  * for rank in range(comm_size):
11325  * nodes_2rank[rank] = np.zeros(0, dtype=np.int32)
11326  */
11327  }
11328 
11329  /* "mprans/MeshSmoothing.pyx":559
11330  * nNodes=nNodes)
11331  *
11332  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
11333  * int nNodes_owned,
11334  * int nNodes_global,
11335  */
11336 
11337  /* function exit code */
11338  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11339  goto __pyx_L0;
11340  __pyx_L1_error:;
11341  __Pyx_XDECREF(__pyx_t_1);
11342  __Pyx_XDECREF(__pyx_t_2);
11343  __Pyx_XDECREF(__pyx_t_3);
11344  __Pyx_XDECREF(__pyx_t_4);
11345  __Pyx_XDECREF(__pyx_t_5);
11346  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
11347  __Pyx_XDECREF(__pyx_t_15);
11348  __Pyx_XDECREF(__pyx_t_20);
11349  __Pyx_AddTraceback("mprans.MeshSmoothing.getNonOwnedNodeValues", __pyx_clineno, __pyx_lineno, __pyx_filename);
11350  __pyx_r = NULL;
11351  __pyx_L0:;
11352  __Pyx_XDECREF(__pyx_v_Comm);
11353  __Pyx_XDECREF(__pyx_v_comm);
11354  __Pyx_XDECREF(__pyx_v_arg_2rank);
11355  __Pyx_XDECREF(__pyx_v_nodes_2rank);
11356  __PYX_XDEC_MEMVIEW(&__pyx_v_result, 1);
11357  __PYX_XDEC_MEMVIEW(&__pyx_v_counts_in, 1);
11358  __PYX_XDEC_MEMVIEW(&__pyx_v_displacements_in, 1);
11359  __PYX_XDEC_MEMVIEW(&__pyx_v_counts_out, 1);
11360  __PYX_XDEC_MEMVIEW(&__pyx_v_displacements_out, 1);
11361  __PYX_XDEC_MEMVIEW(&__pyx_v_arg_shape, 1);
11362  __PYX_XDEC_MEMVIEW(&__pyx_v_arg_shape_copy, 1);
11363  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2rank_values, 1);
11364  __PYX_XDEC_MEMVIEW(&__pyx_v_nodes_2doArray, 1);
11365  __Pyx_XDECREF(__pyx_v_array_size);
11366  __Pyx_XDECREF(__pyx_v_my_size);
11367  __Pyx_XDECREF(__pyx_v_arg_2rank_values);
11368  __Pyx_XDECREF(__pyx_v_arg_2doArray);
11369  __Pyx_XDECREF(__pyx_v_datatype);
11370  __Pyx_XDECREF(__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_2generator);
11371  __Pyx_XDECREF(__pyx_gb_6mprans_13MeshSmoothing_21getNonOwnedNodeValues_5generator1);
11372  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeNumbering_subdomain2global, 1);
11373  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeOffsets_subdomain_owned, 1);
11374  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
11375  __Pyx_XGIVEREF(__pyx_r);
11376  __Pyx_RefNannyFinishContext();
11377  return __pyx_r;
11378 }
11379 
11380 /* "mprans/MeshSmoothing.pyx":690
11381  * # nproc=str(comm_size)))
11382  *
11383  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
11384  * int rank,
11385  * int nVariables_owned,
11386  */
11387 
11388 /* Python wrapper */
11389 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_55checkOwnedVariable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11390 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_55checkOwnedVariable = {"checkOwnedVariable", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_55checkOwnedVariable, METH_VARARGS|METH_KEYWORDS, 0};
11391 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_55checkOwnedVariable(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11392  int __pyx_v_variable_nb_local;
11393  int __pyx_v_rank;
11394  int __pyx_v_nVariables_owned;
11395  __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global = { 0, 0, { 0 }, { 0 }, { 0 } };
11396  __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned = { 0, 0, { 0 }, { 0 }, { 0 } };
11397  int __pyx_lineno = 0;
11398  const char *__pyx_filename = NULL;
11399  int __pyx_clineno = 0;
11400  PyObject *__pyx_r = 0;
11401  __Pyx_RefNannyDeclarations
11402  __Pyx_RefNannySetupContext("checkOwnedVariable (wrapper)", 0);
11403  {
11404  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_variable_nb_local,&__pyx_n_s_rank,&__pyx_n_s_nVariables_owned,&__pyx_n_s_variableNumbering_subdomain2glob,&__pyx_n_s_variableOffsets_subdomain_owned,0};
11405  PyObject* values[5] = {0,0,0,0,0};
11406  if (unlikely(__pyx_kwds)) {
11407  Py_ssize_t kw_args;
11408  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11409  switch (pos_args) {
11410  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11411  CYTHON_FALLTHROUGH;
11412  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11413  CYTHON_FALLTHROUGH;
11414  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11415  CYTHON_FALLTHROUGH;
11416  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11417  CYTHON_FALLTHROUGH;
11418  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11419  CYTHON_FALLTHROUGH;
11420  case 0: break;
11421  default: goto __pyx_L5_argtuple_error;
11422  }
11423  kw_args = PyDict_Size(__pyx_kwds);
11424  switch (pos_args) {
11425  case 0:
11426  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variable_nb_local)) != 0)) kw_args--;
11427  else goto __pyx_L5_argtuple_error;
11428  CYTHON_FALLTHROUGH;
11429  case 1:
11430  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank)) != 0)) kw_args--;
11431  else {
11432  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 1); __PYX_ERR(0, 690, __pyx_L3_error)
11433  }
11434  CYTHON_FALLTHROUGH;
11435  case 2:
11436  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nVariables_owned)) != 0)) kw_args--;
11437  else {
11438  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 2); __PYX_ERR(0, 690, __pyx_L3_error)
11439  }
11440  CYTHON_FALLTHROUGH;
11441  case 3:
11442  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variableNumbering_subdomain2glob)) != 0)) kw_args--;
11443  else {
11444  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 3); __PYX_ERR(0, 690, __pyx_L3_error)
11445  }
11446  CYTHON_FALLTHROUGH;
11447  case 4:
11448  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_variableOffsets_subdomain_owned)) != 0)) kw_args--;
11449  else {
11450  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, 4); __PYX_ERR(0, 690, __pyx_L3_error)
11451  }
11452  }
11453  if (unlikely(kw_args > 0)) {
11454  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "checkOwnedVariable") < 0)) __PYX_ERR(0, 690, __pyx_L3_error)
11455  }
11456  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
11457  goto __pyx_L5_argtuple_error;
11458  } else {
11459  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11460  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11461  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11462  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11463  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11464  }
11465  __pyx_v_variable_nb_local = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_variable_nb_local == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L3_error)
11466  __pyx_v_rank = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_rank == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 691, __pyx_L3_error)
11467  __pyx_v_nVariables_owned = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_nVariables_owned == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 692, __pyx_L3_error)
11468  __pyx_v_variableNumbering_subdomain2global = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_variableNumbering_subdomain2global.memview)) __PYX_ERR(0, 693, __pyx_L3_error)
11469  __pyx_v_variableOffsets_subdomain_owned = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_variableOffsets_subdomain_owned.memview)) __PYX_ERR(0, 694, __pyx_L3_error)
11470  }
11471  goto __pyx_L4_argument_unpacking_done;
11472  __pyx_L5_argtuple_error:;
11473  __Pyx_RaiseArgtupleInvalid("checkOwnedVariable", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 690, __pyx_L3_error)
11474  __pyx_L3_error:;
11475  __Pyx_AddTraceback("mprans.MeshSmoothing.checkOwnedVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
11476  __Pyx_RefNannyFinishContext();
11477  return NULL;
11478  __pyx_L4_argument_unpacking_done:;
11479  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_54checkOwnedVariable(__pyx_self, __pyx_v_variable_nb_local, __pyx_v_rank, __pyx_v_nVariables_owned, __pyx_v_variableNumbering_subdomain2global, __pyx_v_variableOffsets_subdomain_owned);
11480 
11481  /* function exit code */
11482  __Pyx_RefNannyFinishContext();
11483  return __pyx_r;
11484 }
11485 
11486 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_54checkOwnedVariable(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_variable_nb_local, int __pyx_v_rank, int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
11487  PyObject *__pyx_r = NULL;
11488  __Pyx_RefNannyDeclarations
11489  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11490  PyObject *__pyx_t_2 = NULL;
11491  int __pyx_lineno = 0;
11492  const char *__pyx_filename = NULL;
11493  int __pyx_clineno = 0;
11494  __Pyx_RefNannySetupContext("checkOwnedVariable", 0);
11495 
11496  /* "mprans/MeshSmoothing.pyx":695
11497  * int[:] variableNumbering_subdomain2global,
11498  * int[:] variableOffsets_subdomain_owned):
11499  * return cyCheckOwnedVariable(variable_nb_local=variable_nb_local, # <<<<<<<<<<<<<<
11500  * rank=rank,
11501  * nVariables_owned=nVariables_owned,
11502  */
11503  __Pyx_XDECREF(__pyx_r);
11504 
11505  /* "mprans/MeshSmoothing.pyx":699
11506  * nVariables_owned=nVariables_owned,
11507  * variableNumbering_subdomain2global=variableNumbering_subdomain2global,
11508  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned) # <<<<<<<<<<<<<<
11509  *
11510  * def pyScalarRecoveryAtNodes(double[:] scalars,
11511  */
11512  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(__pyx_v_variable_nb_local, __pyx_v_rank, __pyx_v_nVariables_owned, __pyx_v_variableNumbering_subdomain2global, __pyx_v_variableOffsets_subdomain_owned); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 695, __pyx_L1_error)
11513 
11514  /* "mprans/MeshSmoothing.pyx":695
11515  * int[:] variableNumbering_subdomain2global,
11516  * int[:] variableOffsets_subdomain_owned):
11517  * return cyCheckOwnedVariable(variable_nb_local=variable_nb_local, # <<<<<<<<<<<<<<
11518  * rank=rank,
11519  * nVariables_owned=nVariables_owned,
11520  */
11521  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error)
11522  __Pyx_GOTREF(__pyx_t_2);
11523  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11524  __pyx_t_1.memview = NULL;
11525  __pyx_t_1.data = NULL;
11526  __pyx_r = __pyx_t_2;
11527  __pyx_t_2 = 0;
11528  goto __pyx_L0;
11529 
11530  /* "mprans/MeshSmoothing.pyx":690
11531  * # nproc=str(comm_size)))
11532  *
11533  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
11534  * int rank,
11535  * int nVariables_owned,
11536  */
11537 
11538  /* function exit code */
11539  __pyx_L1_error:;
11540  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11541  __Pyx_XDECREF(__pyx_t_2);
11542  __Pyx_AddTraceback("mprans.MeshSmoothing.checkOwnedVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
11543  __pyx_r = NULL;
11544  __pyx_L0:;
11545  __PYX_XDEC_MEMVIEW(&__pyx_v_variableNumbering_subdomain2global, 1);
11546  __PYX_XDEC_MEMVIEW(&__pyx_v_variableOffsets_subdomain_owned, 1);
11547  __Pyx_XGIVEREF(__pyx_r);
11548  __Pyx_RefNannyFinishContext();
11549  return __pyx_r;
11550 }
11551 
11552 /* "mprans/MeshSmoothing.pyx":701
11553  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
11554  *
11555  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
11556  * int[:] nodeElementsArray,
11557  * int[:] nodeElementOffsets):
11558  */
11559 
11560 /* Python wrapper */
11561 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11562 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes = {"pyScalarRecoveryAtNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes, METH_VARARGS|METH_KEYWORDS, 0};
11563 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11564  __Pyx_memviewslice __pyx_v_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
11565  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
11566  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
11567  int __pyx_lineno = 0;
11568  const char *__pyx_filename = NULL;
11569  int __pyx_clineno = 0;
11570  PyObject *__pyx_r = 0;
11571  __Pyx_RefNannyDeclarations
11572  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodes (wrapper)", 0);
11573  {
11574  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_scalars,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,0};
11575  PyObject* values[3] = {0,0,0};
11576  if (unlikely(__pyx_kwds)) {
11577  Py_ssize_t kw_args;
11578  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11579  switch (pos_args) {
11580  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11581  CYTHON_FALLTHROUGH;
11582  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11583  CYTHON_FALLTHROUGH;
11584  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11585  CYTHON_FALLTHROUGH;
11586  case 0: break;
11587  default: goto __pyx_L5_argtuple_error;
11588  }
11589  kw_args = PyDict_Size(__pyx_kwds);
11590  switch (pos_args) {
11591  case 0:
11592  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scalars)) != 0)) kw_args--;
11593  else goto __pyx_L5_argtuple_error;
11594  CYTHON_FALLTHROUGH;
11595  case 1:
11596  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11597  else {
11598  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodes", 1, 3, 3, 1); __PYX_ERR(0, 701, __pyx_L3_error)
11599  }
11600  CYTHON_FALLTHROUGH;
11601  case 2:
11602  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11603  else {
11604  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodes", 1, 3, 3, 2); __PYX_ERR(0, 701, __pyx_L3_error)
11605  }
11606  }
11607  if (unlikely(kw_args > 0)) {
11608  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyScalarRecoveryAtNodes") < 0)) __PYX_ERR(0, 701, __pyx_L3_error)
11609  }
11610  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
11611  goto __pyx_L5_argtuple_error;
11612  } else {
11613  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11614  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11615  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11616  }
11617  __pyx_v_scalars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scalars.memview)) __PYX_ERR(0, 701, __pyx_L3_error)
11618  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 702, __pyx_L3_error)
11619  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 703, __pyx_L3_error)
11620  }
11621  goto __pyx_L4_argument_unpacking_done;
11622  __pyx_L5_argtuple_error:;
11623  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodes", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 701, __pyx_L3_error)
11624  __pyx_L3_error:;
11625  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11626  __Pyx_RefNannyFinishContext();
11627  return NULL;
11628  __pyx_L4_argument_unpacking_done:;
11629  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_56pyScalarRecoveryAtNodes(__pyx_self, __pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets);
11630 
11631  /* function exit code */
11632  __Pyx_RefNannyFinishContext();
11633  return __pyx_r;
11634 }
11635 
11636 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_56pyScalarRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets) {
11637  PyObject *__pyx_r = NULL;
11638  __Pyx_RefNannyDeclarations
11639  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11640  PyObject *__pyx_t_2 = NULL;
11641  int __pyx_lineno = 0;
11642  const char *__pyx_filename = NULL;
11643  int __pyx_clineno = 0;
11644  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodes", 0);
11645 
11646  /* "mprans/MeshSmoothing.pyx":704
11647  * int[:] nodeElementsArray,
11648  * int[:] nodeElementOffsets):
11649  * return cyScalarRecoveryAtNodes(scalars=scalars, # <<<<<<<<<<<<<<
11650  * nodeElementsArray=nodeElementsArray,
11651  * nodeElementOffsets=nodeElementOffsets)
11652  */
11653  __Pyx_XDECREF(__pyx_r);
11654 
11655  /* "mprans/MeshSmoothing.pyx":706
11656  * return cyScalarRecoveryAtNodes(scalars=scalars,
11657  * nodeElementsArray=nodeElementsArray,
11658  * nodeElementOffsets=nodeElementOffsets) # <<<<<<<<<<<<<<
11659  *
11660  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars,
11661  */
11662  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes(__pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 704, __pyx_L1_error)
11663 
11664  /* "mprans/MeshSmoothing.pyx":704
11665  * int[:] nodeElementsArray,
11666  * int[:] nodeElementOffsets):
11667  * return cyScalarRecoveryAtNodes(scalars=scalars, # <<<<<<<<<<<<<<
11668  * nodeElementsArray=nodeElementsArray,
11669  * nodeElementOffsets=nodeElementOffsets)
11670  */
11671  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
11672  __Pyx_GOTREF(__pyx_t_2);
11673  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11674  __pyx_t_1.memview = NULL;
11675  __pyx_t_1.data = NULL;
11676  __pyx_r = __pyx_t_2;
11677  __pyx_t_2 = 0;
11678  goto __pyx_L0;
11679 
11680  /* "mprans/MeshSmoothing.pyx":701
11681  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
11682  *
11683  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
11684  * int[:] nodeElementsArray,
11685  * int[:] nodeElementOffsets):
11686  */
11687 
11688  /* function exit code */
11689  __pyx_L1_error:;
11690  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11691  __Pyx_XDECREF(__pyx_t_2);
11692  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11693  __pyx_r = NULL;
11694  __pyx_L0:;
11695  __PYX_XDEC_MEMVIEW(&__pyx_v_scalars, 1);
11696  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
11697  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
11698  __Pyx_XGIVEREF(__pyx_r);
11699  __Pyx_RefNannyFinishContext();
11700  return __pyx_r;
11701 }
11702 
11703 /* "mprans/MeshSmoothing.pyx":708
11704  * nodeElementOffsets=nodeElementOffsets)
11705  *
11706  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
11707  * int[:] nodeElementsArray,
11708  * int[:] nodeElementOffsets,
11709  */
11710 
11711 /* Python wrapper */
11712 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11713 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted = {"pyScalarRecoveryAtNodesWeighted", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted, METH_VARARGS|METH_KEYWORDS, 0};
11714 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11715  __Pyx_memviewslice __pyx_v_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
11716  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
11717  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
11718  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
11719  int __pyx_v_nNodes;
11720  int __pyx_lineno = 0;
11721  const char *__pyx_filename = NULL;
11722  int __pyx_clineno = 0;
11723  PyObject *__pyx_r = 0;
11724  __Pyx_RefNannyDeclarations
11725  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodesWeighted (wrapper)", 0);
11726  {
11727  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_scalars,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_detJ_array,&__pyx_n_s_nNodes,0};
11728  PyObject* values[5] = {0,0,0,0,0};
11729  if (unlikely(__pyx_kwds)) {
11730  Py_ssize_t kw_args;
11731  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11732  switch (pos_args) {
11733  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11734  CYTHON_FALLTHROUGH;
11735  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11736  CYTHON_FALLTHROUGH;
11737  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11738  CYTHON_FALLTHROUGH;
11739  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11740  CYTHON_FALLTHROUGH;
11741  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11742  CYTHON_FALLTHROUGH;
11743  case 0: break;
11744  default: goto __pyx_L5_argtuple_error;
11745  }
11746  kw_args = PyDict_Size(__pyx_kwds);
11747  switch (pos_args) {
11748  case 0:
11749  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scalars)) != 0)) kw_args--;
11750  else goto __pyx_L5_argtuple_error;
11751  CYTHON_FALLTHROUGH;
11752  case 1:
11753  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11754  else {
11755  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 1); __PYX_ERR(0, 708, __pyx_L3_error)
11756  }
11757  CYTHON_FALLTHROUGH;
11758  case 2:
11759  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11760  else {
11761  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 2); __PYX_ERR(0, 708, __pyx_L3_error)
11762  }
11763  CYTHON_FALLTHROUGH;
11764  case 3:
11765  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
11766  else {
11767  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 3); __PYX_ERR(0, 708, __pyx_L3_error)
11768  }
11769  CYTHON_FALLTHROUGH;
11770  case 4:
11771  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nNodes)) != 0)) kw_args--;
11772  else {
11773  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, 4); __PYX_ERR(0, 708, __pyx_L3_error)
11774  }
11775  }
11776  if (unlikely(kw_args > 0)) {
11777  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyScalarRecoveryAtNodesWeighted") < 0)) __PYX_ERR(0, 708, __pyx_L3_error)
11778  }
11779  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
11780  goto __pyx_L5_argtuple_error;
11781  } else {
11782  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11783  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11784  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11785  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11786  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
11787  }
11788  __pyx_v_scalars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_scalars.memview)) __PYX_ERR(0, 708, __pyx_L3_error)
11789  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 709, __pyx_L3_error)
11790  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 710, __pyx_L3_error)
11791  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 711, __pyx_L3_error)
11792  __pyx_v_nNodes = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nNodes == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 712, __pyx_L3_error)
11793  }
11794  goto __pyx_L4_argument_unpacking_done;
11795  __pyx_L5_argtuple_error:;
11796  __Pyx_RaiseArgtupleInvalid("pyScalarRecoveryAtNodesWeighted", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 708, __pyx_L3_error)
11797  __pyx_L3_error:;
11798  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
11799  __Pyx_RefNannyFinishContext();
11800  return NULL;
11801  __pyx_L4_argument_unpacking_done:;
11802  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_58pyScalarRecoveryAtNodesWeighted(__pyx_self, __pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nNodes);
11803 
11804  /* function exit code */
11805  __Pyx_RefNannyFinishContext();
11806  return __pyx_r;
11807 }
11808 
11809 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_58pyScalarRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nNodes) {
11810  PyObject *__pyx_r = NULL;
11811  __Pyx_RefNannyDeclarations
11812  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11813  PyObject *__pyx_t_2 = NULL;
11814  int __pyx_lineno = 0;
11815  const char *__pyx_filename = NULL;
11816  int __pyx_clineno = 0;
11817  __Pyx_RefNannySetupContext("pyScalarRecoveryAtNodesWeighted", 0);
11818 
11819  /* "mprans/MeshSmoothing.pyx":713
11820  * double[:] detJ_array,
11821  * int nNodes):
11822  * return cyScalarRecoveryAtNodesWeighted(scalars=scalars, # <<<<<<<<<<<<<<
11823  * nodeElementsArray=nodeElementsArray,
11824  * nodeElementOffsets=nodeElementOffsets,
11825  */
11826  __Pyx_XDECREF(__pyx_r);
11827 
11828  /* "mprans/MeshSmoothing.pyx":717
11829  * nodeElementOffsets=nodeElementOffsets,
11830  * detJ_array=detJ_array,
11831  * nNodes=nNodes) # <<<<<<<<<<<<<<
11832  *
11833  * def pyVectorRecoveryAtNodes(vectors,
11834  */
11835  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted(__pyx_v_scalars, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nNodes); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 713, __pyx_L1_error)
11836 
11837  /* "mprans/MeshSmoothing.pyx":713
11838  * double[:] detJ_array,
11839  * int nNodes):
11840  * return cyScalarRecoveryAtNodesWeighted(scalars=scalars, # <<<<<<<<<<<<<<
11841  * nodeElementsArray=nodeElementsArray,
11842  * nodeElementOffsets=nodeElementOffsets,
11843  */
11844  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
11845  __Pyx_GOTREF(__pyx_t_2);
11846  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11847  __pyx_t_1.memview = NULL;
11848  __pyx_t_1.data = NULL;
11849  __pyx_r = __pyx_t_2;
11850  __pyx_t_2 = 0;
11851  goto __pyx_L0;
11852 
11853  /* "mprans/MeshSmoothing.pyx":708
11854  * nodeElementOffsets=nodeElementOffsets)
11855  *
11856  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
11857  * int[:] nodeElementsArray,
11858  * int[:] nodeElementOffsets,
11859  */
11860 
11861  /* function exit code */
11862  __pyx_L1_error:;
11863  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
11864  __Pyx_XDECREF(__pyx_t_2);
11865  __Pyx_AddTraceback("mprans.MeshSmoothing.pyScalarRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
11866  __pyx_r = NULL;
11867  __pyx_L0:;
11868  __PYX_XDEC_MEMVIEW(&__pyx_v_scalars, 1);
11869  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
11870  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
11871  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
11872  __Pyx_XGIVEREF(__pyx_r);
11873  __Pyx_RefNannyFinishContext();
11874  return __pyx_r;
11875 }
11876 
11877 /* "mprans/MeshSmoothing.pyx":719
11878  * nNodes=nNodes)
11879  *
11880  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
11881  * nodeElementsArray,
11882  * nodeElementOffsets,
11883  */
11884 
11885 /* Python wrapper */
11886 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11887 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes = {"pyVectorRecoveryAtNodes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes, METH_VARARGS|METH_KEYWORDS, 0};
11888 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11889  PyObject *__pyx_v_vectors = 0;
11890  PyObject *__pyx_v_nodeElementsArray = 0;
11891  PyObject *__pyx_v_nodeElementOffsets = 0;
11892  PyObject *__pyx_v_nd = 0;
11893  int __pyx_lineno = 0;
11894  const char *__pyx_filename = NULL;
11895  int __pyx_clineno = 0;
11896  PyObject *__pyx_r = 0;
11897  __Pyx_RefNannyDeclarations
11898  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodes (wrapper)", 0);
11899  {
11900  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vectors,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_nd,0};
11901  PyObject* values[4] = {0,0,0,0};
11902  if (unlikely(__pyx_kwds)) {
11903  Py_ssize_t kw_args;
11904  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11905  switch (pos_args) {
11906  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11907  CYTHON_FALLTHROUGH;
11908  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11909  CYTHON_FALLTHROUGH;
11910  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11911  CYTHON_FALLTHROUGH;
11912  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11913  CYTHON_FALLTHROUGH;
11914  case 0: break;
11915  default: goto __pyx_L5_argtuple_error;
11916  }
11917  kw_args = PyDict_Size(__pyx_kwds);
11918  switch (pos_args) {
11919  case 0:
11920  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vectors)) != 0)) kw_args--;
11921  else goto __pyx_L5_argtuple_error;
11922  CYTHON_FALLTHROUGH;
11923  case 1:
11924  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
11925  else {
11926  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, 1); __PYX_ERR(0, 719, __pyx_L3_error)
11927  }
11928  CYTHON_FALLTHROUGH;
11929  case 2:
11930  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
11931  else {
11932  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, 2); __PYX_ERR(0, 719, __pyx_L3_error)
11933  }
11934  CYTHON_FALLTHROUGH;
11935  case 3:
11936  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
11937  else {
11938  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, 3); __PYX_ERR(0, 719, __pyx_L3_error)
11939  }
11940  }
11941  if (unlikely(kw_args > 0)) {
11942  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyVectorRecoveryAtNodes") < 0)) __PYX_ERR(0, 719, __pyx_L3_error)
11943  }
11944  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
11945  goto __pyx_L5_argtuple_error;
11946  } else {
11947  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11948  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
11949  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
11950  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
11951  }
11952  __pyx_v_vectors = values[0];
11953  __pyx_v_nodeElementsArray = values[1];
11954  __pyx_v_nodeElementOffsets = values[2];
11955  __pyx_v_nd = values[3];
11956  }
11957  goto __pyx_L4_argument_unpacking_done;
11958  __pyx_L5_argtuple_error:;
11959  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodes", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 719, __pyx_L3_error)
11960  __pyx_L3_error:;
11961  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
11962  __Pyx_RefNannyFinishContext();
11963  return NULL;
11964  __pyx_L4_argument_unpacking_done:;
11965  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_60pyVectorRecoveryAtNodes(__pyx_self, __pyx_v_vectors, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_nd);
11966 
11967  /* function exit code */
11968  __Pyx_RefNannyFinishContext();
11969  return __pyx_r;
11970 }
11971 
11972 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_60pyVectorRecoveryAtNodes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_vectors, PyObject *__pyx_v_nodeElementsArray, PyObject *__pyx_v_nodeElementOffsets, PyObject *__pyx_v_nd) {
11973  PyObject *__pyx_r = NULL;
11974  __Pyx_RefNannyDeclarations
11975  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
11976  __Pyx_memviewslice __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
11977  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
11978  int __pyx_t_4;
11979  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
11980  PyObject *__pyx_t_6 = NULL;
11981  int __pyx_lineno = 0;
11982  const char *__pyx_filename = NULL;
11983  int __pyx_clineno = 0;
11984  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodes", 0);
11985 
11986  /* "mprans/MeshSmoothing.pyx":723
11987  * nodeElementOffsets,
11988  * nd):
11989  * return cyVectorRecoveryAtNodes(vectors=vectors, # <<<<<<<<<<<<<<
11990  * nodeElementsArray=nodeElementsArray,
11991  * nodeElementOffsets=nodeElementOffsets,
11992  */
11993  __Pyx_XDECREF(__pyx_r);
11994  __pyx_t_1 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_v_vectors, PyBUF_WRITABLE); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 723, __pyx_L1_error)
11995 
11996  /* "mprans/MeshSmoothing.pyx":724
11997  * nd):
11998  * return cyVectorRecoveryAtNodes(vectors=vectors,
11999  * nodeElementsArray=nodeElementsArray, # <<<<<<<<<<<<<<
12000  * nodeElementOffsets=nodeElementOffsets,
12001  * nd=nd)
12002  */
12003  __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_nodeElementsArray, PyBUF_WRITABLE); if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 724, __pyx_L1_error)
12004 
12005  /* "mprans/MeshSmoothing.pyx":725
12006  * return cyVectorRecoveryAtNodes(vectors=vectors,
12007  * nodeElementsArray=nodeElementsArray,
12008  * nodeElementOffsets=nodeElementOffsets, # <<<<<<<<<<<<<<
12009  * nd=nd)
12010  *
12011  */
12012  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_nodeElementOffsets, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 725, __pyx_L1_error)
12013 
12014  /* "mprans/MeshSmoothing.pyx":726
12015  * nodeElementsArray=nodeElementsArray,
12016  * nodeElementOffsets=nodeElementOffsets,
12017  * nd=nd) # <<<<<<<<<<<<<<
12018  *
12019  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors,
12020  */
12021  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_v_nd); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 726, __pyx_L1_error)
12022 
12023  /* "mprans/MeshSmoothing.pyx":723
12024  * nodeElementOffsets,
12025  * nd):
12026  * return cyVectorRecoveryAtNodes(vectors=vectors, # <<<<<<<<<<<<<<
12027  * nodeElementsArray=nodeElementsArray,
12028  * nodeElementOffsets=nodeElementOffsets,
12029  */
12030  __pyx_t_5 = __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 723, __pyx_L1_error)
12031  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
12032  __pyx_t_1.memview = NULL;
12033  __pyx_t_1.data = NULL;
12034  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
12035  __pyx_t_2.memview = NULL;
12036  __pyx_t_2.data = NULL;
12037  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
12038  __pyx_t_3.memview = NULL;
12039  __pyx_t_3.data = NULL;
12040  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_t_5, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 723, __pyx_L1_error)
12041  __Pyx_GOTREF(__pyx_t_6);
12042  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
12043  __pyx_t_5.memview = NULL;
12044  __pyx_t_5.data = NULL;
12045  __pyx_r = __pyx_t_6;
12046  __pyx_t_6 = 0;
12047  goto __pyx_L0;
12048 
12049  /* "mprans/MeshSmoothing.pyx":719
12050  * nNodes=nNodes)
12051  *
12052  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
12053  * nodeElementsArray,
12054  * nodeElementOffsets,
12055  */
12056 
12057  /* function exit code */
12058  __pyx_L1_error:;
12059  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
12060  __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
12061  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
12062  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
12063  __Pyx_XDECREF(__pyx_t_6);
12064  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
12065  __pyx_r = NULL;
12066  __pyx_L0:;
12067  __Pyx_XGIVEREF(__pyx_r);
12068  __Pyx_RefNannyFinishContext();
12069  return __pyx_r;
12070 }
12071 
12072 /* "mprans/MeshSmoothing.pyx":728
12073  * nd=nd)
12074  *
12075  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
12076  * int[:] nodeElementsArray,
12077  * int[:] nodeElementOffsets,
12078  */
12079 
12080 /* Python wrapper */
12081 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12082 static PyMethodDef __pyx_mdef_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted = {"pyVectorRecoveryAtNodesWeighted", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted, METH_VARARGS|METH_KEYWORDS, 0};
12083 static PyObject *__pyx_pw_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12084  __Pyx_memviewslice __pyx_v_vectors = { 0, 0, { 0 }, { 0 }, { 0 } };
12085  __Pyx_memviewslice __pyx_v_nodeElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
12086  __Pyx_memviewslice __pyx_v_nodeElementOffsets = { 0, 0, { 0 }, { 0 }, { 0 } };
12087  __Pyx_memviewslice __pyx_v_detJ_array = { 0, 0, { 0 }, { 0 }, { 0 } };
12088  int __pyx_v_nd;
12089  int __pyx_lineno = 0;
12090  const char *__pyx_filename = NULL;
12091  int __pyx_clineno = 0;
12092  PyObject *__pyx_r = 0;
12093  __Pyx_RefNannyDeclarations
12094  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodesWeighted (wrapper)", 0);
12095  {
12096  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_vectors,&__pyx_n_s_nodeElementsArray,&__pyx_n_s_nodeElementOffsets,&__pyx_n_s_detJ_array,&__pyx_n_s_nd,0};
12097  PyObject* values[5] = {0,0,0,0,0};
12098  if (unlikely(__pyx_kwds)) {
12099  Py_ssize_t kw_args;
12100  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12101  switch (pos_args) {
12102  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12103  CYTHON_FALLTHROUGH;
12104  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12105  CYTHON_FALLTHROUGH;
12106  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12107  CYTHON_FALLTHROUGH;
12108  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12109  CYTHON_FALLTHROUGH;
12110  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12111  CYTHON_FALLTHROUGH;
12112  case 0: break;
12113  default: goto __pyx_L5_argtuple_error;
12114  }
12115  kw_args = PyDict_Size(__pyx_kwds);
12116  switch (pos_args) {
12117  case 0:
12118  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vectors)) != 0)) kw_args--;
12119  else goto __pyx_L5_argtuple_error;
12120  CYTHON_FALLTHROUGH;
12121  case 1:
12122  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementsArray)) != 0)) kw_args--;
12123  else {
12124  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 1); __PYX_ERR(0, 728, __pyx_L3_error)
12125  }
12126  CYTHON_FALLTHROUGH;
12127  case 2:
12128  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nodeElementOffsets)) != 0)) kw_args--;
12129  else {
12130  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 2); __PYX_ERR(0, 728, __pyx_L3_error)
12131  }
12132  CYTHON_FALLTHROUGH;
12133  case 3:
12134  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_detJ_array)) != 0)) kw_args--;
12135  else {
12136  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 3); __PYX_ERR(0, 728, __pyx_L3_error)
12137  }
12138  CYTHON_FALLTHROUGH;
12139  case 4:
12140  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nd)) != 0)) kw_args--;
12141  else {
12142  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, 4); __PYX_ERR(0, 728, __pyx_L3_error)
12143  }
12144  }
12145  if (unlikely(kw_args > 0)) {
12146  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pyVectorRecoveryAtNodesWeighted") < 0)) __PYX_ERR(0, 728, __pyx_L3_error)
12147  }
12148  } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
12149  goto __pyx_L5_argtuple_error;
12150  } else {
12151  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12152  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12153  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12154  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
12155  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
12156  }
12157  __pyx_v_vectors = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vectors.memview)) __PYX_ERR(0, 728, __pyx_L3_error)
12158  __pyx_v_nodeElementsArray = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementsArray.memview)) __PYX_ERR(0, 729, __pyx_L3_error)
12159  __pyx_v_nodeElementOffsets = __Pyx_PyObject_to_MemoryviewSlice_ds_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_nodeElementOffsets.memview)) __PYX_ERR(0, 730, __pyx_L3_error)
12160  __pyx_v_detJ_array = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_detJ_array.memview)) __PYX_ERR(0, 731, __pyx_L3_error)
12161  __pyx_v_nd = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_nd == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L3_error)
12162  }
12163  goto __pyx_L4_argument_unpacking_done;
12164  __pyx_L5_argtuple_error:;
12165  __Pyx_RaiseArgtupleInvalid("pyVectorRecoveryAtNodesWeighted", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 728, __pyx_L3_error)
12166  __pyx_L3_error:;
12167  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
12168  __Pyx_RefNannyFinishContext();
12169  return NULL;
12170  __pyx_L4_argument_unpacking_done:;
12171  __pyx_r = __pyx_pf_6mprans_13MeshSmoothing_62pyVectorRecoveryAtNodesWeighted(__pyx_self, __pyx_v_vectors, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nd);
12172 
12173  /* function exit code */
12174  __Pyx_RefNannyFinishContext();
12175  return __pyx_r;
12176 }
12177 
12178 static PyObject *__pyx_pf_6mprans_13MeshSmoothing_62pyVectorRecoveryAtNodesWeighted(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd) {
12179  PyObject *__pyx_r = NULL;
12180  __Pyx_RefNannyDeclarations
12181  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
12182  PyObject *__pyx_t_2 = NULL;
12183  int __pyx_lineno = 0;
12184  const char *__pyx_filename = NULL;
12185  int __pyx_clineno = 0;
12186  __Pyx_RefNannySetupContext("pyVectorRecoveryAtNodesWeighted", 0);
12187 
12188  /* "mprans/MeshSmoothing.pyx":733
12189  * double[:,:] detJ_array,
12190  * int nd):
12191  * return cyVectorRecoveryAtNodesWeighted(vectors=vectors, # <<<<<<<<<<<<<<
12192  * nodeElementsArray=nodeElementsArray,
12193  * nodeElementOffsets=nodeElementOffsets,
12194  */
12195  __Pyx_XDECREF(__pyx_r);
12196 
12197  /* "mprans/MeshSmoothing.pyx":737
12198  * nodeElementOffsets=nodeElementOffsets,
12199  * detJ_array=detJ_array,
12200  * nd=nd) # <<<<<<<<<<<<<<
12201  *
12202  * ### Cython implementation of functions above
12203  */
12204  __pyx_t_1 = __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted(__pyx_v_vectors, __pyx_v_nodeElementsArray, __pyx_v_nodeElementOffsets, __pyx_v_detJ_array, __pyx_v_nd); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 733, __pyx_L1_error)
12205 
12206  /* "mprans/MeshSmoothing.pyx":733
12207  * double[:,:] detJ_array,
12208  * int nd):
12209  * return cyVectorRecoveryAtNodesWeighted(vectors=vectors, # <<<<<<<<<<<<<<
12210  * nodeElementsArray=nodeElementsArray,
12211  * nodeElementOffsets=nodeElementOffsets,
12212  */
12213  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_1, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error)
12214  __Pyx_GOTREF(__pyx_t_2);
12215  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
12216  __pyx_t_1.memview = NULL;
12217  __pyx_t_1.data = NULL;
12218  __pyx_r = __pyx_t_2;
12219  __pyx_t_2 = 0;
12220  goto __pyx_L0;
12221 
12222  /* "mprans/MeshSmoothing.pyx":728
12223  * nd=nd)
12224  *
12225  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
12226  * int[:] nodeElementsArray,
12227  * int[:] nodeElementOffsets,
12228  */
12229 
12230  /* function exit code */
12231  __pyx_L1_error:;
12232  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
12233  __Pyx_XDECREF(__pyx_t_2);
12234  __Pyx_AddTraceback("mprans.MeshSmoothing.pyVectorRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
12235  __pyx_r = NULL;
12236  __pyx_L0:;
12237  __PYX_XDEC_MEMVIEW(&__pyx_v_vectors, 1);
12238  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementsArray, 1);
12239  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeElementOffsets, 1);
12240  __PYX_XDEC_MEMVIEW(&__pyx_v_detJ_array, 1);
12241  __Pyx_XGIVEREF(__pyx_r);
12242  __Pyx_RefNannyFinishContext();
12243  return __pyx_r;
12244 }
12245 
12246 /* "mprans/MeshSmoothing.pyx":741
12247  * ### Cython implementation of functions above
12248  *
12249  * cdef void cySmoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
12250  * int[:] nodeStarOffsets,
12251  * int[:] nodeStarArray,
12252  */
12253 
12254 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace(__Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes_owned, int __pyx_v_nd, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace *__pyx_optional_args) {
12255 
12256  /* "mprans/MeshSmoothing.pyx":747
12257  * int nNodes_owned,
12258  * int nd,
12259  * bool simultaneous=False, # <<<<<<<<<<<<<<
12260  * bool smoothBoundaries=True,
12261  * int[:] fixedNodesBoolArray=None,
12262  */
12263  bool __pyx_v_simultaneous = ((bool)0);
12264 
12265  /* "mprans/MeshSmoothing.pyx":748
12266  * int nd,
12267  * bool simultaneous=False,
12268  * bool smoothBoundaries=True, # <<<<<<<<<<<<<<
12269  * int[:] fixedNodesBoolArray=None,
12270  * double alpha=0.):
12271  */
12272  bool __pyx_v_smoothBoundaries = ((bool)1);
12273  __Pyx_memviewslice __pyx_v_fixedNodesBoolArray = __pyx_k__5;
12274  double __pyx_v_alpha = ((double)0.);
12275  __Pyx_memviewslice __pyx_v_nodeArray0 = { 0, 0, { 0 }, { 0 }, { 0 } };
12276  double __pyx_v_sum_star[3];
12277  int __pyx_v_nNodes;
12278  bool __pyx_v_fixed_node;
12279  __Pyx_memviewslice __pyx_v_fixed_dir = { 0, 0, { 0 }, { 0 }, { 0 } };
12280  int __pyx_v_nOffset;
12281  int __pyx_v_node;
12282  __Pyx_RefNannyDeclarations
12283  int __pyx_t_1;
12284  int __pyx_t_2;
12285  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
12286  PyObject *__pyx_t_4 = NULL;
12287  PyObject *__pyx_t_5 = NULL;
12288  PyObject *__pyx_t_6 = NULL;
12289  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
12290  int __pyx_t_8;
12291  int __pyx_t_9;
12292  int __pyx_t_10;
12293  Py_ssize_t __pyx_t_11;
12294  int __pyx_t_12;
12295  int __pyx_t_13;
12296  int __pyx_t_14;
12297  long __pyx_t_15;
12298  Py_ssize_t __pyx_t_16;
12299  Py_ssize_t __pyx_t_17;
12300  Py_ssize_t __pyx_t_18;
12301  Py_ssize_t __pyx_t_19;
12302  int __pyx_lineno = 0;
12303  const char *__pyx_filename = NULL;
12304  int __pyx_clineno = 0;
12305  __Pyx_RefNannySetupContext("cySmoothNodesLaplace", 0);
12306  if (__pyx_optional_args) {
12307  if (__pyx_optional_args->__pyx_n > 0) {
12308  __pyx_v_simultaneous = __pyx_optional_args->simultaneous;
12309  if (__pyx_optional_args->__pyx_n > 1) {
12310  __pyx_v_smoothBoundaries = __pyx_optional_args->smoothBoundaries;
12311  if (__pyx_optional_args->__pyx_n > 2) {
12312  __pyx_v_fixedNodesBoolArray = __pyx_optional_args->fixedNodesBoolArray;
12313  if (__pyx_optional_args->__pyx_n > 3) {
12314  __pyx_v_alpha = __pyx_optional_args->alpha;
12315  }
12316  }
12317  }
12318  }
12319  }
12320 
12321  /* "mprans/MeshSmoothing.pyx":752
12322  * double alpha=0.):
12323  * cdef double[:,:] nodeArray0
12324  * if simultaneous or alpha!= 0: # <<<<<<<<<<<<<<
12325  * nodeArray0 = nodeArray_.copy()
12326  * cdef double[3] sum_star
12327  */
12328  __pyx_t_2 = (__pyx_v_simultaneous != 0);
12329  if (!__pyx_t_2) {
12330  } else {
12331  __pyx_t_1 = __pyx_t_2;
12332  goto __pyx_L4_bool_binop_done;
12333  }
12334  __pyx_t_2 = ((__pyx_v_alpha != 0.0) != 0);
12335  __pyx_t_1 = __pyx_t_2;
12336  __pyx_L4_bool_binop_done:;
12337  if (__pyx_t_1) {
12338 
12339  /* "mprans/MeshSmoothing.pyx":753
12340  * cdef double[:,:] nodeArray0
12341  * if simultaneous or alpha!= 0:
12342  * nodeArray0 = nodeArray_.copy() # <<<<<<<<<<<<<<
12343  * cdef double[3] sum_star
12344  * cdef double dot
12345  */
12346  __pyx_t_3 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray_); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 753, __pyx_L1_error)
12347  __pyx_v_nodeArray0 = __pyx_t_3;
12348  __pyx_t_3.memview = NULL;
12349  __pyx_t_3.data = NULL;
12350 
12351  /* "mprans/MeshSmoothing.pyx":752
12352  * double alpha=0.):
12353  * cdef double[:,:] nodeArray0
12354  * if simultaneous or alpha!= 0: # <<<<<<<<<<<<<<
12355  * nodeArray0 = nodeArray_.copy()
12356  * cdef double[3] sum_star
12357  */
12358  }
12359 
12360  /* "mprans/MeshSmoothing.pyx":757
12361  * cdef double dot
12362  * cdef int nNodeInStar
12363  * cdef int nNodes = 0 # <<<<<<<<<<<<<<
12364  * cdef bool fixed_node = False
12365  * cdef double[:] fixed_dir = np.zeros(3)
12366  */
12367  __pyx_v_nNodes = 0;
12368 
12369  /* "mprans/MeshSmoothing.pyx":758
12370  * cdef int nNodeInStar
12371  * cdef int nNodes = 0
12372  * cdef bool fixed_node = False # <<<<<<<<<<<<<<
12373  * cdef double[:] fixed_dir = np.zeros(3)
12374  * cdef double fixed_dir_dist
12375  */
12376  __pyx_v_fixed_node = 0;
12377 
12378  /* "mprans/MeshSmoothing.pyx":759
12379  * cdef int nNodes = 0
12380  * cdef bool fixed_node = False
12381  * cdef double[:] fixed_dir = np.zeros(3) # <<<<<<<<<<<<<<
12382  * cdef double fixed_dir_dist
12383  * cdef int nOffset
12384  */
12385  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 759, __pyx_L1_error)
12386  __Pyx_GOTREF(__pyx_t_5);
12387  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 759, __pyx_L1_error)
12388  __Pyx_GOTREF(__pyx_t_6);
12389  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12390  __pyx_t_5 = NULL;
12391  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
12392  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
12393  if (likely(__pyx_t_5)) {
12394  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
12395  __Pyx_INCREF(__pyx_t_5);
12396  __Pyx_INCREF(function);
12397  __Pyx_DECREF_SET(__pyx_t_6, function);
12398  }
12399  }
12400  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_int_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_int_3);
12401  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12402  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 759, __pyx_L1_error)
12403  __Pyx_GOTREF(__pyx_t_4);
12404  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12405  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 759, __pyx_L1_error)
12406  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12407  __pyx_v_fixed_dir = __pyx_t_7;
12408  __pyx_t_7.memview = NULL;
12409  __pyx_t_7.data = NULL;
12410 
12411  /* "mprans/MeshSmoothing.pyx":763
12412  * cdef int nOffset
12413  * cdef int node
12414  * for node in range(nNodes_owned): # <<<<<<<<<<<<<<
12415  * sum_star[0] = 0.
12416  * sum_star[1] = 0.
12417  */
12418  __pyx_t_8 = __pyx_v_nNodes_owned;
12419  __pyx_t_9 = __pyx_t_8;
12420  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
12421  __pyx_v_node = __pyx_t_10;
12422 
12423  /* "mprans/MeshSmoothing.pyx":764
12424  * cdef int node
12425  * for node in range(nNodes_owned):
12426  * sum_star[0] = 0. # <<<<<<<<<<<<<<
12427  * sum_star[1] = 0.
12428  * sum_star[2] = 0.
12429  */
12430  (__pyx_v_sum_star[0]) = 0.;
12431 
12432  /* "mprans/MeshSmoothing.pyx":765
12433  * for node in range(nNodes_owned):
12434  * sum_star[0] = 0.
12435  * sum_star[1] = 0. # <<<<<<<<<<<<<<
12436  * sum_star[2] = 0.
12437  * nNodes = 0
12438  */
12439  (__pyx_v_sum_star[1]) = 0.;
12440 
12441  /* "mprans/MeshSmoothing.pyx":766
12442  * sum_star[0] = 0.
12443  * sum_star[1] = 0.
12444  * sum_star[2] = 0. # <<<<<<<<<<<<<<
12445  * nNodes = 0
12446  * if nodeMaterialTypes[node] == 0:
12447  */
12448  (__pyx_v_sum_star[2]) = 0.;
12449 
12450  /* "mprans/MeshSmoothing.pyx":767
12451  * sum_star[1] = 0.
12452  * sum_star[2] = 0.
12453  * nNodes = 0 # <<<<<<<<<<<<<<
12454  * if nodeMaterialTypes[node] == 0:
12455  * for nOffset in range(nodeStarOffsets[node],
12456  */
12457  __pyx_v_nNodes = 0;
12458 
12459  /* "mprans/MeshSmoothing.pyx":768
12460  * sum_star[2] = 0.
12461  * nNodes = 0
12462  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
12463  * for nOffset in range(nodeStarOffsets[node],
12464  * nodeStarOffsets[node+1]):
12465  */
12466  __pyx_t_11 = __pyx_v_node;
12467  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeMaterialTypes.shape[0];
12468  __pyx_t_1 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_11 * __pyx_v_nodeMaterialTypes.strides[0]) ))) == 0) != 0);
12469  if (__pyx_t_1) {
12470 
12471  /* "mprans/MeshSmoothing.pyx":770
12472  * if nodeMaterialTypes[node] == 0:
12473  * for nOffset in range(nodeStarOffsets[node],
12474  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12475  * if simultaneous is True:
12476  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12477  */
12478  __pyx_t_11 = (__pyx_v_node + 1);
12479  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarOffsets.shape[0];
12480  __pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_11 * __pyx_v_nodeStarOffsets.strides[0]) )));
12481 
12482  /* "mprans/MeshSmoothing.pyx":769
12483  * nNodes = 0
12484  * if nodeMaterialTypes[node] == 0:
12485  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12486  * nodeStarOffsets[node+1]):
12487  * if simultaneous is True:
12488  */
12489  __pyx_t_11 = __pyx_v_node;
12490  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarOffsets.shape[0];
12491 
12492  /* "mprans/MeshSmoothing.pyx":770
12493  * if nodeMaterialTypes[node] == 0:
12494  * for nOffset in range(nodeStarOffsets[node],
12495  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12496  * if simultaneous is True:
12497  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12498  */
12499  __pyx_t_13 = __pyx_t_12;
12500  for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_11 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12501 
12502  /* "mprans/MeshSmoothing.pyx":769
12503  * nNodes = 0
12504  * if nodeMaterialTypes[node] == 0:
12505  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12506  * nodeStarOffsets[node+1]):
12507  * if simultaneous is True:
12508  */
12509  __pyx_v_nOffset = __pyx_t_14;
12510 
12511  /* "mprans/MeshSmoothing.pyx":771
12512  * for nOffset in range(nodeStarOffsets[node],
12513  * nodeStarOffsets[node+1]):
12514  * if simultaneous is True: # <<<<<<<<<<<<<<
12515  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12516  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12517  */
12518  __pyx_t_1 = ((__pyx_v_simultaneous == 1) != 0);
12519  if (__pyx_t_1) {
12520 
12521  /* "mprans/MeshSmoothing.pyx":772
12522  * nodeStarOffsets[node+1]):
12523  * if simultaneous is True:
12524  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12525  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12526  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12527  */
12528  __pyx_t_15 = 0;
12529  __pyx_t_16 = __pyx_v_nOffset;
12530  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12531  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12532  __pyx_t_18 = 0;
12533  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[0];
12534  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray0.shape[1];
12535  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_17 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray0.strides[1]) ))));
12536 
12537  /* "mprans/MeshSmoothing.pyx":773
12538  * if simultaneous is True:
12539  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12540  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12541  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12542  * else:
12543  */
12544  __pyx_t_15 = 1;
12545  __pyx_t_16 = __pyx_v_nOffset;
12546  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12547  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12548  __pyx_t_17 = 1;
12549  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray0.shape[0];
12550  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[1];
12551  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_18 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray0.strides[1]) ))));
12552 
12553  /* "mprans/MeshSmoothing.pyx":774
12554  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12555  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12556  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12557  * else:
12558  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12559  */
12560  __pyx_t_15 = 2;
12561  __pyx_t_16 = __pyx_v_nOffset;
12562  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12563  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12564  __pyx_t_18 = 2;
12565  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[0];
12566  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray0.shape[1];
12567  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_17 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray0.strides[1]) ))));
12568 
12569  /* "mprans/MeshSmoothing.pyx":771
12570  * for nOffset in range(nodeStarOffsets[node],
12571  * nodeStarOffsets[node+1]):
12572  * if simultaneous is True: # <<<<<<<<<<<<<<
12573  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12574  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12575  */
12576  goto __pyx_L11;
12577  }
12578 
12579  /* "mprans/MeshSmoothing.pyx":776
12580  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12581  * else:
12582  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12583  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12584  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12585  */
12586  /*else*/ {
12587  __pyx_t_15 = 0;
12588  __pyx_t_16 = __pyx_v_nOffset;
12589  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12590  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12591  __pyx_t_17 = 0;
12592  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[0];
12593  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[1];
12594  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_18 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray_.strides[1]) ))));
12595 
12596  /* "mprans/MeshSmoothing.pyx":777
12597  * else:
12598  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12599  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12600  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12601  * nNodes += 1
12602  */
12603  __pyx_t_15 = 1;
12604  __pyx_t_16 = __pyx_v_nOffset;
12605  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12606  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12607  __pyx_t_18 = 1;
12608  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[0];
12609  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[1];
12610  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_17 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray_.strides[1]) ))));
12611 
12612  /* "mprans/MeshSmoothing.pyx":778
12613  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12614  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12615  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12616  * nNodes += 1
12617  * nodeArray_[node, 0] = sum_star[0]/nNodes
12618  */
12619  __pyx_t_15 = 2;
12620  __pyx_t_16 = __pyx_v_nOffset;
12621  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12622  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12623  __pyx_t_17 = 2;
12624  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[0];
12625  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[1];
12626  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_18 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray_.strides[1]) ))));
12627  }
12628  __pyx_L11:;
12629 
12630  /* "mprans/MeshSmoothing.pyx":779
12631  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12632  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12633  * nNodes += 1 # <<<<<<<<<<<<<<
12634  * nodeArray_[node, 0] = sum_star[0]/nNodes
12635  * nodeArray_[node, 1] = sum_star[1]/nNodes
12636  */
12637  __pyx_v_nNodes = (__pyx_v_nNodes + 1);
12638  }
12639 
12640  /* "mprans/MeshSmoothing.pyx":780
12641  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12642  * nNodes += 1
12643  * nodeArray_[node, 0] = sum_star[0]/nNodes # <<<<<<<<<<<<<<
12644  * nodeArray_[node, 1] = sum_star[1]/nNodes
12645  * nodeArray_[node, 2] = sum_star[2]/nNodes
12646  */
12647  __pyx_t_11 = __pyx_v_node;
12648  __pyx_t_16 = 0;
12649  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[0];
12650  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray_.shape[1];
12651  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_11 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[0]) / __pyx_v_nNodes);
12652 
12653  /* "mprans/MeshSmoothing.pyx":781
12654  * nNodes += 1
12655  * nodeArray_[node, 0] = sum_star[0]/nNodes
12656  * nodeArray_[node, 1] = sum_star[1]/nNodes # <<<<<<<<<<<<<<
12657  * nodeArray_[node, 2] = sum_star[2]/nNodes
12658  * # boundary smoothing not ready yet
12659  */
12660  __pyx_t_16 = __pyx_v_node;
12661  __pyx_t_11 = 1;
12662  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray_.shape[0];
12663  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[1];
12664  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_16 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_11 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[1]) / __pyx_v_nNodes);
12665 
12666  /* "mprans/MeshSmoothing.pyx":782
12667  * nodeArray_[node, 0] = sum_star[0]/nNodes
12668  * nodeArray_[node, 1] = sum_star[1]/nNodes
12669  * nodeArray_[node, 2] = sum_star[2]/nNodes # <<<<<<<<<<<<<<
12670  * # boundary smoothing not ready yet
12671  * elif smoothBoundaries is True:
12672  */
12673  __pyx_t_11 = __pyx_v_node;
12674  __pyx_t_16 = 2;
12675  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[0];
12676  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray_.shape[1];
12677  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_11 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[2]) / __pyx_v_nNodes);
12678 
12679  /* "mprans/MeshSmoothing.pyx":768
12680  * sum_star[2] = 0.
12681  * nNodes = 0
12682  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
12683  * for nOffset in range(nodeStarOffsets[node],
12684  * nodeStarOffsets[node+1]):
12685  */
12686  goto __pyx_L8;
12687  }
12688 
12689  /* "mprans/MeshSmoothing.pyx":784
12690  * nodeArray_[node, 2] = sum_star[2]/nNodes
12691  * # boundary smoothing not ready yet
12692  * elif smoothBoundaries is True: # <<<<<<<<<<<<<<
12693  * # smooth on boundary only
12694  * fixed_node = False
12695  */
12696  __pyx_t_1 = ((__pyx_v_smoothBoundaries == 1) != 0);
12697  if (__pyx_t_1) {
12698 
12699  /* "mprans/MeshSmoothing.pyx":786
12700  * elif smoothBoundaries is True:
12701  * # smooth on boundary only
12702  * fixed_node = False # <<<<<<<<<<<<<<
12703  * if fixedNodesBoolArray is not None:
12704  * if fixedNodesBoolArray[node] == 1:
12705  */
12706  __pyx_v_fixed_node = 0;
12707 
12708  /* "mprans/MeshSmoothing.pyx":787
12709  * # smooth on boundary only
12710  * fixed_node = False
12711  * if fixedNodesBoolArray is not None: # <<<<<<<<<<<<<<
12712  * if fixedNodesBoolArray[node] == 1:
12713  * sum_star[0] = nodeArray0[node, 0]
12714  */
12715  __pyx_t_1 = ((((PyObject *) __pyx_v_fixedNodesBoolArray.memview) != Py_None) != 0);
12716  if (__pyx_t_1) {
12717 
12718  /* "mprans/MeshSmoothing.pyx":788
12719  * fixed_node = False
12720  * if fixedNodesBoolArray is not None:
12721  * if fixedNodesBoolArray[node] == 1: # <<<<<<<<<<<<<<
12722  * sum_star[0] = nodeArray0[node, 0]
12723  * sum_star[1] = nodeArray0[node, 1]
12724  */
12725  __pyx_t_16 = __pyx_v_node;
12726  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_fixedNodesBoolArray.shape[0];
12727  __pyx_t_1 = (((*((int *) ( /* dim=0 */ (__pyx_v_fixedNodesBoolArray.data + __pyx_t_16 * __pyx_v_fixedNodesBoolArray.strides[0]) ))) == 1) != 0);
12728  if (__pyx_t_1) {
12729 
12730  /* "mprans/MeshSmoothing.pyx":789
12731  * if fixedNodesBoolArray is not None:
12732  * if fixedNodesBoolArray[node] == 1:
12733  * sum_star[0] = nodeArray0[node, 0] # <<<<<<<<<<<<<<
12734  * sum_star[1] = nodeArray0[node, 1]
12735  * sum_star[2] = nodeArray0[node, 2]
12736  */
12737  __pyx_t_16 = __pyx_v_node;
12738  __pyx_t_11 = 0;
12739  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray0.shape[0];
12740  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray0.shape[1];
12741  (__pyx_v_sum_star[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_16 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_11 * __pyx_v_nodeArray0.strides[1]) )));
12742 
12743  /* "mprans/MeshSmoothing.pyx":790
12744  * if fixedNodesBoolArray[node] == 1:
12745  * sum_star[0] = nodeArray0[node, 0]
12746  * sum_star[1] = nodeArray0[node, 1] # <<<<<<<<<<<<<<
12747  * sum_star[2] = nodeArray0[node, 2]
12748  * nNodes = 1
12749  */
12750  __pyx_t_11 = __pyx_v_node;
12751  __pyx_t_16 = 1;
12752  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray0.shape[0];
12753  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray0.shape[1];
12754  (__pyx_v_sum_star[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_11 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray0.strides[1]) )));
12755 
12756  /* "mprans/MeshSmoothing.pyx":791
12757  * sum_star[0] = nodeArray0[node, 0]
12758  * sum_star[1] = nodeArray0[node, 1]
12759  * sum_star[2] = nodeArray0[node, 2] # <<<<<<<<<<<<<<
12760  * nNodes = 1
12761  * fixed_node = True
12762  */
12763  __pyx_t_16 = __pyx_v_node;
12764  __pyx_t_11 = 2;
12765  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray0.shape[0];
12766  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray0.shape[1];
12767  (__pyx_v_sum_star[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_16 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_11 * __pyx_v_nodeArray0.strides[1]) )));
12768 
12769  /* "mprans/MeshSmoothing.pyx":792
12770  * sum_star[1] = nodeArray0[node, 1]
12771  * sum_star[2] = nodeArray0[node, 2]
12772  * nNodes = 1 # <<<<<<<<<<<<<<
12773  * fixed_node = True
12774  * if fixed_node is False:
12775  */
12776  __pyx_v_nNodes = 1;
12777 
12778  /* "mprans/MeshSmoothing.pyx":793
12779  * sum_star[2] = nodeArray0[node, 2]
12780  * nNodes = 1
12781  * fixed_node = True # <<<<<<<<<<<<<<
12782  * if fixed_node is False:
12783  * if nd == 2:
12784  */
12785  __pyx_v_fixed_node = 1;
12786 
12787  /* "mprans/MeshSmoothing.pyx":788
12788  * fixed_node = False
12789  * if fixedNodesBoolArray is not None:
12790  * if fixedNodesBoolArray[node] == 1: # <<<<<<<<<<<<<<
12791  * sum_star[0] = nodeArray0[node, 0]
12792  * sum_star[1] = nodeArray0[node, 1]
12793  */
12794  }
12795 
12796  /* "mprans/MeshSmoothing.pyx":787
12797  * # smooth on boundary only
12798  * fixed_node = False
12799  * if fixedNodesBoolArray is not None: # <<<<<<<<<<<<<<
12800  * if fixedNodesBoolArray[node] == 1:
12801  * sum_star[0] = nodeArray0[node, 0]
12802  */
12803  }
12804 
12805  /* "mprans/MeshSmoothing.pyx":794
12806  * nNodes = 1
12807  * fixed_node = True
12808  * if fixed_node is False: # <<<<<<<<<<<<<<
12809  * if nd == 2:
12810  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12811  */
12812  __pyx_t_1 = ((__pyx_v_fixed_node == 0) != 0);
12813  if (__pyx_t_1) {
12814 
12815  /* "mprans/MeshSmoothing.pyx":795
12816  * fixed_node = True
12817  * if fixed_node is False:
12818  * if nd == 2: # <<<<<<<<<<<<<<
12819  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12820  * node=node,
12821  */
12822  __pyx_t_1 = ((__pyx_v_nd == 2) != 0);
12823  if (__pyx_t_1) {
12824 
12825  /* "mprans/MeshSmoothing.pyx":796
12826  * if fixed_node is False:
12827  * if nd == 2:
12828  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir, # <<<<<<<<<<<<<<
12829  * node=node,
12830  * nodeArray=nodeArray_,
12831  */
12832  __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle(__pyx_v_fixed_dir, __pyx_v_node, __pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes);
12833 
12834  /* "mprans/MeshSmoothing.pyx":795
12835  * fixed_node = True
12836  * if fixed_node is False:
12837  * if nd == 2: # <<<<<<<<<<<<<<
12838  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
12839  * node=node,
12840  */
12841  }
12842 
12843  /* "mprans/MeshSmoothing.pyx":802
12844  * nodeStarArray=nodeStarArray,
12845  * nodeMaterialTypes=nodeMaterialTypes)
12846  * if nd == 3: # <<<<<<<<<<<<<<
12847  * cyFindBoundaryDirectionTetra(dir_=fixed_dir,
12848  * node=node,
12849  */
12850  __pyx_t_1 = ((__pyx_v_nd == 3) != 0);
12851  if (__pyx_t_1) {
12852 
12853  /* "mprans/MeshSmoothing.pyx":803
12854  * nodeMaterialTypes=nodeMaterialTypes)
12855  * if nd == 3:
12856  * cyFindBoundaryDirectionTetra(dir_=fixed_dir, # <<<<<<<<<<<<<<
12857  * node=node,
12858  * nodeArray=nodeArray_,
12859  */
12860  __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra(__pyx_v_fixed_dir, __pyx_v_node, __pyx_v_nodeArray_, __pyx_v_nodeStarOffsets, __pyx_v_nodeStarArray, __pyx_v_nodeMaterialTypes);
12861 
12862  /* "mprans/MeshSmoothing.pyx":802
12863  * nodeStarArray=nodeStarArray,
12864  * nodeMaterialTypes=nodeMaterialTypes)
12865  * if nd == 3: # <<<<<<<<<<<<<<
12866  * cyFindBoundaryDirectionTetra(dir_=fixed_dir,
12867  * node=node,
12868  */
12869  }
12870 
12871  /* "mprans/MeshSmoothing.pyx":810
12872  * nodeMaterialTypes=nodeMaterialTypes)
12873  * for nOffset in range(nodeStarOffsets[node],
12874  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12875  * if simultaneous is True:
12876  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12877  */
12878  __pyx_t_11 = (__pyx_v_node + 1);
12879  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarOffsets.shape[0];
12880  __pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_11 * __pyx_v_nodeStarOffsets.strides[0]) )));
12881 
12882  /* "mprans/MeshSmoothing.pyx":809
12883  * nodeStarArray=nodeStarArray,
12884  * nodeMaterialTypes=nodeMaterialTypes)
12885  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12886  * nodeStarOffsets[node+1]):
12887  * if simultaneous is True:
12888  */
12889  __pyx_t_11 = __pyx_v_node;
12890  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeStarOffsets.shape[0];
12891 
12892  /* "mprans/MeshSmoothing.pyx":810
12893  * nodeMaterialTypes=nodeMaterialTypes)
12894  * for nOffset in range(nodeStarOffsets[node],
12895  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
12896  * if simultaneous is True:
12897  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12898  */
12899  __pyx_t_13 = __pyx_t_12;
12900  for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_11 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
12901 
12902  /* "mprans/MeshSmoothing.pyx":809
12903  * nodeStarArray=nodeStarArray,
12904  * nodeMaterialTypes=nodeMaterialTypes)
12905  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
12906  * nodeStarOffsets[node+1]):
12907  * if simultaneous is True:
12908  */
12909  __pyx_v_nOffset = __pyx_t_14;
12910 
12911  /* "mprans/MeshSmoothing.pyx":811
12912  * for nOffset in range(nodeStarOffsets[node],
12913  * nodeStarOffsets[node+1]):
12914  * if simultaneous is True: # <<<<<<<<<<<<<<
12915  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12916  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12917  */
12918  __pyx_t_1 = ((__pyx_v_simultaneous == 1) != 0);
12919  if (__pyx_t_1) {
12920 
12921  /* "mprans/MeshSmoothing.pyx":812
12922  * nodeStarOffsets[node+1]):
12923  * if simultaneous is True:
12924  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12925  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12926  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12927  */
12928  __pyx_t_15 = 0;
12929  __pyx_t_16 = __pyx_v_nOffset;
12930  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12931  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12932  __pyx_t_18 = 0;
12933  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[0];
12934  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray0.shape[1];
12935  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_17 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray0.strides[1]) ))));
12936 
12937  /* "mprans/MeshSmoothing.pyx":813
12938  * if simultaneous is True:
12939  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12940  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
12941  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12942  * else:
12943  */
12944  __pyx_t_15 = 1;
12945  __pyx_t_16 = __pyx_v_nOffset;
12946  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12947  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12948  __pyx_t_17 = 1;
12949  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray0.shape[0];
12950  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[1];
12951  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_18 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray0.strides[1]) ))));
12952 
12953  /* "mprans/MeshSmoothing.pyx":814
12954  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12955  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12956  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
12957  * else:
12958  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12959  */
12960  __pyx_t_15 = 2;
12961  __pyx_t_16 = __pyx_v_nOffset;
12962  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12963  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12964  __pyx_t_18 = 2;
12965  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[0];
12966  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray0.shape[1];
12967  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_17 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray0.strides[1]) ))));
12968 
12969  /* "mprans/MeshSmoothing.pyx":811
12970  * for nOffset in range(nodeStarOffsets[node],
12971  * nodeStarOffsets[node+1]):
12972  * if simultaneous is True: # <<<<<<<<<<<<<<
12973  * sum_star[0] += nodeArray0[nodeStarArray[nOffset], 0]
12974  * sum_star[1] += nodeArray0[nodeStarArray[nOffset], 1]
12975  */
12976  goto __pyx_L19;
12977  }
12978 
12979  /* "mprans/MeshSmoothing.pyx":816
12980  * sum_star[2] += nodeArray0[nodeStarArray[nOffset], 2]
12981  * else:
12982  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
12983  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
12984  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
12985  */
12986  /*else*/ {
12987  __pyx_t_15 = 0;
12988  __pyx_t_16 = __pyx_v_nOffset;
12989  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
12990  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
12991  __pyx_t_17 = 0;
12992  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[0];
12993  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[1];
12994  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_18 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray_.strides[1]) ))));
12995 
12996  /* "mprans/MeshSmoothing.pyx":817
12997  * else:
12998  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
12999  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
13000  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
13001  * nNodes += 1
13002  */
13003  __pyx_t_15 = 1;
13004  __pyx_t_16 = __pyx_v_nOffset;
13005  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
13006  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
13007  __pyx_t_18 = 1;
13008  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[0];
13009  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[1];
13010  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_17 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray_.strides[1]) ))));
13011 
13012  /* "mprans/MeshSmoothing.pyx":818
13013  * sum_star[0] += nodeArray_[nodeStarArray[nOffset], 0]
13014  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
13015  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
13016  * nNodes += 1
13017  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
13018  */
13019  __pyx_t_15 = 2;
13020  __pyx_t_16 = __pyx_v_nOffset;
13021  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeStarArray.shape[0];
13022  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_16 * __pyx_v_nodeStarArray.strides[0]) )));
13023  __pyx_t_17 = 2;
13024  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[0];
13025  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[1];
13026  (__pyx_v_sum_star[__pyx_t_15]) = ((__pyx_v_sum_star[__pyx_t_15]) + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_18 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray_.strides[1]) ))));
13027  }
13028  __pyx_L19:;
13029 
13030  /* "mprans/MeshSmoothing.pyx":819
13031  * sum_star[1] += nodeArray_[nodeStarArray[nOffset], 1]
13032  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
13033  * nNodes += 1 # <<<<<<<<<<<<<<
13034  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
13035  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1]
13036  */
13037  __pyx_v_nNodes = (__pyx_v_nNodes + 1);
13038  }
13039 
13040  /* "mprans/MeshSmoothing.pyx":794
13041  * nNodes = 1
13042  * fixed_node = True
13043  * if fixed_node is False: # <<<<<<<<<<<<<<
13044  * if nd == 2:
13045  * cyFindBoundaryDirectionTriangle(dir_=fixed_dir,
13046  */
13047  }
13048 
13049  /* "mprans/MeshSmoothing.pyx":820
13050  * sum_star[2] += nodeArray_[nodeStarArray[nOffset], 2]
13051  * nNodes += 1
13052  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0] # <<<<<<<<<<<<<<
13053  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1]
13054  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2]
13055  */
13056  __pyx_t_11 = __pyx_v_node;
13057  __pyx_t_16 = 0;
13058  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[0];
13059  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray_.shape[1];
13060  __pyx_t_17 = 0;
13061  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_fixed_dir.shape[0];
13062  __pyx_t_18 = __pyx_v_node;
13063  __pyx_t_19 = 0;
13064  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[0];
13065  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray_.shape[1];
13066  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_18 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_19 * __pyx_v_nodeArray_.strides[1]) )) += ((((__pyx_v_sum_star[0]) / __pyx_v_nNodes) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_11 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray_.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fixed_dir.data + __pyx_t_17 * __pyx_v_fixed_dir.strides[0]) ))));
13067 
13068  /* "mprans/MeshSmoothing.pyx":821
13069  * nNodes += 1
13070  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
13071  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1] # <<<<<<<<<<<<<<
13072  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2]
13073  * else:
13074  */
13075  __pyx_t_17 = __pyx_v_node;
13076  __pyx_t_16 = 1;
13077  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray_.shape[0];
13078  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray_.shape[1];
13079  __pyx_t_11 = 1;
13080  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_fixed_dir.shape[0];
13081  __pyx_t_19 = __pyx_v_node;
13082  __pyx_t_18 = 1;
13083  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray_.shape[0];
13084  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[1];
13085  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_19 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray_.strides[1]) )) += ((((__pyx_v_sum_star[1]) / __pyx_v_nNodes) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_17 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray_.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fixed_dir.data + __pyx_t_11 * __pyx_v_fixed_dir.strides[0]) ))));
13086 
13087  /* "mprans/MeshSmoothing.pyx":822
13088  * nodeArray_[node, 0] += (sum_star[0]/nNodes-nodeArray_[node, 0])*fixed_dir[0]
13089  * nodeArray_[node, 1] += (sum_star[1]/nNodes-nodeArray_[node, 1])*fixed_dir[1]
13090  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2] # <<<<<<<<<<<<<<
13091  * else:
13092  * sum_star[0] = nodeArray0[node, 0]
13093  */
13094  __pyx_t_11 = __pyx_v_node;
13095  __pyx_t_16 = 2;
13096  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[0];
13097  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray_.shape[1];
13098  __pyx_t_17 = 2;
13099  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_fixed_dir.shape[0];
13100  __pyx_t_18 = __pyx_v_node;
13101  __pyx_t_19 = 2;
13102  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray_.shape[0];
13103  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray_.shape[1];
13104  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_18 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_19 * __pyx_v_nodeArray_.strides[1]) )) += ((((__pyx_v_sum_star[2]) / __pyx_v_nNodes) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_11 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray_.strides[1]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_fixed_dir.data + __pyx_t_17 * __pyx_v_fixed_dir.strides[0]) ))));
13105 
13106  /* "mprans/MeshSmoothing.pyx":784
13107  * nodeArray_[node, 2] = sum_star[2]/nNodes
13108  * # boundary smoothing not ready yet
13109  * elif smoothBoundaries is True: # <<<<<<<<<<<<<<
13110  * # smooth on boundary only
13111  * fixed_node = False
13112  */
13113  goto __pyx_L8;
13114  }
13115 
13116  /* "mprans/MeshSmoothing.pyx":824
13117  * nodeArray_[node, 2] += (sum_star[2]/nNodes-nodeArray_[node, 2])*fixed_dir[2]
13118  * else:
13119  * sum_star[0] = nodeArray0[node, 0] # <<<<<<<<<<<<<<
13120  * sum_star[1] = nodeArray0[node, 1]
13121  * sum_star[2] = nodeArray0[node, 2]
13122  */
13123  /*else*/ {
13124  __pyx_t_17 = __pyx_v_node;
13125  __pyx_t_16 = 0;
13126  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[0];
13127  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray0.shape[1];
13128  (__pyx_v_sum_star[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_17 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray0.strides[1]) )));
13129 
13130  /* "mprans/MeshSmoothing.pyx":825
13131  * else:
13132  * sum_star[0] = nodeArray0[node, 0]
13133  * sum_star[1] = nodeArray0[node, 1] # <<<<<<<<<<<<<<
13134  * sum_star[2] = nodeArray0[node, 2]
13135  * nNodes = 1
13136  */
13137  __pyx_t_16 = __pyx_v_node;
13138  __pyx_t_17 = 1;
13139  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray0.shape[0];
13140  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[1];
13141  (__pyx_v_sum_star[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_16 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray0.strides[1]) )));
13142 
13143  /* "mprans/MeshSmoothing.pyx":826
13144  * sum_star[0] = nodeArray0[node, 0]
13145  * sum_star[1] = nodeArray0[node, 1]
13146  * sum_star[2] = nodeArray0[node, 2] # <<<<<<<<<<<<<<
13147  * nNodes = 1
13148  * fixed_node = True
13149  */
13150  __pyx_t_17 = __pyx_v_node;
13151  __pyx_t_16 = 2;
13152  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray0.shape[0];
13153  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray0.shape[1];
13154  (__pyx_v_sum_star[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_17 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray0.strides[1]) )));
13155 
13156  /* "mprans/MeshSmoothing.pyx":827
13157  * sum_star[1] = nodeArray0[node, 1]
13158  * sum_star[2] = nodeArray0[node, 2]
13159  * nNodes = 1 # <<<<<<<<<<<<<<
13160  * fixed_node = True
13161  * # if alpha != 0:
13162  */
13163  __pyx_v_nNodes = 1;
13164 
13165  /* "mprans/MeshSmoothing.pyx":828
13166  * sum_star[2] = nodeArray0[node, 2]
13167  * nNodes = 1
13168  * fixed_node = True # <<<<<<<<<<<<<<
13169  * # if alpha != 0:
13170  * # nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/nNodes
13171  */
13172  __pyx_v_fixed_node = 1;
13173  }
13174  __pyx_L8:;
13175  }
13176 
13177  /* "mprans/MeshSmoothing.pyx":741
13178  * ### Cython implementation of functions above
13179  *
13180  * cdef void cySmoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
13181  * int[:] nodeStarOffsets,
13182  * int[:] nodeStarArray,
13183  */
13184 
13185  /* function exit code */
13186  goto __pyx_L0;
13187  __pyx_L1_error:;
13188  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
13189  __Pyx_XDECREF(__pyx_t_4);
13190  __Pyx_XDECREF(__pyx_t_5);
13191  __Pyx_XDECREF(__pyx_t_6);
13192  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
13193  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cySmoothNodesLaplace", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13194  __pyx_L0:;
13195  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray0, 1);
13196  __PYX_XDEC_MEMVIEW(&__pyx_v_fixed_dir, 1);
13197  __Pyx_RefNannyFinishContext();
13198 }
13199 
13200 /* "mprans/MeshSmoothing.pyx":834
13201  * # nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/nNodes
13202  *
13203  * cdef void cySmoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
13204  * int[:] nodeElementOffsets,
13205  * int[:] nodeElementsArray,
13206  */
13207 
13208 static void __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid(__Pyx_memviewslice __pyx_v_nodeArray_, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_elementVolumesArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nNodes_owned, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_fixedNodesBoolArray, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid *__pyx_optional_args) {
13209 
13210  /* "mprans/MeshSmoothing.pyx":843
13211  * int nNodes_owned,
13212  * int[:] fixedNodesBoolArray,
13213  * bool simultaneous=False, # <<<<<<<<<<<<<<
13214  * bool smoothBoundaries = True,
13215  * double alpha=0.):
13216  */
13217  bool __pyx_v_simultaneous = ((bool)0);
13218  double __pyx_v_alpha = ((double)0.);
13219  __Pyx_memviewslice __pyx_v_nodeArray0 = { 0, 0, { 0 }, { 0 }, { 0 } };
13220  double __pyx_v_sum_star[3];
13221  double __pyx_v_areas;
13222  CYTHON_UNUSED int __pyx_v_nNodes_star;
13223  CYTHON_UNUSED double __pyx_v_var;
13224  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
13225  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
13226  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
13227  int __pyx_v_node;
13228  int __pyx_v_eOffset;
13229  int __pyx_v_eN;
13230  __Pyx_RefNannyDeclarations
13231  int __pyx_t_1;
13232  int __pyx_t_2;
13233  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
13234  int __pyx_t_4;
13235  int __pyx_t_5;
13236  int __pyx_t_6;
13237  Py_ssize_t __pyx_t_7;
13238  int __pyx_t_8;
13239  int __pyx_t_9;
13240  int __pyx_t_10;
13241  Py_ssize_t __pyx_t_11;
13242  long __pyx_t_12;
13243  Py_ssize_t __pyx_t_13;
13244  Py_ssize_t __pyx_t_14;
13245  __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
13246  Py_ssize_t __pyx_t_16;
13247  Py_ssize_t __pyx_t_17;
13248  int __pyx_lineno = 0;
13249  const char *__pyx_filename = NULL;
13250  int __pyx_clineno = 0;
13251  __Pyx_RefNannySetupContext("cySmoothNodesCentroid", 0);
13252  if (__pyx_optional_args) {
13253  if (__pyx_optional_args->__pyx_n > 0) {
13254  __pyx_v_simultaneous = __pyx_optional_args->simultaneous;
13255  if (__pyx_optional_args->__pyx_n > 2) {
13256  __pyx_v_alpha = __pyx_optional_args->alpha;
13257  }
13258  }
13259  }
13260 
13261  /* "mprans/MeshSmoothing.pyx":847
13262  * double alpha=0.):
13263  * cdef double[:,:] nodeArray0
13264  * if simultaneous or alpha != 0: # <<<<<<<<<<<<<<
13265  * nodeArray0 = nodeArray_.copy()
13266  * cdef double[3] sum_star
13267  */
13268  __pyx_t_2 = (__pyx_v_simultaneous != 0);
13269  if (!__pyx_t_2) {
13270  } else {
13271  __pyx_t_1 = __pyx_t_2;
13272  goto __pyx_L4_bool_binop_done;
13273  }
13274  __pyx_t_2 = ((__pyx_v_alpha != 0.0) != 0);
13275  __pyx_t_1 = __pyx_t_2;
13276  __pyx_L4_bool_binop_done:;
13277  if (__pyx_t_1) {
13278 
13279  /* "mprans/MeshSmoothing.pyx":848
13280  * cdef double[:,:] nodeArray0
13281  * if simultaneous or alpha != 0:
13282  * nodeArray0 = nodeArray_.copy() # <<<<<<<<<<<<<<
13283  * cdef double[3] sum_star
13284  * cdef int nNodeInStar
13285  */
13286  __pyx_t_3 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray_); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 848, __pyx_L1_error)
13287  __pyx_v_nodeArray0 = __pyx_t_3;
13288  __pyx_t_3.memview = NULL;
13289  __pyx_t_3.data = NULL;
13290 
13291  /* "mprans/MeshSmoothing.pyx":847
13292  * double alpha=0.):
13293  * cdef double[:,:] nodeArray0
13294  * if simultaneous or alpha != 0: # <<<<<<<<<<<<<<
13295  * nodeArray0 = nodeArray_.copy()
13296  * cdef double[3] sum_star
13297  */
13298  }
13299 
13300  /* "mprans/MeshSmoothing.pyx":851
13301  * cdef double[3] sum_star
13302  * cdef int nNodeInStar
13303  * cdef double areas = 0. # <<<<<<<<<<<<<<
13304  * cdef int nNodes_star = 0
13305  * cdef double[:] nodeOffset0
13306  */
13307  __pyx_v_areas = 0.;
13308 
13309  /* "mprans/MeshSmoothing.pyx":852
13310  * cdef int nNodeInStar
13311  * cdef double areas = 0.
13312  * cdef int nNodes_star = 0 # <<<<<<<<<<<<<<
13313  * cdef double[:] nodeOffset0
13314  * cdef double[:] nodeOffset1
13315  */
13316  __pyx_v_nNodes_star = 0;
13317 
13318  /* "mprans/MeshSmoothing.pyx":855
13319  * cdef double[:] nodeOffset0
13320  * cdef double[:] nodeOffset1
13321  * cdef double var = 0. # <<<<<<<<<<<<<<
13322  * cdef double[:] centroid_cell
13323  * cdef double[:] nA
13324  */
13325  __pyx_v_var = 0.;
13326 
13327  /* "mprans/MeshSmoothing.pyx":865
13328  * cdef int eOffset
13329  * cdef int eN
13330  * for node in range(nNodes_owned): # <<<<<<<<<<<<<<
13331  * sum_star[0] = 0.
13332  * sum_star[1] = 0.
13333  */
13334  __pyx_t_4 = __pyx_v_nNodes_owned;
13335  __pyx_t_5 = __pyx_t_4;
13336  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
13337  __pyx_v_node = __pyx_t_6;
13338 
13339  /* "mprans/MeshSmoothing.pyx":866
13340  * cdef int eN
13341  * for node in range(nNodes_owned):
13342  * sum_star[0] = 0. # <<<<<<<<<<<<<<
13343  * sum_star[1] = 0.
13344  * sum_star[2] = 0.
13345  */
13346  (__pyx_v_sum_star[0]) = 0.;
13347 
13348  /* "mprans/MeshSmoothing.pyx":867
13349  * for node in range(nNodes_owned):
13350  * sum_star[0] = 0.
13351  * sum_star[1] = 0. # <<<<<<<<<<<<<<
13352  * sum_star[2] = 0.
13353  * areas = 0.
13354  */
13355  (__pyx_v_sum_star[1]) = 0.;
13356 
13357  /* "mprans/MeshSmoothing.pyx":868
13358  * sum_star[0] = 0.
13359  * sum_star[1] = 0.
13360  * sum_star[2] = 0. # <<<<<<<<<<<<<<
13361  * areas = 0.
13362  * if nodeMaterialTypes[node] == 0:
13363  */
13364  (__pyx_v_sum_star[2]) = 0.;
13365 
13366  /* "mprans/MeshSmoothing.pyx":869
13367  * sum_star[1] = 0.
13368  * sum_star[2] = 0.
13369  * areas = 0. # <<<<<<<<<<<<<<
13370  * if nodeMaterialTypes[node] == 0:
13371  * for eOffset in range(nodeElementOffsets[node],
13372  */
13373  __pyx_v_areas = 0.;
13374 
13375  /* "mprans/MeshSmoothing.pyx":870
13376  * sum_star[2] = 0.
13377  * areas = 0.
13378  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
13379  * for eOffset in range(nodeElementOffsets[node],
13380  * nodeElementOffsets[node+1]):
13381  */
13382  __pyx_t_7 = __pyx_v_node;
13383  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeMaterialTypes.shape[0];
13384  __pyx_t_1 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_7 * __pyx_v_nodeMaterialTypes.strides[0]) ))) == 0) != 0);
13385  if (__pyx_t_1) {
13386 
13387  /* "mprans/MeshSmoothing.pyx":872
13388  * if nodeMaterialTypes[node] == 0:
13389  * for eOffset in range(nodeElementOffsets[node],
13390  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13391  * eN = nodeElementsArray[eOffset]
13392  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13393  */
13394  __pyx_t_7 = (__pyx_v_node + 1);
13395  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
13396  __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) )));
13397 
13398  /* "mprans/MeshSmoothing.pyx":871
13399  * areas = 0.
13400  * if nodeMaterialTypes[node] == 0:
13401  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13402  * nodeElementOffsets[node+1]):
13403  * eN = nodeElementsArray[eOffset]
13404  */
13405  __pyx_t_7 = __pyx_v_node;
13406  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
13407 
13408  /* "mprans/MeshSmoothing.pyx":872
13409  * if nodeMaterialTypes[node] == 0:
13410  * for eOffset in range(nodeElementOffsets[node],
13411  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13412  * eN = nodeElementsArray[eOffset]
13413  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13414  */
13415  __pyx_t_9 = __pyx_t_8;
13416  for (__pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
13417 
13418  /* "mprans/MeshSmoothing.pyx":871
13419  * areas = 0.
13420  * if nodeMaterialTypes[node] == 0:
13421  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13422  * nodeElementOffsets[node+1]):
13423  * eN = nodeElementsArray[eOffset]
13424  */
13425  __pyx_v_eOffset = __pyx_t_10;
13426 
13427  /* "mprans/MeshSmoothing.pyx":873
13428  * for eOffset in range(nodeElementOffsets[node],
13429  * nodeElementOffsets[node+1]):
13430  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
13431  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13432  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13433  */
13434  __pyx_t_11 = __pyx_v_eOffset;
13435  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeElementsArray.shape[0];
13436  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_11 * __pyx_v_nodeElementsArray.strides[0]) )));
13437 
13438  /* "mprans/MeshSmoothing.pyx":874
13439  * nodeElementOffsets[node+1]):
13440  * eN = nodeElementsArray[eOffset]
13441  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN] # <<<<<<<<<<<<<<
13442  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13443  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13444  */
13445  __pyx_t_12 = 0;
13446  __pyx_t_11 = __pyx_v_eN;
13447  __pyx_t_13 = 0;
13448  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBarycentersArray.shape[0];
13449  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBarycentersArray.shape[1];
13450  __pyx_t_14 = __pyx_v_eN;
13451  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementVolumesArray.shape[0];
13452  (__pyx_v_sum_star[__pyx_t_12]) = ((__pyx_v_sum_star[__pyx_t_12]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_11 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBarycentersArray.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_14 * __pyx_v_elementVolumesArray.strides[0]) )))));
13453 
13454  /* "mprans/MeshSmoothing.pyx":875
13455  * eN = nodeElementsArray[eOffset]
13456  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13457  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN] # <<<<<<<<<<<<<<
13458  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13459  * areas += elementVolumesArray[eN]
13460  */
13461  __pyx_t_12 = 1;
13462  __pyx_t_14 = __pyx_v_eN;
13463  __pyx_t_13 = 1;
13464  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBarycentersArray.shape[0];
13465  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBarycentersArray.shape[1];
13466  __pyx_t_11 = __pyx_v_eN;
13467  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementVolumesArray.shape[0];
13468  (__pyx_v_sum_star[__pyx_t_12]) = ((__pyx_v_sum_star[__pyx_t_12]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_14 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBarycentersArray.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_11 * __pyx_v_elementVolumesArray.strides[0]) )))));
13469 
13470  /* "mprans/MeshSmoothing.pyx":876
13471  * sum_star[0] += elementBarycentersArray[eN,0]*elementVolumesArray[eN]
13472  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13473  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN] # <<<<<<<<<<<<<<
13474  * areas += elementVolumesArray[eN]
13475  * if alpha != 0:
13476  */
13477  __pyx_t_12 = 2;
13478  __pyx_t_11 = __pyx_v_eN;
13479  __pyx_t_13 = 2;
13480  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBarycentersArray.shape[0];
13481  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBarycentersArray.shape[1];
13482  __pyx_t_14 = __pyx_v_eN;
13483  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementVolumesArray.shape[0];
13484  (__pyx_v_sum_star[__pyx_t_12]) = ((__pyx_v_sum_star[__pyx_t_12]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_11 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBarycentersArray.strides[1]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_14 * __pyx_v_elementVolumesArray.strides[0]) )))));
13485 
13486  /* "mprans/MeshSmoothing.pyx":877
13487  * sum_star[1] += elementBarycentersArray[eN,1]*elementVolumesArray[eN]
13488  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13489  * areas += elementVolumesArray[eN] # <<<<<<<<<<<<<<
13490  * if alpha != 0:
13491  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13492  */
13493  __pyx_t_14 = __pyx_v_eN;
13494  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementVolumesArray.shape[0];
13495  __pyx_v_areas = (__pyx_v_areas + (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_14 * __pyx_v_elementVolumesArray.strides[0]) ))));
13496  }
13497 
13498  /* "mprans/MeshSmoothing.pyx":878
13499  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13500  * areas += elementVolumesArray[eN]
13501  * if alpha != 0: # <<<<<<<<<<<<<<
13502  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13503  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13504  */
13505  __pyx_t_1 = ((__pyx_v_alpha != 0.0) != 0);
13506  if (__pyx_t_1) {
13507 
13508  /* "mprans/MeshSmoothing.pyx":879
13509  * areas += elementVolumesArray[eN]
13510  * if alpha != 0:
13511  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas # <<<<<<<<<<<<<<
13512  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13513  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas
13514  */
13515  __pyx_t_7 = __pyx_v_node;
13516  __pyx_t_14 = 0;
13517  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeArray0.shape[0];
13518  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray0.shape[1];
13519  __pyx_t_13 = __pyx_v_node;
13520  __pyx_t_11 = 0;
13521  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeArray_.shape[0];
13522  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[1];
13523  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_13 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_11 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_alpha * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_7 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArray0.strides[1]) )))) + (((1.0 - __pyx_v_alpha) * (__pyx_v_sum_star[0])) / __pyx_v_areas));
13524 
13525  /* "mprans/MeshSmoothing.pyx":880
13526  * if alpha != 0:
13527  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13528  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas # <<<<<<<<<<<<<<
13529  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas
13530  * else:
13531  */
13532  __pyx_t_14 = __pyx_v_node;
13533  __pyx_t_7 = 0;
13534  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray0.shape[0];
13535  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeArray0.shape[1];
13536  __pyx_t_11 = __pyx_v_node;
13537  __pyx_t_13 = 1;
13538  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[0];
13539  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeArray_.shape[1];
13540  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_11 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_13 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_alpha * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_14 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_7 * __pyx_v_nodeArray0.strides[1]) )))) + (((1.0 - __pyx_v_alpha) * (__pyx_v_sum_star[1])) / __pyx_v_areas));
13541 
13542  /* "mprans/MeshSmoothing.pyx":881
13543  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13544  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13545  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas # <<<<<<<<<<<<<<
13546  * else:
13547  * nodeArray_[node, 0] = sum_star[0]/areas
13548  */
13549  __pyx_t_7 = __pyx_v_node;
13550  __pyx_t_14 = 0;
13551  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeArray0.shape[0];
13552  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray0.shape[1];
13553  __pyx_t_13 = __pyx_v_node;
13554  __pyx_t_11 = 2;
13555  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeArray_.shape[0];
13556  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeArray_.shape[1];
13557  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_13 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_11 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_alpha * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray0.data + __pyx_t_7 * __pyx_v_nodeArray0.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArray0.strides[1]) )))) + (((1.0 - __pyx_v_alpha) * (__pyx_v_sum_star[2])) / __pyx_v_areas));
13558 
13559  /* "mprans/MeshSmoothing.pyx":878
13560  * sum_star[2] += elementBarycentersArray[eN,2]*elementVolumesArray[eN]
13561  * areas += elementVolumesArray[eN]
13562  * if alpha != 0: # <<<<<<<<<<<<<<
13563  * nodeArray_[node, 0] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[0]/areas
13564  * nodeArray_[node, 1] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[1]/areas
13565  */
13566  goto __pyx_L11;
13567  }
13568 
13569  /* "mprans/MeshSmoothing.pyx":883
13570  * nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/areas
13571  * else:
13572  * nodeArray_[node, 0] = sum_star[0]/areas # <<<<<<<<<<<<<<
13573  * nodeArray_[node, 1] = sum_star[1]/areas
13574  * nodeArray_[node, 2] = sum_star[2]/areas
13575  */
13576  /*else*/ {
13577  __pyx_t_14 = __pyx_v_node;
13578  __pyx_t_7 = 0;
13579  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray_.shape[0];
13580  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeArray_.shape[1];
13581  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_14 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_7 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[0]) / __pyx_v_areas);
13582 
13583  /* "mprans/MeshSmoothing.pyx":884
13584  * else:
13585  * nodeArray_[node, 0] = sum_star[0]/areas
13586  * nodeArray_[node, 1] = sum_star[1]/areas # <<<<<<<<<<<<<<
13587  * nodeArray_[node, 2] = sum_star[2]/areas
13588  * if not simultaneous:
13589  */
13590  __pyx_t_7 = __pyx_v_node;
13591  __pyx_t_14 = 1;
13592  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeArray_.shape[0];
13593  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray_.shape[1];
13594  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_7 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[1]) / __pyx_v_areas);
13595 
13596  /* "mprans/MeshSmoothing.pyx":885
13597  * nodeArray_[node, 0] = sum_star[0]/areas
13598  * nodeArray_[node, 1] = sum_star[1]/areas
13599  * nodeArray_[node, 2] = sum_star[2]/areas # <<<<<<<<<<<<<<
13600  * if not simultaneous:
13601  * for eOffset in range(nodeElementOffsets[node],
13602  */
13603  __pyx_t_14 = __pyx_v_node;
13604  __pyx_t_7 = 2;
13605  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray_.shape[0];
13606  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeArray_.shape[1];
13607  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray_.data + __pyx_t_14 * __pyx_v_nodeArray_.strides[0]) ) + __pyx_t_7 * __pyx_v_nodeArray_.strides[1]) )) = ((__pyx_v_sum_star[2]) / __pyx_v_areas);
13608  }
13609  __pyx_L11:;
13610 
13611  /* "mprans/MeshSmoothing.pyx":886
13612  * nodeArray_[node, 1] = sum_star[1]/areas
13613  * nodeArray_[node, 2] = sum_star[2]/areas
13614  * if not simultaneous: # <<<<<<<<<<<<<<
13615  * for eOffset in range(nodeElementOffsets[node],
13616  * nodeElementOffsets[node+1]):
13617  */
13618  __pyx_t_1 = ((!(__pyx_v_simultaneous != 0)) != 0);
13619  if (__pyx_t_1) {
13620 
13621  /* "mprans/MeshSmoothing.pyx":888
13622  * if not simultaneous:
13623  * for eOffset in range(nodeElementOffsets[node],
13624  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13625  * eN = nodeElementsArray[eOffset]
13626  * nA = nodeArray_[elementNodesArray[eN, 0]]
13627  */
13628  __pyx_t_7 = (__pyx_v_node + 1);
13629  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
13630  __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) )));
13631 
13632  /* "mprans/MeshSmoothing.pyx":887
13633  * nodeArray_[node, 2] = sum_star[2]/areas
13634  * if not simultaneous:
13635  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13636  * nodeElementOffsets[node+1]):
13637  * eN = nodeElementsArray[eOffset]
13638  */
13639  __pyx_t_7 = __pyx_v_node;
13640  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
13641 
13642  /* "mprans/MeshSmoothing.pyx":888
13643  * if not simultaneous:
13644  * for eOffset in range(nodeElementOffsets[node],
13645  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
13646  * eN = nodeElementsArray[eOffset]
13647  * nA = nodeArray_[elementNodesArray[eN, 0]]
13648  */
13649  __pyx_t_9 = __pyx_t_8;
13650  for (__pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
13651 
13652  /* "mprans/MeshSmoothing.pyx":887
13653  * nodeArray_[node, 2] = sum_star[2]/areas
13654  * if not simultaneous:
13655  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
13656  * nodeElementOffsets[node+1]):
13657  * eN = nodeElementsArray[eOffset]
13658  */
13659  __pyx_v_eOffset = __pyx_t_10;
13660 
13661  /* "mprans/MeshSmoothing.pyx":889
13662  * for eOffset in range(nodeElementOffsets[node],
13663  * nodeElementOffsets[node+1]):
13664  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
13665  * nA = nodeArray_[elementNodesArray[eN, 0]]
13666  * nB = nodeArray_[elementNodesArray[eN, 1]]
13667  */
13668  __pyx_t_14 = __pyx_v_eOffset;
13669  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeElementsArray.shape[0];
13670  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_14 * __pyx_v_nodeElementsArray.strides[0]) )));
13671 
13672  /* "mprans/MeshSmoothing.pyx":890
13673  * nodeElementOffsets[node+1]):
13674  * eN = nodeElementsArray[eOffset]
13675  * nA = nodeArray_[elementNodesArray[eN, 0]] # <<<<<<<<<<<<<<
13676  * nB = nodeArray_[elementNodesArray[eN, 1]]
13677  * nC = nodeArray_[elementNodesArray[eN, 2]]
13678  */
13679  __pyx_t_14 = __pyx_v_eN;
13680  __pyx_t_11 = 0;
13681  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementNodesArray.shape[0];
13682  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[1];
13683  __pyx_t_15.data = __pyx_v_nodeArray_.data;
13684  __pyx_t_15.memview = __pyx_v_nodeArray_.memview;
13685  __PYX_INC_MEMVIEW(&__pyx_t_15, 0);
13686  {
13687  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_14 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementNodesArray.strides[1]) )));
13688  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray_.shape[0];
13689  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray_.strides[0];
13690  if (__pyx_tmp_idx < 0)
13691  __pyx_tmp_idx += __pyx_tmp_shape;
13692  __pyx_t_15.data += __pyx_tmp_idx * __pyx_tmp_stride;
13693 }
13694 
13695 __pyx_t_15.shape[0] = __pyx_v_nodeArray_.shape[1];
13696 __pyx_t_15.strides[0] = __pyx_v_nodeArray_.strides[1];
13697  __pyx_t_15.suboffsets[0] = -1;
13698 
13699 __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
13700  __pyx_v_nA = __pyx_t_15;
13701  __pyx_t_15.memview = NULL;
13702  __pyx_t_15.data = NULL;
13703 
13704  /* "mprans/MeshSmoothing.pyx":891
13705  * eN = nodeElementsArray[eOffset]
13706  * nA = nodeArray_[elementNodesArray[eN, 0]]
13707  * nB = nodeArray_[elementNodesArray[eN, 1]] # <<<<<<<<<<<<<<
13708  * nC = nodeArray_[elementNodesArray[eN, 2]]
13709  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13710  */
13711  __pyx_t_11 = __pyx_v_eN;
13712  __pyx_t_14 = 1;
13713  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[0];
13714  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementNodesArray.shape[1];
13715  __pyx_t_15.data = __pyx_v_nodeArray_.data;
13716  __pyx_t_15.memview = __pyx_v_nodeArray_.memview;
13717  __PYX_INC_MEMVIEW(&__pyx_t_15, 0);
13718  {
13719  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_11 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_14 * __pyx_v_elementNodesArray.strides[1]) )));
13720  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray_.shape[0];
13721  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray_.strides[0];
13722  if (__pyx_tmp_idx < 0)
13723  __pyx_tmp_idx += __pyx_tmp_shape;
13724  __pyx_t_15.data += __pyx_tmp_idx * __pyx_tmp_stride;
13725 }
13726 
13727 __pyx_t_15.shape[0] = __pyx_v_nodeArray_.shape[1];
13728 __pyx_t_15.strides[0] = __pyx_v_nodeArray_.strides[1];
13729  __pyx_t_15.suboffsets[0] = -1;
13730 
13731 __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
13732  __pyx_v_nB = __pyx_t_15;
13733  __pyx_t_15.memview = NULL;
13734  __pyx_t_15.data = NULL;
13735 
13736  /* "mprans/MeshSmoothing.pyx":892
13737  * nA = nodeArray_[elementNodesArray[eN, 0]]
13738  * nB = nodeArray_[elementNodesArray[eN, 1]]
13739  * nC = nodeArray_[elementNodesArray[eN, 2]] # <<<<<<<<<<<<<<
13740  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13741  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13742  */
13743  __pyx_t_14 = __pyx_v_eN;
13744  __pyx_t_11 = 2;
13745  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementNodesArray.shape[0];
13746  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[1];
13747  __pyx_t_15.data = __pyx_v_nodeArray_.data;
13748  __pyx_t_15.memview = __pyx_v_nodeArray_.memview;
13749  __PYX_INC_MEMVIEW(&__pyx_t_15, 0);
13750  {
13751  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_14 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementNodesArray.strides[1]) )));
13752  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray_.shape[0];
13753  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray_.strides[0];
13754  if (__pyx_tmp_idx < 0)
13755  __pyx_tmp_idx += __pyx_tmp_shape;
13756  __pyx_t_15.data += __pyx_tmp_idx * __pyx_tmp_stride;
13757 }
13758 
13759 __pyx_t_15.shape[0] = __pyx_v_nodeArray_.shape[1];
13760 __pyx_t_15.strides[0] = __pyx_v_nodeArray_.strides[1];
13761  __pyx_t_15.suboffsets[0] = -1;
13762 
13763 __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
13764  __pyx_v_nC = __pyx_t_15;
13765  __pyx_t_15.memview = NULL;
13766  __pyx_t_15.data = NULL;
13767 
13768  /* "mprans/MeshSmoothing.pyx":893
13769  * nB = nodeArray_[elementNodesArray[eN, 1]]
13770  * nC = nodeArray_[elementNodesArray[eN, 2]]
13771  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC) # <<<<<<<<<<<<<<
13772  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13773  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3.
13774  */
13775  __pyx_t_11 = __pyx_v_eN;
13776  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementVolumesArray.shape[0];
13777  *((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray.data + __pyx_t_11 * __pyx_v_elementVolumesArray.strides[0]) )) = __pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__pyx_v_nA, __pyx_v_nB, __pyx_v_nC);
13778 
13779  /* "mprans/MeshSmoothing.pyx":894
13780  * nC = nodeArray_[elementNodesArray[eN, 2]]
13781  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13782  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3. # <<<<<<<<<<<<<<
13783  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3.
13784  * elementBarycentersArray[eN, 2] = (nA[2]+nB[2]+nC[2])/3.
13785  */
13786  __pyx_t_11 = 0;
13787  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nA.shape[0];
13788  __pyx_t_14 = 0;
13789  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nB.shape[0];
13790  __pyx_t_13 = 0;
13791  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nC.shape[0];
13792  __pyx_t_16 = __pyx_v_eN;
13793  __pyx_t_17 = 0;
13794  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementBarycentersArray.shape[0];
13795  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementBarycentersArray.shape[1];
13796  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_16 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementBarycentersArray.strides[1]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_11 * __pyx_v_nA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_14 * __pyx_v_nB.strides[0]) )))) + (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_13 * __pyx_v_nC.strides[0]) )))) / 3.);
13797 
13798  /* "mprans/MeshSmoothing.pyx":895
13799  * elementVolumesArray[eN] = cyGetElementVolumeTriangle(nA, nB, nC)
13800  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13801  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3. # <<<<<<<<<<<<<<
13802  * elementBarycentersArray[eN, 2] = (nA[2]+nB[2]+nC[2])/3.
13803  *
13804  */
13805  __pyx_t_13 = 1;
13806  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nA.shape[0];
13807  __pyx_t_14 = 1;
13808  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nB.shape[0];
13809  __pyx_t_11 = 1;
13810  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nC.shape[0];
13811  __pyx_t_17 = __pyx_v_eN;
13812  __pyx_t_16 = 1;
13813  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementBarycentersArray.shape[0];
13814  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementBarycentersArray.shape[1];
13815  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_17 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementBarycentersArray.strides[1]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_13 * __pyx_v_nA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_14 * __pyx_v_nB.strides[0]) )))) + (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_11 * __pyx_v_nC.strides[0]) )))) / 3.);
13816 
13817  /* "mprans/MeshSmoothing.pyx":896
13818  * elementBarycentersArray[eN, 0] = (nA[0]+nB[0]+nC[0])/3.
13819  * elementBarycentersArray[eN, 1] = (nA[1]+nB[1]+nC[1])/3.
13820  * elementBarycentersArray[eN, 2] = (nA[2]+nB[2]+nC[2])/3. # <<<<<<<<<<<<<<
13821  *
13822  * # cdef tuple cyGetDistortionDilation(double[:,:,:,:] J_array,
13823  */
13824  __pyx_t_11 = 2;
13825  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nA.shape[0];
13826  __pyx_t_14 = 2;
13827  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nB.shape[0];
13828  __pyx_t_13 = 2;
13829  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nC.shape[0];
13830  __pyx_t_16 = __pyx_v_eN;
13831  __pyx_t_17 = 2;
13832  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementBarycentersArray.shape[0];
13833  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementBarycentersArray.shape[1];
13834  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_16 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementBarycentersArray.strides[1]) )) = ((((*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_11 * __pyx_v_nA.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_14 * __pyx_v_nB.strides[0]) )))) + (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_13 * __pyx_v_nC.strides[0]) )))) / 3.);
13835  }
13836 
13837  /* "mprans/MeshSmoothing.pyx":886
13838  * nodeArray_[node, 1] = sum_star[1]/areas
13839  * nodeArray_[node, 2] = sum_star[2]/areas
13840  * if not simultaneous: # <<<<<<<<<<<<<<
13841  * for eOffset in range(nodeElementOffsets[node],
13842  * nodeElementOffsets[node+1]):
13843  */
13844  }
13845 
13846  /* "mprans/MeshSmoothing.pyx":870
13847  * sum_star[2] = 0.
13848  * areas = 0.
13849  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
13850  * for eOffset in range(nodeElementOffsets[node],
13851  * nodeElementOffsets[node+1]):
13852  */
13853  }
13854  }
13855 
13856  /* "mprans/MeshSmoothing.pyx":834
13857  * # nodeArray_[node, 2] = alpha*nodeArray0[node, 0]+(1-alpha)*sum_star[2]/nNodes
13858  *
13859  * cdef void cySmoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
13860  * int[:] nodeElementOffsets,
13861  * int[:] nodeElementsArray,
13862  */
13863 
13864  /* function exit code */
13865  goto __pyx_L0;
13866  __pyx_L1_error:;
13867  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
13868  __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
13869  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cySmoothNodesCentroid", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13870  __pyx_L0:;
13871  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArray0, 1);
13872  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
13873  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
13874  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
13875  __Pyx_RefNannyFinishContext();
13876 }
13877 
13878 /* "mprans/MeshSmoothing.pyx":932
13879  * # return distortion_array, dilation_array
13880  *
13881  * cdef void cyUpdateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
13882  * double[:] elementVolumeArray,
13883  * double[:] elementVolumeTargetArray,
13884  */
13885 
13886 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements(__Pyx_memviewslice __pyx_v_elementDilationArray_, __Pyx_memviewslice __pyx_v_elementVolumeArray, __Pyx_memviewslice __pyx_v_elementVolumeTargetArray, int __pyx_v_nElements) {
13887  double __pyx_v_dilation;
13888  int __pyx_v_eN;
13889  __Pyx_RefNannyDeclarations
13890  int __pyx_t_1;
13891  int __pyx_t_2;
13892  int __pyx_t_3;
13893  Py_ssize_t __pyx_t_4;
13894  Py_ssize_t __pyx_t_5;
13895  int __pyx_t_6;
13896  __Pyx_RefNannySetupContext("cyUpdateDilationElements", 0);
13897 
13898  /* "mprans/MeshSmoothing.pyx":938
13899  * cdef double dilation
13900  * cdef int eN
13901  * for eN in range(nElements): # <<<<<<<<<<<<<<
13902  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13903  * if dilation < 1.:
13904  */
13905  __pyx_t_1 = __pyx_v_nElements;
13906  __pyx_t_2 = __pyx_t_1;
13907  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
13908  __pyx_v_eN = __pyx_t_3;
13909 
13910  /* "mprans/MeshSmoothing.pyx":939
13911  * cdef int eN
13912  * for eN in range(nElements):
13913  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN] # <<<<<<<<<<<<<<
13914  * if dilation < 1.:
13915  * dilation = 1/dilation
13916  */
13917  __pyx_t_4 = __pyx_v_eN;
13918  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementVolumeArray.shape[0];
13919  __pyx_t_5 = __pyx_v_eN;
13920  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementVolumeTargetArray.shape[0];
13921  __pyx_v_dilation = ((*((double *) ( /* dim=0 */ (__pyx_v_elementVolumeArray.data + __pyx_t_4 * __pyx_v_elementVolumeArray.strides[0]) ))) / (*((double *) ( /* dim=0 */ (__pyx_v_elementVolumeTargetArray.data + __pyx_t_5 * __pyx_v_elementVolumeTargetArray.strides[0]) ))));
13922 
13923  /* "mprans/MeshSmoothing.pyx":940
13924  * for eN in range(nElements):
13925  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13926  * if dilation < 1.: # <<<<<<<<<<<<<<
13927  * dilation = 1/dilation
13928  * elementDilationArray_[eN] = dilation
13929  */
13930  __pyx_t_6 = ((__pyx_v_dilation < 1.) != 0);
13931  if (__pyx_t_6) {
13932 
13933  /* "mprans/MeshSmoothing.pyx":941
13934  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13935  * if dilation < 1.:
13936  * dilation = 1/dilation # <<<<<<<<<<<<<<
13937  * elementDilationArray_[eN] = dilation
13938  *
13939  */
13940  __pyx_v_dilation = (1.0 / __pyx_v_dilation);
13941 
13942  /* "mprans/MeshSmoothing.pyx":940
13943  * for eN in range(nElements):
13944  * dilation = elementVolumeArray[eN]/elementVolumeTargetArray[eN]
13945  * if dilation < 1.: # <<<<<<<<<<<<<<
13946  * dilation = 1/dilation
13947  * elementDilationArray_[eN] = dilation
13948  */
13949  }
13950 
13951  /* "mprans/MeshSmoothing.pyx":942
13952  * if dilation < 1.:
13953  * dilation = 1/dilation
13954  * elementDilationArray_[eN] = dilation # <<<<<<<<<<<<<<
13955  *
13956  * cdef void cyUpdateDistortionElements(double[:] elementDistortionArray_,
13957  */
13958  __pyx_t_5 = __pyx_v_eN;
13959  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementDilationArray_.shape[0];
13960  *((double *) ( /* dim=0 */ (__pyx_v_elementDilationArray_.data + __pyx_t_5 * __pyx_v_elementDilationArray_.strides[0]) )) = __pyx_v_dilation;
13961  }
13962 
13963  /* "mprans/MeshSmoothing.pyx":932
13964  * # return distortion_array, dilation_array
13965  *
13966  * cdef void cyUpdateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
13967  * double[:] elementVolumeArray,
13968  * double[:] elementVolumeTargetArray,
13969  */
13970 
13971  /* function exit code */
13972  __Pyx_RefNannyFinishContext();
13973 }
13974 
13975 /* "mprans/MeshSmoothing.pyx":944
13976  * elementDilationArray_[eN] = dilation
13977  *
13978  * cdef void cyUpdateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
13979  * double[:,:,:,:] J_array,
13980  * double[:,:] detJ_array,
13981  */
13982 
13983 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements(__Pyx_memviewslice __pyx_v_elementDistortionArray_, __Pyx_memviewslice __pyx_v_J_array, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd, int __pyx_v_nElements) {
13984  __Pyx_memviewslice __pyx_v_J = { 0, 0, { 0 }, { 0 }, { 0 } };
13985  __Pyx_memviewslice __pyx_v_JT = { 0, 0, { 0 }, { 0 }, { 0 } };
13986  double __pyx_v_detJ;
13987  double __pyx_v_trJTJ;
13988  __Pyx_memviewslice __pyx_v_JTJ = { 0, 0, { 0 }, { 0 }, { 0 } };
13989  int __pyx_v_eN;
13990  int __pyx_v_iJ;
13991  __Pyx_RefNannyDeclarations
13992  PyObject *__pyx_t_1 = NULL;
13993  Py_ssize_t __pyx_t_2;
13994  Py_ssize_t __pyx_t_3;
13995  int __pyx_t_4;
13996  Py_ssize_t __pyx_t_5;
13997  Py_ssize_t __pyx_t_6;
13998  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
13999  PyObject *__pyx_t_8 = NULL;
14000  PyObject *__pyx_t_9 = NULL;
14001  PyObject *__pyx_t_10 = NULL;
14002  PyObject *__pyx_t_11 = NULL;
14003  int __pyx_t_12;
14004  PyObject *__pyx_t_13 = NULL;
14005  size_t __pyx_t_14;
14006  Py_ssize_t __pyx_t_15;
14007  int __pyx_lineno = 0;
14008  const char *__pyx_filename = NULL;
14009  int __pyx_clineno = 0;
14010  __Pyx_RefNannySetupContext("cyUpdateDistortionElements", 0);
14011 
14012  /* "mprans/MeshSmoothing.pyx":956
14013  * cdef int eN
14014  * cdef int iJ
14015  * for eN in range(len(nElements)): # <<<<<<<<<<<<<<
14016  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points
14017  * J = J_array[eN][0]
14018  */
14019  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 956, __pyx_L1_error)
14020  __Pyx_GOTREF(__pyx_t_1);
14021  __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 956, __pyx_L1_error)
14022  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14023  __pyx_t_3 = __pyx_t_2;
14024  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
14025  __pyx_v_eN = __pyx_t_4;
14026 
14027  /* "mprans/MeshSmoothing.pyx":957
14028  * cdef int iJ
14029  * for eN in range(len(nElements)):
14030  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points # <<<<<<<<<<<<<<
14031  * J = J_array[eN][0]
14032  * JT = np.transpose(J)
14033  */
14034  __pyx_t_5 = __pyx_v_eN;
14035  __pyx_t_6 = 0;
14036  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_detJ_array.shape[0];
14037  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_detJ_array.shape[1];
14038  __pyx_v_detJ = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_5 * __pyx_v_detJ_array.strides[0]) ) + __pyx_t_6 * __pyx_v_detJ_array.strides[1]) )));
14039 
14040  /* "mprans/MeshSmoothing.pyx":958
14041  * for eN in range(len(nElements)):
14042  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points
14043  * J = J_array[eN][0] # <<<<<<<<<<<<<<
14044  * JT = np.transpose(J)
14045  * JTJ = np.zeros_like(J)
14046  */
14047  __pyx_t_7.data = __pyx_v_J_array.data;
14048  __pyx_t_7.memview = __pyx_v_J_array.memview;
14049  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
14050  {
14051  Py_ssize_t __pyx_tmp_idx = __pyx_v_eN;
14052  Py_ssize_t __pyx_tmp_shape = __pyx_v_J_array.shape[0];
14053  Py_ssize_t __pyx_tmp_stride = __pyx_v_J_array.strides[0];
14054  if (__pyx_tmp_idx < 0)
14055  __pyx_tmp_idx += __pyx_tmp_shape;
14056  __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
14057 }
14058 
14059 {
14060  Py_ssize_t __pyx_tmp_idx = 0;
14061  Py_ssize_t __pyx_tmp_shape = __pyx_v_J_array.shape[1];
14062  Py_ssize_t __pyx_tmp_stride = __pyx_v_J_array.strides[1];
14063  if (__pyx_tmp_idx < 0)
14064  __pyx_tmp_idx += __pyx_tmp_shape;
14065  __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
14066 }
14067 
14068 __pyx_t_7.shape[0] = __pyx_v_J_array.shape[2];
14069 __pyx_t_7.strides[0] = __pyx_v_J_array.strides[2];
14070  __pyx_t_7.suboffsets[0] = -1;
14071 
14072 __pyx_t_7.shape[1] = __pyx_v_J_array.shape[3];
14073 __pyx_t_7.strides[1] = __pyx_v_J_array.strides[3];
14074  __pyx_t_7.suboffsets[1] = -1;
14075 
14076 __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
14077  __pyx_v_J = __pyx_t_7;
14078  __pyx_t_7.memview = NULL;
14079  __pyx_t_7.data = NULL;
14080 
14081  /* "mprans/MeshSmoothing.pyx":959
14082  * detJ = detJ_array[eN, 0] # index 0 as it is the same for all quadrature points
14083  * J = J_array[eN][0]
14084  * JT = np.transpose(J) # <<<<<<<<<<<<<<
14085  * JTJ = np.zeros_like(J)
14086  * JTJ = np.dot(J, JT)
14087  */
14088  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 959, __pyx_L1_error)
14089  __Pyx_GOTREF(__pyx_t_8);
14090  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_transpose); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error)
14091  __Pyx_GOTREF(__pyx_t_9);
14092  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14093  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 959, __pyx_L1_error)
14094  __Pyx_GOTREF(__pyx_t_8);
14095  __pyx_t_10 = NULL;
14096  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14097  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
14098  if (likely(__pyx_t_10)) {
14099  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14100  __Pyx_INCREF(__pyx_t_10);
14101  __Pyx_INCREF(function);
14102  __Pyx_DECREF_SET(__pyx_t_9, function);
14103  }
14104  }
14105  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8);
14106  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14107  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14108  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 959, __pyx_L1_error)
14109  __Pyx_GOTREF(__pyx_t_1);
14110  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14111  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 959, __pyx_L1_error)
14112  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14113  __PYX_XDEC_MEMVIEW(&__pyx_v_JT, 1);
14114  __pyx_v_JT = __pyx_t_7;
14115  __pyx_t_7.memview = NULL;
14116  __pyx_t_7.data = NULL;
14117 
14118  /* "mprans/MeshSmoothing.pyx":960
14119  * J = J_array[eN][0]
14120  * JT = np.transpose(J)
14121  * JTJ = np.zeros_like(J) # <<<<<<<<<<<<<<
14122  * JTJ = np.dot(J, JT)
14123  * trJTJ = 0.
14124  */
14125  __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 960, __pyx_L1_error)
14126  __Pyx_GOTREF(__pyx_t_9);
14127  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros_like); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 960, __pyx_L1_error)
14128  __Pyx_GOTREF(__pyx_t_8);
14129  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14130  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 960, __pyx_L1_error)
14131  __Pyx_GOTREF(__pyx_t_9);
14132  __pyx_t_10 = NULL;
14133  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
14134  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
14135  if (likely(__pyx_t_10)) {
14136  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
14137  __Pyx_INCREF(__pyx_t_10);
14138  __Pyx_INCREF(function);
14139  __Pyx_DECREF_SET(__pyx_t_8, function);
14140  }
14141  }
14142  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9);
14143  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
14144  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14145  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 960, __pyx_L1_error)
14146  __Pyx_GOTREF(__pyx_t_1);
14147  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14148  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 960, __pyx_L1_error)
14149  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14150  __PYX_XDEC_MEMVIEW(&__pyx_v_JTJ, 1);
14151  __pyx_v_JTJ = __pyx_t_7;
14152  __pyx_t_7.memview = NULL;
14153  __pyx_t_7.data = NULL;
14154 
14155  /* "mprans/MeshSmoothing.pyx":961
14156  * JT = np.transpose(J)
14157  * JTJ = np.zeros_like(J)
14158  * JTJ = np.dot(J, JT) # <<<<<<<<<<<<<<
14159  * trJTJ = 0.
14160  * for iJ in range(len(J)):
14161  */
14162  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
14163  __Pyx_GOTREF(__pyx_t_8);
14164  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_dot); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 961, __pyx_L1_error)
14165  __Pyx_GOTREF(__pyx_t_9);
14166  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14167  __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_J, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 961, __pyx_L1_error)
14168  __Pyx_GOTREF(__pyx_t_8);
14169  __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_JT, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
14170  __Pyx_GOTREF(__pyx_t_10);
14171  __pyx_t_11 = NULL;
14172  __pyx_t_12 = 0;
14173  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
14174  __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
14175  if (likely(__pyx_t_11)) {
14176  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
14177  __Pyx_INCREF(__pyx_t_11);
14178  __Pyx_INCREF(function);
14179  __Pyx_DECREF_SET(__pyx_t_9, function);
14180  __pyx_t_12 = 1;
14181  }
14182  }
14183  #if CYTHON_FAST_PYCALL
14184  if (PyFunction_Check(__pyx_t_9)) {
14185  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_10};
14186  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
14187  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
14188  __Pyx_GOTREF(__pyx_t_1);
14189  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14190  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14191  } else
14192  #endif
14193  #if CYTHON_FAST_PYCCALL
14194  if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
14195  PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_10};
14196  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
14197  __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
14198  __Pyx_GOTREF(__pyx_t_1);
14199  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14200  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14201  } else
14202  #endif
14203  {
14204  __pyx_t_13 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 961, __pyx_L1_error)
14205  __Pyx_GOTREF(__pyx_t_13);
14206  if (__pyx_t_11) {
14207  __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
14208  }
14209  __Pyx_GIVEREF(__pyx_t_8);
14210  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_8);
14211  __Pyx_GIVEREF(__pyx_t_10);
14212  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_10);
14213  __pyx_t_8 = 0;
14214  __pyx_t_10 = 0;
14215  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 961, __pyx_L1_error)
14216  __Pyx_GOTREF(__pyx_t_1);
14217  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
14218  }
14219  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14220  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 961, __pyx_L1_error)
14221  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14222  __PYX_XDEC_MEMVIEW(&__pyx_v_JTJ, 1);
14223  __pyx_v_JTJ = __pyx_t_7;
14224  __pyx_t_7.memview = NULL;
14225  __pyx_t_7.data = NULL;
14226 
14227  /* "mprans/MeshSmoothing.pyx":962
14228  * JTJ = np.zeros_like(J)
14229  * JTJ = np.dot(J, JT)
14230  * trJTJ = 0. # <<<<<<<<<<<<<<
14231  * for iJ in range(len(J)):
14232  * trJTJ += JTJ[iJ,iJ]
14233  */
14234  __pyx_v_trJTJ = 0.;
14235 
14236  /* "mprans/MeshSmoothing.pyx":963
14237  * JTJ = np.dot(J, JT)
14238  * trJTJ = 0.
14239  * for iJ in range(len(J)): # <<<<<<<<<<<<<<
14240  * trJTJ += JTJ[iJ,iJ]
14241  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
14242  */
14243  __pyx_t_14 = __Pyx_MemoryView_Len(__pyx_v_J);
14244  __pyx_t_15 = __pyx_t_14;
14245  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_15; __pyx_t_12+=1) {
14246  __pyx_v_iJ = __pyx_t_12;
14247 
14248  /* "mprans/MeshSmoothing.pyx":964
14249  * trJTJ = 0.
14250  * for iJ in range(len(J)):
14251  * trJTJ += JTJ[iJ,iJ] # <<<<<<<<<<<<<<
14252  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
14253  *
14254  */
14255  __pyx_t_6 = __pyx_v_iJ;
14256  __pyx_t_5 = __pyx_v_iJ;
14257  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_JTJ.shape[0];
14258  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_JTJ.shape[1];
14259  __pyx_v_trJTJ = (__pyx_v_trJTJ + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_JTJ.data + __pyx_t_6 * __pyx_v_JTJ.strides[0]) ) + __pyx_t_5 * __pyx_v_JTJ.strides[1]) ))));
14260  }
14261 
14262  /* "mprans/MeshSmoothing.pyx":965
14263  * for iJ in range(len(J)):
14264  * trJTJ += JTJ[iJ,iJ]
14265  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ # <<<<<<<<<<<<<<
14266  *
14267  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_,
14268  */
14269  __pyx_t_5 = __pyx_v_eN;
14270  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementDistortionArray_.shape[0];
14271  *((double *) ( /* dim=0 */ (__pyx_v_elementDistortionArray_.data + __pyx_t_5 * __pyx_v_elementDistortionArray_.strides[0]) )) = (pow(((1. / __pyx_v_nd) * __pyx_v_trJTJ), (__pyx_v_nd / 2.)) / __pyx_v_detJ);
14272  }
14273 
14274  /* "mprans/MeshSmoothing.pyx":944
14275  * elementDilationArray_[eN] = dilation
14276  *
14277  * cdef void cyUpdateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
14278  * double[:,:,:,:] J_array,
14279  * double[:,:] detJ_array,
14280  */
14281 
14282  /* function exit code */
14283  goto __pyx_L0;
14284  __pyx_L1_error:;
14285  __Pyx_XDECREF(__pyx_t_1);
14286  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
14287  __Pyx_XDECREF(__pyx_t_8);
14288  __Pyx_XDECREF(__pyx_t_9);
14289  __Pyx_XDECREF(__pyx_t_10);
14290  __Pyx_XDECREF(__pyx_t_11);
14291  __Pyx_XDECREF(__pyx_t_13);
14292  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateDistortionElements", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
14293  __pyx_L0:;
14294  __PYX_XDEC_MEMVIEW(&__pyx_v_J, 1);
14295  __PYX_XDEC_MEMVIEW(&__pyx_v_JT, 1);
14296  __PYX_XDEC_MEMVIEW(&__pyx_v_JTJ, 1);
14297  __Pyx_RefNannyFinishContext();
14298 }
14299 
14300 /* "mprans/MeshSmoothing.pyx":967
14301  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
14302  *
14303  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
14304  * double[:,:] nodeArray,
14305  * int[:,:] elementNodesArray,
14306  */
14307 
14308 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes(__Pyx_memviewslice __pyx_v_IMRNodesArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, int __pyx_v_nElements, int __pyx_v_nNodes, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes *__pyx_optional_args) {
14309 
14310  /* "mprans/MeshSmoothing.pyx":974
14311  * int nElements,
14312  * int nNodes,
14313  * bool el_average=False): # <<<<<<<<<<<<<<
14314  * cdef double[:,:] W = np.array([[1., 0.5],
14315  * [0., sqrt(3)/2.]])
14316  */
14317  bool __pyx_v_el_average = ((bool)0);
14318  __Pyx_memviewslice __pyx_v_W = { 0, 0, { 0 }, { 0 }, { 0 } };
14319  __Pyx_memviewslice __pyx_v_A = { 0, 0, { 0 }, { 0 }, { 0 } };
14320  __Pyx_memviewslice __pyx_v_AW = { 0, 0, { 0 }, { 0 }, { 0 } };
14321  __Pyx_memviewslice __pyx_v_nElementsArray = { 0, 0, { 0 }, { 0 }, { 0 } };
14322  __Pyx_memviewslice __pyx_v_IMR_elements = { 0, 0, { 0 }, { 0 }, { 0 } };
14323  int __pyx_v_nNel;
14324  __Pyx_memviewslice __pyx_v_vec_a = { 0, 0, { 0 }, { 0 }, { 0 } };
14325  __Pyx_memviewslice __pyx_v_vec_b = { 0, 0, { 0 }, { 0 }, { 0 } };
14326  __Pyx_memviewslice __pyx_v_vec_c = { 0, 0, { 0 }, { 0 }, { 0 } };
14327  double __pyx_v_IMR;
14328  int __pyx_v_nEl;
14329  int __pyx_v_iN;
14330  int __pyx_v_eN;
14331  int __pyx_v_node;
14332  int __pyx_v_eOffset;
14333  __Pyx_RefNannyDeclarations
14334  PyObject *__pyx_t_1 = NULL;
14335  PyObject *__pyx_t_2 = NULL;
14336  PyObject *__pyx_t_3 = NULL;
14337  PyObject *__pyx_t_4 = NULL;
14338  PyObject *__pyx_t_5 = NULL;
14339  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
14340  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
14341  int __pyx_t_8;
14342  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
14343  int __pyx_t_10;
14344  int __pyx_t_11;
14345  int __pyx_t_12;
14346  int __pyx_t_13;
14347  int __pyx_t_14;
14348  int __pyx_t_15;
14349  Py_ssize_t __pyx_t_16;
14350  Py_ssize_t __pyx_t_17;
14351  Py_ssize_t __pyx_t_18;
14352  Py_ssize_t __pyx_t_19;
14353  PyObject *__pyx_t_20 = NULL;
14354  PyObject *__pyx_t_21 = NULL;
14355  int __pyx_t_22;
14356  Py_ssize_t __pyx_t_23;
14357  Py_ssize_t __pyx_t_24;
14358  Py_ssize_t __pyx_t_25;
14359  Py_ssize_t __pyx_t_26;
14360  Py_ssize_t __pyx_t_27;
14361  Py_ssize_t __pyx_t_28;
14362  Py_ssize_t __pyx_t_29;
14363  Py_ssize_t __pyx_t_30;
14364  Py_ssize_t __pyx_t_31;
14365  Py_ssize_t __pyx_t_32;
14366  Py_ssize_t __pyx_t_33;
14367  Py_ssize_t __pyx_t_34;
14368  int __pyx_lineno = 0;
14369  const char *__pyx_filename = NULL;
14370  int __pyx_clineno = 0;
14371  __Pyx_RefNannySetupContext("cyUpdateInverseMeanRatioTriangleNodes", 0);
14372  if (__pyx_optional_args) {
14373  if (__pyx_optional_args->__pyx_n > 0) {
14374  __pyx_v_el_average = __pyx_optional_args->el_average;
14375  }
14376  }
14377 
14378  /* "mprans/MeshSmoothing.pyx":975
14379  * int nNodes,
14380  * bool el_average=False):
14381  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
14382  * [0., sqrt(3)/2.]])
14383  * cdef double[:,:] A = np.zeros((2,2))
14384  */
14385  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error)
14386  __Pyx_GOTREF(__pyx_t_2);
14387  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 975, __pyx_L1_error)
14388  __Pyx_GOTREF(__pyx_t_3);
14389  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14390  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 975, __pyx_L1_error)
14391  __Pyx_GOTREF(__pyx_t_2);
14392  __Pyx_INCREF(__pyx_float_1_);
14393  __Pyx_GIVEREF(__pyx_float_1_);
14394  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_1_);
14395  __Pyx_INCREF(__pyx_float_0_5);
14396  __Pyx_GIVEREF(__pyx_float_0_5);
14397  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_0_5);
14398 
14399  /* "mprans/MeshSmoothing.pyx":976
14400  * bool el_average=False):
14401  * cdef double[:,:] W = np.array([[1., 0.5],
14402  * [0., sqrt(3)/2.]]) # <<<<<<<<<<<<<<
14403  * cdef double[:,:] A = np.zeros((2,2))
14404  * cdef double[:,:] AW = np.zeros((2,2))
14405  */
14406  __pyx_t_4 = PyFloat_FromDouble((sqrt(3.0) / 2.)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 976, __pyx_L1_error)
14407  __Pyx_GOTREF(__pyx_t_4);
14408  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 976, __pyx_L1_error)
14409  __Pyx_GOTREF(__pyx_t_5);
14410  __Pyx_INCREF(__pyx_float_0_);
14411  __Pyx_GIVEREF(__pyx_float_0_);
14412  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_float_0_);
14413  __Pyx_GIVEREF(__pyx_t_4);
14414  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
14415  __pyx_t_4 = 0;
14416 
14417  /* "mprans/MeshSmoothing.pyx":975
14418  * int nNodes,
14419  * bool el_average=False):
14420  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
14421  * [0., sqrt(3)/2.]])
14422  * cdef double[:,:] A = np.zeros((2,2))
14423  */
14424  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 975, __pyx_L1_error)
14425  __Pyx_GOTREF(__pyx_t_4);
14426  __Pyx_GIVEREF(__pyx_t_2);
14427  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
14428  __Pyx_GIVEREF(__pyx_t_5);
14429  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
14430  __pyx_t_2 = 0;
14431  __pyx_t_5 = 0;
14432  __pyx_t_5 = NULL;
14433  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14434  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
14435  if (likely(__pyx_t_5)) {
14436  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14437  __Pyx_INCREF(__pyx_t_5);
14438  __Pyx_INCREF(function);
14439  __Pyx_DECREF_SET(__pyx_t_3, function);
14440  }
14441  }
14442  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
14443  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14444  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14445  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 975, __pyx_L1_error)
14446  __Pyx_GOTREF(__pyx_t_1);
14447  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14448  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 975, __pyx_L1_error)
14449  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14450  __pyx_v_W = __pyx_t_6;
14451  __pyx_t_6.memview = NULL;
14452  __pyx_t_6.data = NULL;
14453 
14454  /* "mprans/MeshSmoothing.pyx":977
14455  * cdef double[:,:] W = np.array([[1., 0.5],
14456  * [0., sqrt(3)/2.]])
14457  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
14458  * cdef double[:,:] AW = np.zeros((2,2))
14459  * cdef int[:] nElementsArray = np.zeros(nElements)
14460  */
14461  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 977, __pyx_L1_error)
14462  __Pyx_GOTREF(__pyx_t_3);
14463  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
14464  __Pyx_GOTREF(__pyx_t_4);
14465  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14466  __pyx_t_3 = NULL;
14467  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14468  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
14469  if (likely(__pyx_t_3)) {
14470  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14471  __Pyx_INCREF(__pyx_t_3);
14472  __Pyx_INCREF(function);
14473  __Pyx_DECREF_SET(__pyx_t_4, function);
14474  }
14475  }
14476  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_tuple__6);
14477  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14478  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 977, __pyx_L1_error)
14479  __Pyx_GOTREF(__pyx_t_1);
14480  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14481  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 977, __pyx_L1_error)
14482  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14483  __pyx_v_A = __pyx_t_6;
14484  __pyx_t_6.memview = NULL;
14485  __pyx_t_6.data = NULL;
14486 
14487  /* "mprans/MeshSmoothing.pyx":978
14488  * [0., sqrt(3)/2.]])
14489  * cdef double[:,:] A = np.zeros((2,2))
14490  * cdef double[:,:] AW = np.zeros((2,2)) # <<<<<<<<<<<<<<
14491  * cdef int[:] nElementsArray = np.zeros(nElements)
14492  * cdef double[:] IMR_elements
14493  */
14494  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L1_error)
14495  __Pyx_GOTREF(__pyx_t_4);
14496  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 978, __pyx_L1_error)
14497  __Pyx_GOTREF(__pyx_t_3);
14498  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14499  __pyx_t_4 = NULL;
14500  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14501  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
14502  if (likely(__pyx_t_4)) {
14503  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14504  __Pyx_INCREF(__pyx_t_4);
14505  __Pyx_INCREF(function);
14506  __Pyx_DECREF_SET(__pyx_t_3, function);
14507  }
14508  }
14509  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__6);
14510  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
14511  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 978, __pyx_L1_error)
14512  __Pyx_GOTREF(__pyx_t_1);
14513  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14514  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 978, __pyx_L1_error)
14515  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14516  __pyx_v_AW = __pyx_t_6;
14517  __pyx_t_6.memview = NULL;
14518  __pyx_t_6.data = NULL;
14519 
14520  /* "mprans/MeshSmoothing.pyx":979
14521  * cdef double[:,:] A = np.zeros((2,2))
14522  * cdef double[:,:] AW = np.zeros((2,2))
14523  * cdef int[:] nElementsArray = np.zeros(nElements) # <<<<<<<<<<<<<<
14524  * cdef double[:] IMR_elements
14525  * if el_average:
14526  */
14527  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
14528  __Pyx_GOTREF(__pyx_t_3);
14529  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L1_error)
14530  __Pyx_GOTREF(__pyx_t_4);
14531  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14532  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nElements); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 979, __pyx_L1_error)
14533  __Pyx_GOTREF(__pyx_t_3);
14534  __pyx_t_5 = NULL;
14535  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14536  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
14537  if (likely(__pyx_t_5)) {
14538  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14539  __Pyx_INCREF(__pyx_t_5);
14540  __Pyx_INCREF(function);
14541  __Pyx_DECREF_SET(__pyx_t_4, function);
14542  }
14543  }
14544  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
14545  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14546  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14547  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L1_error)
14548  __Pyx_GOTREF(__pyx_t_1);
14549  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14550  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 979, __pyx_L1_error)
14551  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14552  __pyx_v_nElementsArray = __pyx_t_7;
14553  __pyx_t_7.memview = NULL;
14554  __pyx_t_7.data = NULL;
14555 
14556  /* "mprans/MeshSmoothing.pyx":981
14557  * cdef int[:] nElementsArray = np.zeros(nElements)
14558  * cdef double[:] IMR_elements
14559  * if el_average: # <<<<<<<<<<<<<<
14560  * IMR_elements = np.zeros(nNodes)
14561  * cdef int nNel = elementNodesArray.shape[1]
14562  */
14563  __pyx_t_8 = (__pyx_v_el_average != 0);
14564  if (__pyx_t_8) {
14565 
14566  /* "mprans/MeshSmoothing.pyx":982
14567  * cdef double[:] IMR_elements
14568  * if el_average:
14569  * IMR_elements = np.zeros(nNodes) # <<<<<<<<<<<<<<
14570  * cdef int nNel = elementNodesArray.shape[1]
14571  * cdef double[:] vec_a
14572  */
14573  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 982, __pyx_L1_error)
14574  __Pyx_GOTREF(__pyx_t_4);
14575  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 982, __pyx_L1_error)
14576  __Pyx_GOTREF(__pyx_t_3);
14577  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14578  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nNodes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 982, __pyx_L1_error)
14579  __Pyx_GOTREF(__pyx_t_4);
14580  __pyx_t_5 = NULL;
14581  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
14582  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
14583  if (likely(__pyx_t_5)) {
14584  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
14585  __Pyx_INCREF(__pyx_t_5);
14586  __Pyx_INCREF(function);
14587  __Pyx_DECREF_SET(__pyx_t_3, function);
14588  }
14589  }
14590  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
14591  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14592  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14593  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 982, __pyx_L1_error)
14594  __Pyx_GOTREF(__pyx_t_1);
14595  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14596  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 982, __pyx_L1_error)
14597  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14598  __pyx_v_IMR_elements = __pyx_t_9;
14599  __pyx_t_9.memview = NULL;
14600  __pyx_t_9.data = NULL;
14601 
14602  /* "mprans/MeshSmoothing.pyx":981
14603  * cdef int[:] nElementsArray = np.zeros(nElements)
14604  * cdef double[:] IMR_elements
14605  * if el_average: # <<<<<<<<<<<<<<
14606  * IMR_elements = np.zeros(nNodes)
14607  * cdef int nNel = elementNodesArray.shape[1]
14608  */
14609  }
14610 
14611  /* "mprans/MeshSmoothing.pyx":983
14612  * if el_average:
14613  * IMR_elements = np.zeros(nNodes)
14614  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
14615  * cdef double[:] vec_a
14616  * cdef double[:] vec_b
14617  */
14618  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
14619 
14620  /* "mprans/MeshSmoothing.pyx":988
14621  * cdef double[:] vec_c
14622  * cdef double IMR
14623  * cdef int nEl = 0 # <<<<<<<<<<<<<<
14624  * cdef int iN
14625  * cdef int eN
14626  */
14627  __pyx_v_nEl = 0;
14628 
14629  /* "mprans/MeshSmoothing.pyx":993
14630  * cdef int node
14631  * cdef int eOffset
14632  * for eN in range(nElements): # <<<<<<<<<<<<<<
14633  * for iN in range(nNel):
14634  * node = elementNodesArray[eN, iN]
14635  */
14636  __pyx_t_10 = __pyx_v_nElements;
14637  __pyx_t_11 = __pyx_t_10;
14638  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
14639  __pyx_v_eN = __pyx_t_12;
14640 
14641  /* "mprans/MeshSmoothing.pyx":994
14642  * cdef int eOffset
14643  * for eN in range(nElements):
14644  * for iN in range(nNel): # <<<<<<<<<<<<<<
14645  * node = elementNodesArray[eN, iN]
14646  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14647  */
14648  __pyx_t_13 = __pyx_v_nNel;
14649  __pyx_t_14 = __pyx_t_13;
14650  for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
14651  __pyx_v_iN = __pyx_t_15;
14652 
14653  /* "mprans/MeshSmoothing.pyx":995
14654  * for eN in range(nElements):
14655  * for iN in range(nNel):
14656  * node = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
14657  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14658  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14659  */
14660  __pyx_t_16 = __pyx_v_eN;
14661  __pyx_t_17 = __pyx_v_iN;
14662  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[0];
14663  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[1];
14664  __pyx_v_node = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_16 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementNodesArray.strides[1]) )));
14665 
14666  /* "mprans/MeshSmoothing.pyx":996
14667  * for iN in range(nNel):
14668  * node = elementNodesArray[eN, iN]
14669  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
14670  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14671  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14672  */
14673  __pyx_t_17 = __pyx_v_eN;
14674  __pyx_t_16 = __pyx_v_iN;
14675  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[0];
14676  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[1];
14677  __pyx_t_9.data = __pyx_v_nodeArray.data;
14678  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
14679  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
14680  {
14681  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_17 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementNodesArray.strides[1]) )));
14682  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
14683  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
14684  if (__pyx_tmp_idx < 0)
14685  __pyx_tmp_idx += __pyx_tmp_shape;
14686  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
14687 }
14688 
14689 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
14690 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
14691  __pyx_t_9.suboffsets[0] = -1;
14692 
14693 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
14694  __pyx_v_vec_a = __pyx_t_9;
14695  __pyx_t_9.memview = NULL;
14696  __pyx_t_9.data = NULL;
14697 
14698  /* "mprans/MeshSmoothing.pyx":997
14699  * node = elementNodesArray[eN, iN]
14700  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14701  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
14702  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14703  * A[0,0] = vec_b[0]-vec_a[0]
14704  */
14705  __pyx_t_16 = __pyx_v_eN;
14706  __pyx_t_17 = (__pyx_v_iN - 1);
14707  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[0];
14708  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[1];
14709  __pyx_t_9.data = __pyx_v_nodeArray.data;
14710  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
14711  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
14712  {
14713  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_16 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_17 * __pyx_v_elementNodesArray.strides[1]) )));
14714  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
14715  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
14716  if (__pyx_tmp_idx < 0)
14717  __pyx_tmp_idx += __pyx_tmp_shape;
14718  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
14719 }
14720 
14721 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
14722 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
14723  __pyx_t_9.suboffsets[0] = -1;
14724 
14725 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
14726  __pyx_v_vec_b = __pyx_t_9;
14727  __pyx_t_9.memview = NULL;
14728  __pyx_t_9.data = NULL;
14729 
14730  /* "mprans/MeshSmoothing.pyx":998
14731  * vec_a = nodeArray[elementNodesArray[eN, iN]]
14732  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14733  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
14734  * A[0,0] = vec_b[0]-vec_a[0]
14735  * A[1,0] = vec_b[1]-vec_a[1]
14736  */
14737  __pyx_t_17 = __pyx_v_eN;
14738  __pyx_t_16 = (__pyx_v_iN - 2);
14739  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_elementNodesArray.shape[0];
14740  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[1];
14741  __pyx_t_9.data = __pyx_v_nodeArray.data;
14742  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
14743  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
14744  {
14745  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_17 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementNodesArray.strides[1]) )));
14746  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
14747  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
14748  if (__pyx_tmp_idx < 0)
14749  __pyx_tmp_idx += __pyx_tmp_shape;
14750  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
14751 }
14752 
14753 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
14754 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
14755  __pyx_t_9.suboffsets[0] = -1;
14756 
14757 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
14758  __pyx_v_vec_c = __pyx_t_9;
14759  __pyx_t_9.memview = NULL;
14760  __pyx_t_9.data = NULL;
14761 
14762  /* "mprans/MeshSmoothing.pyx":999
14763  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
14764  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14765  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
14766  * A[1,0] = vec_b[1]-vec_a[1]
14767  * A[0,1] = vec_c[0]-vec_a[0]
14768  */
14769  __pyx_t_16 = 0;
14770  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_b.shape[0];
14771  __pyx_t_17 = 0;
14772  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vec_a.shape[0];
14773  __pyx_t_18 = 0;
14774  __pyx_t_19 = 0;
14775  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[0];
14776  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[1];
14777  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_18 * __pyx_v_A.strides[0]) ) + __pyx_t_19 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_16 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_17 * __pyx_v_vec_a.strides[0]) ))));
14778 
14779  /* "mprans/MeshSmoothing.pyx":1000
14780  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
14781  * A[0,0] = vec_b[0]-vec_a[0]
14782  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
14783  * A[0,1] = vec_c[0]-vec_a[0]
14784  * A[1,1] = vec_c[1]-vec_a[1]
14785  */
14786  __pyx_t_17 = 1;
14787  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vec_b.shape[0];
14788  __pyx_t_16 = 1;
14789  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_a.shape[0];
14790  __pyx_t_19 = 1;
14791  __pyx_t_18 = 0;
14792  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[0];
14793  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[1];
14794  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_19 * __pyx_v_A.strides[0]) ) + __pyx_t_18 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_17 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_16 * __pyx_v_vec_a.strides[0]) ))));
14795 
14796  /* "mprans/MeshSmoothing.pyx":1001
14797  * A[0,0] = vec_b[0]-vec_a[0]
14798  * A[1,0] = vec_b[1]-vec_a[1]
14799  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
14800  * A[1,1] = vec_c[1]-vec_a[1]
14801  * AW = np.dot(A, np.linalg.inv(W))
14802  */
14803  __pyx_t_16 = 0;
14804  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_c.shape[0];
14805  __pyx_t_17 = 0;
14806  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vec_a.shape[0];
14807  __pyx_t_18 = 0;
14808  __pyx_t_19 = 1;
14809  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[0];
14810  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[1];
14811  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_18 * __pyx_v_A.strides[0]) ) + __pyx_t_19 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_16 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_17 * __pyx_v_vec_a.strides[0]) ))));
14812 
14813  /* "mprans/MeshSmoothing.pyx":1002
14814  * A[1,0] = vec_b[1]-vec_a[1]
14815  * A[0,1] = vec_c[0]-vec_a[0]
14816  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
14817  * AW = np.dot(A, np.linalg.inv(W))
14818  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14819  */
14820  __pyx_t_17 = 1;
14821  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_vec_c.shape[0];
14822  __pyx_t_16 = 1;
14823  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_a.shape[0];
14824  __pyx_t_19 = 1;
14825  __pyx_t_18 = 1;
14826  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[0];
14827  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[1];
14828  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_19 * __pyx_v_A.strides[0]) ) + __pyx_t_18 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_17 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_16 * __pyx_v_vec_a.strides[0]) ))));
14829 
14830  /* "mprans/MeshSmoothing.pyx":1003
14831  * A[0,1] = vec_c[0]-vec_a[0]
14832  * A[1,1] = vec_c[1]-vec_a[1]
14833  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
14834  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14835  * IMRNodesArray_[node] += IMR
14836  */
14837  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
14838  __Pyx_GOTREF(__pyx_t_3);
14839  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1003, __pyx_L1_error)
14840  __Pyx_GOTREF(__pyx_t_4);
14841  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14842  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1003, __pyx_L1_error)
14843  __Pyx_GOTREF(__pyx_t_3);
14844  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
14845  __Pyx_GOTREF(__pyx_t_2);
14846  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1003, __pyx_L1_error)
14847  __Pyx_GOTREF(__pyx_t_20);
14848  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14849  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_inv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1003, __pyx_L1_error)
14850  __Pyx_GOTREF(__pyx_t_2);
14851  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14852  __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1003, __pyx_L1_error)
14853  __Pyx_GOTREF(__pyx_t_20);
14854  __pyx_t_21 = NULL;
14855  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
14856  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_2);
14857  if (likely(__pyx_t_21)) {
14858  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
14859  __Pyx_INCREF(__pyx_t_21);
14860  __Pyx_INCREF(function);
14861  __Pyx_DECREF_SET(__pyx_t_2, function);
14862  }
14863  }
14864  __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_21, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_20);
14865  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
14866  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14867  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1003, __pyx_L1_error)
14868  __Pyx_GOTREF(__pyx_t_5);
14869  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14870  __pyx_t_2 = NULL;
14871  __pyx_t_22 = 0;
14872  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
14873  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
14874  if (likely(__pyx_t_2)) {
14875  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
14876  __Pyx_INCREF(__pyx_t_2);
14877  __Pyx_INCREF(function);
14878  __Pyx_DECREF_SET(__pyx_t_4, function);
14879  __pyx_t_22 = 1;
14880  }
14881  }
14882  #if CYTHON_FAST_PYCALL
14883  if (PyFunction_Check(__pyx_t_4)) {
14884  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
14885  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
14886  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14887  __Pyx_GOTREF(__pyx_t_1);
14888  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14889  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14890  } else
14891  #endif
14892  #if CYTHON_FAST_PYCCALL
14893  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
14894  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
14895  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
14896  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14897  __Pyx_GOTREF(__pyx_t_1);
14898  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14899  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14900  } else
14901  #endif
14902  {
14903  __pyx_t_20 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1003, __pyx_L1_error)
14904  __Pyx_GOTREF(__pyx_t_20);
14905  if (__pyx_t_2) {
14906  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_2); __pyx_t_2 = NULL;
14907  }
14908  __Pyx_GIVEREF(__pyx_t_3);
14909  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, __pyx_t_3);
14910  __Pyx_GIVEREF(__pyx_t_5);
14911  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, __pyx_t_5);
14912  __pyx_t_3 = 0;
14913  __pyx_t_5 = 0;
14914  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1003, __pyx_L1_error)
14915  __Pyx_GOTREF(__pyx_t_1);
14916  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
14917  }
14918  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14919  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1003, __pyx_L1_error)
14920  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14921  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
14922  __pyx_v_AW = __pyx_t_6;
14923  __pyx_t_6.memview = NULL;
14924  __pyx_t_6.data = NULL;
14925 
14926  /* "mprans/MeshSmoothing.pyx":1004
14927  * A[1,1] = vec_c[1]-vec_a[1]
14928  * AW = np.dot(A, np.linalg.inv(W))
14929  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
14930  * IMRNodesArray_[node] += IMR
14931  * nElementsArray[node] += 1
14932  */
14933  __pyx_t_16 = 0;
14934  __pyx_t_17 = 0;
14935  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_AW.shape[0];
14936  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_AW.shape[1];
14937  __pyx_t_18 = 0;
14938  __pyx_t_19 = 1;
14939  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_AW.shape[0];
14940  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_AW.shape[1];
14941  __pyx_t_23 = 1;
14942  __pyx_t_24 = 0;
14943  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_AW.shape[0];
14944  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_AW.shape[1];
14945  __pyx_t_25 = 1;
14946  __pyx_t_26 = 1;
14947  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_AW.shape[0];
14948  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_AW.shape[1];
14949  __pyx_t_27 = 0;
14950  __pyx_t_28 = 0;
14951  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_AW.shape[0];
14952  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_AW.shape[1];
14953  __pyx_t_29 = 1;
14954  __pyx_t_30 = 1;
14955  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_AW.shape[0];
14956  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_AW.shape[1];
14957  __pyx_t_31 = 0;
14958  __pyx_t_32 = 1;
14959  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_AW.shape[0];
14960  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_AW.shape[1];
14961  __pyx_t_33 = 1;
14962  __pyx_t_34 = 0;
14963  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_AW.shape[0];
14964  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_AW.shape[1];
14965  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_16 * __pyx_v_AW.strides[0]) ) + __pyx_t_17 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_18 * __pyx_v_AW.strides[0]) ) + __pyx_t_19 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_23 * __pyx_v_AW.strides[0]) ) + __pyx_t_24 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_25 * __pyx_v_AW.strides[0]) ) + __pyx_t_26 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_27 * __pyx_v_AW.strides[0]) ) + __pyx_t_28 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_29 * __pyx_v_AW.strides[0]) ) + __pyx_t_30 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_31 * __pyx_v_AW.strides[0]) ) + __pyx_t_32 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_33 * __pyx_v_AW.strides[0]) ) + __pyx_t_34 * __pyx_v_AW.strides[1]) ))))))));
14966 
14967  /* "mprans/MeshSmoothing.pyx":1005
14968  * AW = np.dot(A, np.linalg.inv(W))
14969  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14970  * IMRNodesArray_[node] += IMR # <<<<<<<<<<<<<<
14971  * nElementsArray[node] += 1
14972  * if el_average:
14973  */
14974  __pyx_t_34 = __pyx_v_node;
14975  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMRNodesArray_.shape[0];
14976  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_34 * __pyx_v_IMRNodesArray_.strides[0]) )) += __pyx_v_IMR;
14977 
14978  /* "mprans/MeshSmoothing.pyx":1006
14979  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
14980  * IMRNodesArray_[node] += IMR
14981  * nElementsArray[node] += 1 # <<<<<<<<<<<<<<
14982  * if el_average:
14983  * IMR_elements[eN] += IMR
14984  */
14985  __pyx_t_34 = __pyx_v_node;
14986  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_nElementsArray.shape[0];
14987  *((int *) ( /* dim=0 */ (__pyx_v_nElementsArray.data + __pyx_t_34 * __pyx_v_nElementsArray.strides[0]) )) += 1;
14988 
14989  /* "mprans/MeshSmoothing.pyx":1007
14990  * IMRNodesArray_[node] += IMR
14991  * nElementsArray[node] += 1
14992  * if el_average: # <<<<<<<<<<<<<<
14993  * IMR_elements[eN] += IMR
14994  * if el_average:
14995  */
14996  __pyx_t_8 = (__pyx_v_el_average != 0);
14997  if (__pyx_t_8) {
14998 
14999  /* "mprans/MeshSmoothing.pyx":1008
15000  * nElementsArray[node] += 1
15001  * if el_average:
15002  * IMR_elements[eN] += IMR # <<<<<<<<<<<<<<
15003  * if el_average:
15004  * IMR_elements[eN] = IMR_elements[eN]/3.
15005  */
15006  __pyx_t_34 = __pyx_v_eN;
15007  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMR_elements.shape[0];
15008  *((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_34 * __pyx_v_IMR_elements.strides[0]) )) += __pyx_v_IMR;
15009 
15010  /* "mprans/MeshSmoothing.pyx":1007
15011  * IMRNodesArray_[node] += IMR
15012  * nElementsArray[node] += 1
15013  * if el_average: # <<<<<<<<<<<<<<
15014  * IMR_elements[eN] += IMR
15015  * if el_average:
15016  */
15017  }
15018  }
15019 
15020  /* "mprans/MeshSmoothing.pyx":1009
15021  * if el_average:
15022  * IMR_elements[eN] += IMR
15023  * if el_average: # <<<<<<<<<<<<<<
15024  * IMR_elements[eN] = IMR_elements[eN]/3.
15025  * for node in range(nNodes):
15026  */
15027  __pyx_t_8 = (__pyx_v_el_average != 0);
15028  if (__pyx_t_8) {
15029 
15030  /* "mprans/MeshSmoothing.pyx":1010
15031  * IMR_elements[eN] += IMR
15032  * if el_average:
15033  * IMR_elements[eN] = IMR_elements[eN]/3. # <<<<<<<<<<<<<<
15034  * for node in range(nNodes):
15035  * if not el_average:
15036  */
15037  __pyx_t_34 = __pyx_v_eN;
15038  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMR_elements.shape[0];
15039  __pyx_t_33 = __pyx_v_eN;
15040  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_IMR_elements.shape[0];
15041  *((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_33 * __pyx_v_IMR_elements.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_34 * __pyx_v_IMR_elements.strides[0]) ))) / 3.);
15042 
15043  /* "mprans/MeshSmoothing.pyx":1009
15044  * if el_average:
15045  * IMR_elements[eN] += IMR
15046  * if el_average: # <<<<<<<<<<<<<<
15047  * IMR_elements[eN] = IMR_elements[eN]/3.
15048  * for node in range(nNodes):
15049  */
15050  }
15051  }
15052 
15053  /* "mprans/MeshSmoothing.pyx":1011
15054  * if el_average:
15055  * IMR_elements[eN] = IMR_elements[eN]/3.
15056  * for node in range(nNodes): # <<<<<<<<<<<<<<
15057  * if not el_average:
15058  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
15059  */
15060  __pyx_t_10 = __pyx_v_nNodes;
15061  __pyx_t_11 = __pyx_t_10;
15062  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
15063  __pyx_v_node = __pyx_t_12;
15064 
15065  /* "mprans/MeshSmoothing.pyx":1012
15066  * IMR_elements[eN] = IMR_elements[eN]/3.
15067  * for node in range(nNodes):
15068  * if not el_average: # <<<<<<<<<<<<<<
15069  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
15070  * else:
15071  */
15072  __pyx_t_8 = ((!(__pyx_v_el_average != 0)) != 0);
15073  if (__pyx_t_8) {
15074 
15075  /* "mprans/MeshSmoothing.pyx":1013
15076  * for node in range(nNodes):
15077  * if not el_average:
15078  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node] # <<<<<<<<<<<<<<
15079  * else:
15080  * nEl = 0
15081  */
15082  __pyx_t_34 = __pyx_v_node;
15083  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMRNodesArray_.shape[0];
15084  __pyx_t_33 = __pyx_v_node;
15085  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_nElementsArray.shape[0];
15086  __pyx_t_32 = __pyx_v_node;
15087  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_IMRNodesArray_.shape[0];
15088  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_32 * __pyx_v_IMRNodesArray_.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_34 * __pyx_v_IMRNodesArray_.strides[0]) ))) / (*((int *) ( /* dim=0 */ (__pyx_v_nElementsArray.data + __pyx_t_33 * __pyx_v_nElementsArray.strides[0]) ))));
15089 
15090  /* "mprans/MeshSmoothing.pyx":1012
15091  * IMR_elements[eN] = IMR_elements[eN]/3.
15092  * for node in range(nNodes):
15093  * if not el_average: # <<<<<<<<<<<<<<
15094  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
15095  * else:
15096  */
15097  goto __pyx_L12;
15098  }
15099 
15100  /* "mprans/MeshSmoothing.pyx":1015
15101  * IMRNodesArray_[node] = IMRNodesArray_[node]/nElementsArray[node]
15102  * else:
15103  * nEl = 0 # <<<<<<<<<<<<<<
15104  * IMRNodesArray_[node] = 0.
15105  * for eOffset in range(nodeElementOffsets[node],
15106  */
15107  /*else*/ {
15108  __pyx_v_nEl = 0;
15109 
15110  /* "mprans/MeshSmoothing.pyx":1016
15111  * else:
15112  * nEl = 0
15113  * IMRNodesArray_[node] = 0. # <<<<<<<<<<<<<<
15114  * for eOffset in range(nodeElementOffsets[node],
15115  * nodeElementOffsets[node+1]):
15116  */
15117  __pyx_t_33 = __pyx_v_node;
15118  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_IMRNodesArray_.shape[0];
15119  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_33 * __pyx_v_IMRNodesArray_.strides[0]) )) = 0.;
15120 
15121  /* "mprans/MeshSmoothing.pyx":1018
15122  * IMRNodesArray_[node] = 0.
15123  * for eOffset in range(nodeElementOffsets[node],
15124  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
15125  * eN = nodeElementsArray[eOffset]
15126  * nEl += 1
15127  */
15128  __pyx_t_33 = (__pyx_v_node + 1);
15129  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_nodeElementOffsets.shape[0];
15130  __pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_33 * __pyx_v_nodeElementOffsets.strides[0]) )));
15131 
15132  /* "mprans/MeshSmoothing.pyx":1017
15133  * nEl = 0
15134  * IMRNodesArray_[node] = 0.
15135  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
15136  * nodeElementOffsets[node+1]):
15137  * eN = nodeElementsArray[eOffset]
15138  */
15139  __pyx_t_33 = __pyx_v_node;
15140  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_nodeElementOffsets.shape[0];
15141 
15142  /* "mprans/MeshSmoothing.pyx":1018
15143  * IMRNodesArray_[node] = 0.
15144  * for eOffset in range(nodeElementOffsets[node],
15145  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
15146  * eN = nodeElementsArray[eOffset]
15147  * nEl += 1
15148  */
15149  __pyx_t_14 = __pyx_t_13;
15150  for (__pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_33 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) {
15151 
15152  /* "mprans/MeshSmoothing.pyx":1017
15153  * nEl = 0
15154  * IMRNodesArray_[node] = 0.
15155  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
15156  * nodeElementOffsets[node+1]):
15157  * eN = nodeElementsArray[eOffset]
15158  */
15159  __pyx_v_eOffset = __pyx_t_15;
15160 
15161  /* "mprans/MeshSmoothing.pyx":1019
15162  * for eOffset in range(nodeElementOffsets[node],
15163  * nodeElementOffsets[node+1]):
15164  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
15165  * nEl += 1
15166  * IMRNodesArray_[node] += IMR_elements[eN]
15167  */
15168  __pyx_t_34 = __pyx_v_eOffset;
15169  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_nodeElementsArray.shape[0];
15170  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_34 * __pyx_v_nodeElementsArray.strides[0]) )));
15171 
15172  /* "mprans/MeshSmoothing.pyx":1020
15173  * nodeElementOffsets[node+1]):
15174  * eN = nodeElementsArray[eOffset]
15175  * nEl += 1 # <<<<<<<<<<<<<<
15176  * IMRNodesArray_[node] += IMR_elements[eN]
15177  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15178  */
15179  __pyx_v_nEl = (__pyx_v_nEl + 1);
15180 
15181  /* "mprans/MeshSmoothing.pyx":1021
15182  * eN = nodeElementsArray[eOffset]
15183  * nEl += 1
15184  * IMRNodesArray_[node] += IMR_elements[eN] # <<<<<<<<<<<<<<
15185  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15186  *
15187  */
15188  __pyx_t_34 = __pyx_v_eN;
15189  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMR_elements.shape[0];
15190  __pyx_t_32 = __pyx_v_node;
15191  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_IMRNodesArray_.shape[0];
15192  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_32 * __pyx_v_IMRNodesArray_.strides[0]) )) += (*((double *) ( /* dim=0 */ (__pyx_v_IMR_elements.data + __pyx_t_34 * __pyx_v_IMR_elements.strides[0]) )));
15193  }
15194 
15195  /* "mprans/MeshSmoothing.pyx":1022
15196  * nEl += 1
15197  * IMRNodesArray_[node] += IMR_elements[eN]
15198  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl # <<<<<<<<<<<<<<
15199  *
15200  * cdef void cyUpdateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_,
15201  */
15202  __pyx_t_33 = __pyx_v_node;
15203  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_IMRNodesArray_.shape[0];
15204  __pyx_t_34 = __pyx_v_node;
15205  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMRNodesArray_.shape[0];
15206  *((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_34 * __pyx_v_IMRNodesArray_.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMRNodesArray_.data + __pyx_t_33 * __pyx_v_IMRNodesArray_.strides[0]) ))) / __pyx_v_nEl);
15207  }
15208  __pyx_L12:;
15209  }
15210 
15211  /* "mprans/MeshSmoothing.pyx":967
15212  * elementDistortionArray_[eN] = (1./nd*trJTJ)**(nd/2.)/detJ
15213  *
15214  * cdef void cyUpdateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
15215  * double[:,:] nodeArray,
15216  * int[:,:] elementNodesArray,
15217  */
15218 
15219  /* function exit code */
15220  goto __pyx_L0;
15221  __pyx_L1_error:;
15222  __Pyx_XDECREF(__pyx_t_1);
15223  __Pyx_XDECREF(__pyx_t_2);
15224  __Pyx_XDECREF(__pyx_t_3);
15225  __Pyx_XDECREF(__pyx_t_4);
15226  __Pyx_XDECREF(__pyx_t_5);
15227  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
15228  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
15229  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
15230  __Pyx_XDECREF(__pyx_t_20);
15231  __Pyx_XDECREF(__pyx_t_21);
15232  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateInverseMeanRatioTriangleNodes", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
15233  __pyx_L0:;
15234  __PYX_XDEC_MEMVIEW(&__pyx_v_W, 1);
15235  __PYX_XDEC_MEMVIEW(&__pyx_v_A, 1);
15236  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
15237  __PYX_XDEC_MEMVIEW(&__pyx_v_nElementsArray, 1);
15238  __PYX_XDEC_MEMVIEW(&__pyx_v_IMR_elements, 1);
15239  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
15240  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
15241  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
15242  __Pyx_RefNannyFinishContext();
15243 }
15244 
15245 /* "mprans/MeshSmoothing.pyx":1024
15246  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15247  *
15248  * cdef void cyUpdateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
15249  * double[:,:] nodeArray,
15250  * int[:,:] elementNodesArray,
15251  */
15252 
15253 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements(__Pyx_memviewslice __pyx_v_IMRElementsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, int __pyx_v_nElements) {
15254  __Pyx_memviewslice __pyx_v_W = { 0, 0, { 0 }, { 0 }, { 0 } };
15255  __Pyx_memviewslice __pyx_v_A = { 0, 0, { 0 }, { 0 }, { 0 } };
15256  __Pyx_memviewslice __pyx_v_AW = { 0, 0, { 0 }, { 0 }, { 0 } };
15257  __Pyx_memviewslice __pyx_v_vec_a = { 0, 0, { 0 }, { 0 }, { 0 } };
15258  __Pyx_memviewslice __pyx_v_vec_b = { 0, 0, { 0 }, { 0 }, { 0 } };
15259  __Pyx_memviewslice __pyx_v_vec_c = { 0, 0, { 0 }, { 0 }, { 0 } };
15260  double __pyx_v_IMR;
15261  CYTHON_UNUSED int __pyx_v_nEl;
15262  int __pyx_v_eN;
15263  int __pyx_v_iN;
15264  CYTHON_UNUSED int __pyx_v_node;
15265  __Pyx_RefNannyDeclarations
15266  PyObject *__pyx_t_1 = NULL;
15267  PyObject *__pyx_t_2 = NULL;
15268  PyObject *__pyx_t_3 = NULL;
15269  PyObject *__pyx_t_4 = NULL;
15270  PyObject *__pyx_t_5 = NULL;
15271  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
15272  int __pyx_t_7;
15273  int __pyx_t_8;
15274  int __pyx_t_9;
15275  int __pyx_t_10;
15276  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
15277  Py_ssize_t __pyx_t_12;
15278  PyObject *(*__pyx_t_13)(PyObject *);
15279  int __pyx_t_14;
15280  Py_ssize_t __pyx_t_15;
15281  Py_ssize_t __pyx_t_16;
15282  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
15283  Py_ssize_t __pyx_t_18;
15284  Py_ssize_t __pyx_t_19;
15285  PyObject *__pyx_t_20 = NULL;
15286  PyObject *__pyx_t_21 = NULL;
15287  PyObject *__pyx_t_22 = NULL;
15288  Py_ssize_t __pyx_t_23;
15289  Py_ssize_t __pyx_t_24;
15290  Py_ssize_t __pyx_t_25;
15291  Py_ssize_t __pyx_t_26;
15292  Py_ssize_t __pyx_t_27;
15293  Py_ssize_t __pyx_t_28;
15294  Py_ssize_t __pyx_t_29;
15295  Py_ssize_t __pyx_t_30;
15296  Py_ssize_t __pyx_t_31;
15297  Py_ssize_t __pyx_t_32;
15298  Py_ssize_t __pyx_t_33;
15299  Py_ssize_t __pyx_t_34;
15300  int __pyx_lineno = 0;
15301  const char *__pyx_filename = NULL;
15302  int __pyx_clineno = 0;
15303  __Pyx_RefNannySetupContext("cyUpdateInverseMeanRatioTriangleElements", 0);
15304 
15305  /* "mprans/MeshSmoothing.pyx":1028
15306  * int[:,:] elementNodesArray,
15307  * int nElements):
15308  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
15309  * [0., sqrt(3)/2.]])
15310  * cdef double[:,:] A = np.zeros((2,2))
15311  */
15312  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error)
15313  __Pyx_GOTREF(__pyx_t_2);
15314  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1028, __pyx_L1_error)
15315  __Pyx_GOTREF(__pyx_t_3);
15316  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15317  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1028, __pyx_L1_error)
15318  __Pyx_GOTREF(__pyx_t_2);
15319  __Pyx_INCREF(__pyx_float_1_);
15320  __Pyx_GIVEREF(__pyx_float_1_);
15321  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_1_);
15322  __Pyx_INCREF(__pyx_float_0_5);
15323  __Pyx_GIVEREF(__pyx_float_0_5);
15324  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_0_5);
15325 
15326  /* "mprans/MeshSmoothing.pyx":1029
15327  * int nElements):
15328  * cdef double[:,:] W = np.array([[1., 0.5],
15329  * [0., sqrt(3)/2.]]) # <<<<<<<<<<<<<<
15330  * cdef double[:,:] A = np.zeros((2,2))
15331  * cdef double[:,:] AW = np.zeros((2,2))
15332  */
15333  __pyx_t_4 = PyFloat_FromDouble((sqrt(3.0) / 2.)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1029, __pyx_L1_error)
15334  __Pyx_GOTREF(__pyx_t_4);
15335  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1029, __pyx_L1_error)
15336  __Pyx_GOTREF(__pyx_t_5);
15337  __Pyx_INCREF(__pyx_float_0_);
15338  __Pyx_GIVEREF(__pyx_float_0_);
15339  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_float_0_);
15340  __Pyx_GIVEREF(__pyx_t_4);
15341  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
15342  __pyx_t_4 = 0;
15343 
15344  /* "mprans/MeshSmoothing.pyx":1028
15345  * int[:,:] elementNodesArray,
15346  * int nElements):
15347  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
15348  * [0., sqrt(3)/2.]])
15349  * cdef double[:,:] A = np.zeros((2,2))
15350  */
15351  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1028, __pyx_L1_error)
15352  __Pyx_GOTREF(__pyx_t_4);
15353  __Pyx_GIVEREF(__pyx_t_2);
15354  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
15355  __Pyx_GIVEREF(__pyx_t_5);
15356  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
15357  __pyx_t_2 = 0;
15358  __pyx_t_5 = 0;
15359  __pyx_t_5 = NULL;
15360  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15361  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
15362  if (likely(__pyx_t_5)) {
15363  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15364  __Pyx_INCREF(__pyx_t_5);
15365  __Pyx_INCREF(function);
15366  __Pyx_DECREF_SET(__pyx_t_3, function);
15367  }
15368  }
15369  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
15370  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
15371  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15372  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1028, __pyx_L1_error)
15373  __Pyx_GOTREF(__pyx_t_1);
15374  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15375  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1028, __pyx_L1_error)
15376  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15377  __pyx_v_W = __pyx_t_6;
15378  __pyx_t_6.memview = NULL;
15379  __pyx_t_6.data = NULL;
15380 
15381  /* "mprans/MeshSmoothing.pyx":1030
15382  * cdef double[:,:] W = np.array([[1., 0.5],
15383  * [0., sqrt(3)/2.]])
15384  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
15385  * cdef double[:,:] AW = np.zeros((2,2))
15386  * cdef double[:] vec_a
15387  */
15388  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1030, __pyx_L1_error)
15389  __Pyx_GOTREF(__pyx_t_3);
15390  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1030, __pyx_L1_error)
15391  __Pyx_GOTREF(__pyx_t_4);
15392  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15393  __pyx_t_3 = NULL;
15394  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
15395  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
15396  if (likely(__pyx_t_3)) {
15397  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
15398  __Pyx_INCREF(__pyx_t_3);
15399  __Pyx_INCREF(function);
15400  __Pyx_DECREF_SET(__pyx_t_4, function);
15401  }
15402  }
15403  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_tuple__6);
15404  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
15405  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1030, __pyx_L1_error)
15406  __Pyx_GOTREF(__pyx_t_1);
15407  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15408  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1030, __pyx_L1_error)
15409  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15410  __pyx_v_A = __pyx_t_6;
15411  __pyx_t_6.memview = NULL;
15412  __pyx_t_6.data = NULL;
15413 
15414  /* "mprans/MeshSmoothing.pyx":1031
15415  * [0., sqrt(3)/2.]])
15416  * cdef double[:,:] A = np.zeros((2,2))
15417  * cdef double[:,:] AW = np.zeros((2,2)) # <<<<<<<<<<<<<<
15418  * cdef double[:] vec_a
15419  * cdef double[:] vec_b
15420  */
15421  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
15422  __Pyx_GOTREF(__pyx_t_4);
15423  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1031, __pyx_L1_error)
15424  __Pyx_GOTREF(__pyx_t_3);
15425  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15426  __pyx_t_4 = NULL;
15427  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
15428  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
15429  if (likely(__pyx_t_4)) {
15430  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
15431  __Pyx_INCREF(__pyx_t_4);
15432  __Pyx_INCREF(function);
15433  __Pyx_DECREF_SET(__pyx_t_3, function);
15434  }
15435  }
15436  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__6);
15437  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15438  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1031, __pyx_L1_error)
15439  __Pyx_GOTREF(__pyx_t_1);
15440  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15441  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1031, __pyx_L1_error)
15442  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15443  __pyx_v_AW = __pyx_t_6;
15444  __pyx_t_6.memview = NULL;
15445  __pyx_t_6.data = NULL;
15446 
15447  /* "mprans/MeshSmoothing.pyx":1036
15448  * cdef double[:] vec_c
15449  * cdef double IMR
15450  * cdef int nEl = 0 # <<<<<<<<<<<<<<
15451  * cdef int eN
15452  * cdef int iN
15453  */
15454  __pyx_v_nEl = 0;
15455 
15456  /* "mprans/MeshSmoothing.pyx":1040
15457  * cdef int iN
15458  * cdef int node
15459  * for eN in range(nElements): # <<<<<<<<<<<<<<
15460  * for iN, node in enumerate(elementNodesArray[eN]):
15461  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15462  */
15463  __pyx_t_7 = __pyx_v_nElements;
15464  __pyx_t_8 = __pyx_t_7;
15465  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
15466  __pyx_v_eN = __pyx_t_9;
15467 
15468  /* "mprans/MeshSmoothing.pyx":1041
15469  * cdef int node
15470  * for eN in range(nElements):
15471  * for iN, node in enumerate(elementNodesArray[eN]): # <<<<<<<<<<<<<<
15472  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15473  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15474  */
15475  __pyx_t_10 = 0;
15476  __pyx_t_11.data = __pyx_v_elementNodesArray.data;
15477  __pyx_t_11.memview = __pyx_v_elementNodesArray.memview;
15478  __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
15479  {
15480  Py_ssize_t __pyx_tmp_idx = __pyx_v_eN;
15481  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementNodesArray.shape[0];
15482  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementNodesArray.strides[0];
15483  if (__pyx_tmp_idx < 0)
15484  __pyx_tmp_idx += __pyx_tmp_shape;
15485  __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
15486 }
15487 
15488 __pyx_t_11.shape[0] = __pyx_v_elementNodesArray.shape[1];
15489 __pyx_t_11.strides[0] = __pyx_v_elementNodesArray.strides[1];
15490  __pyx_t_11.suboffsets[0] = -1;
15491 
15492 __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_int, (int (*)(char *, PyObject *)) __pyx_memview_set_int, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
15493  __Pyx_GOTREF(__pyx_t_1);
15494  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
15495  __pyx_t_11.memview = NULL;
15496  __pyx_t_11.data = NULL;
15497  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
15498  __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_12 = 0;
15499  __pyx_t_13 = NULL;
15500  } else {
15501  __pyx_t_12 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1041, __pyx_L1_error)
15502  __Pyx_GOTREF(__pyx_t_3);
15503  __pyx_t_13 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1041, __pyx_L1_error)
15504  }
15505  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15506  for (;;) {
15507  if (likely(!__pyx_t_13)) {
15508  if (likely(PyList_CheckExact(__pyx_t_3))) {
15509  if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
15510  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15511  __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
15512  #else
15513  __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
15514  __Pyx_GOTREF(__pyx_t_1);
15515  #endif
15516  } else {
15517  if (__pyx_t_12 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
15518  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15519  __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_1); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
15520  #else
15521  __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1041, __pyx_L1_error)
15522  __Pyx_GOTREF(__pyx_t_1);
15523  #endif
15524  }
15525  } else {
15526  __pyx_t_1 = __pyx_t_13(__pyx_t_3);
15527  if (unlikely(!__pyx_t_1)) {
15528  PyObject* exc_type = PyErr_Occurred();
15529  if (exc_type) {
15530  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15531  else __PYX_ERR(0, 1041, __pyx_L1_error)
15532  }
15533  break;
15534  }
15535  __Pyx_GOTREF(__pyx_t_1);
15536  }
15537  __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1041, __pyx_L1_error)
15538  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15539  __pyx_v_node = __pyx_t_14;
15540  __pyx_v_iN = __pyx_t_10;
15541  __pyx_t_10 = (__pyx_t_10 + 1);
15542 
15543  /* "mprans/MeshSmoothing.pyx":1042
15544  * for eN in range(nElements):
15545  * for iN, node in enumerate(elementNodesArray[eN]):
15546  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
15547  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15548  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15549  */
15550  __pyx_t_15 = __pyx_v_eN;
15551  __pyx_t_16 = __pyx_v_iN;
15552  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[0];
15553  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[1];
15554  __pyx_t_17.data = __pyx_v_nodeArray.data;
15555  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
15556  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
15557  {
15558  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_15 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementNodesArray.strides[1]) )));
15559  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
15560  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
15561  if (__pyx_tmp_idx < 0)
15562  __pyx_tmp_idx += __pyx_tmp_shape;
15563  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
15564 }
15565 
15566 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
15567 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
15568  __pyx_t_17.suboffsets[0] = -1;
15569 
15570 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
15571  __pyx_v_vec_a = __pyx_t_17;
15572  __pyx_t_17.memview = NULL;
15573  __pyx_t_17.data = NULL;
15574 
15575  /* "mprans/MeshSmoothing.pyx":1043
15576  * for iN, node in enumerate(elementNodesArray[eN]):
15577  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15578  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
15579  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15580  * A[0,0] = vec_b[0]-vec_a[0]
15581  */
15582  __pyx_t_16 = __pyx_v_eN;
15583  __pyx_t_15 = (__pyx_v_iN - 1);
15584  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[0];
15585  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[1];
15586  __pyx_t_17.data = __pyx_v_nodeArray.data;
15587  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
15588  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
15589  {
15590  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_16 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_15 * __pyx_v_elementNodesArray.strides[1]) )));
15591  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
15592  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
15593  if (__pyx_tmp_idx < 0)
15594  __pyx_tmp_idx += __pyx_tmp_shape;
15595  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
15596 }
15597 
15598 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
15599 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
15600  __pyx_t_17.suboffsets[0] = -1;
15601 
15602 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
15603  __pyx_v_vec_b = __pyx_t_17;
15604  __pyx_t_17.memview = NULL;
15605  __pyx_t_17.data = NULL;
15606 
15607  /* "mprans/MeshSmoothing.pyx":1044
15608  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15609  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15610  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
15611  * A[0,0] = vec_b[0]-vec_a[0]
15612  * A[1,0] = vec_b[1]-vec_a[1]
15613  */
15614  __pyx_t_15 = __pyx_v_eN;
15615  __pyx_t_16 = (__pyx_v_iN - 2);
15616  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[0];
15617  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_elementNodesArray.shape[1];
15618  __pyx_t_17.data = __pyx_v_nodeArray.data;
15619  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
15620  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
15621  {
15622  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_15 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_16 * __pyx_v_elementNodesArray.strides[1]) )));
15623  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
15624  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
15625  if (__pyx_tmp_idx < 0)
15626  __pyx_tmp_idx += __pyx_tmp_shape;
15627  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
15628 }
15629 
15630 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
15631 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
15632  __pyx_t_17.suboffsets[0] = -1;
15633 
15634 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
15635  __pyx_v_vec_c = __pyx_t_17;
15636  __pyx_t_17.memview = NULL;
15637  __pyx_t_17.data = NULL;
15638 
15639  /* "mprans/MeshSmoothing.pyx":1045
15640  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15641  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15642  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
15643  * A[1,0] = vec_b[1]-vec_a[1]
15644  * A[0,1] = vec_c[0]-vec_a[0]
15645  */
15646  __pyx_t_16 = 0;
15647  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_b.shape[0];
15648  __pyx_t_15 = 0;
15649  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_a.shape[0];
15650  __pyx_t_18 = 0;
15651  __pyx_t_19 = 0;
15652  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[0];
15653  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[1];
15654  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_18 * __pyx_v_A.strides[0]) ) + __pyx_t_19 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_16 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_15 * __pyx_v_vec_a.strides[0]) ))));
15655 
15656  /* "mprans/MeshSmoothing.pyx":1046
15657  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
15658  * A[0,0] = vec_b[0]-vec_a[0]
15659  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
15660  * A[0,1] = vec_c[0]-vec_a[0]
15661  * A[1,1] = vec_c[1]-vec_a[1]
15662  */
15663  __pyx_t_15 = 1;
15664  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_b.shape[0];
15665  __pyx_t_16 = 1;
15666  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_a.shape[0];
15667  __pyx_t_19 = 1;
15668  __pyx_t_18 = 0;
15669  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[0];
15670  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[1];
15671  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_19 * __pyx_v_A.strides[0]) ) + __pyx_t_18 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_15 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_16 * __pyx_v_vec_a.strides[0]) ))));
15672 
15673  /* "mprans/MeshSmoothing.pyx":1047
15674  * A[0,0] = vec_b[0]-vec_a[0]
15675  * A[1,0] = vec_b[1]-vec_a[1]
15676  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
15677  * A[1,1] = vec_c[1]-vec_a[1]
15678  * AW = np.dot(A, np.linalg.inv(W))
15679  */
15680  __pyx_t_16 = 0;
15681  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_c.shape[0];
15682  __pyx_t_15 = 0;
15683  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_a.shape[0];
15684  __pyx_t_18 = 0;
15685  __pyx_t_19 = 1;
15686  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[0];
15687  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[1];
15688  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_18 * __pyx_v_A.strides[0]) ) + __pyx_t_19 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_16 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_15 * __pyx_v_vec_a.strides[0]) ))));
15689 
15690  /* "mprans/MeshSmoothing.pyx":1048
15691  * A[1,0] = vec_b[1]-vec_a[1]
15692  * A[0,1] = vec_c[0]-vec_a[0]
15693  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
15694  * AW = np.dot(A, np.linalg.inv(W))
15695  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15696  */
15697  __pyx_t_15 = 1;
15698  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_c.shape[0];
15699  __pyx_t_16 = 1;
15700  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_vec_a.shape[0];
15701  __pyx_t_19 = 1;
15702  __pyx_t_18 = 1;
15703  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[0];
15704  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[1];
15705  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_19 * __pyx_v_A.strides[0]) ) + __pyx_t_18 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_15 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_16 * __pyx_v_vec_a.strides[0]) ))));
15706 
15707  /* "mprans/MeshSmoothing.pyx":1049
15708  * A[0,1] = vec_c[0]-vec_a[0]
15709  * A[1,1] = vec_c[1]-vec_a[1]
15710  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
15711  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15712  * IMRElementsArray_[eN] += IMR
15713  */
15714  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
15715  __Pyx_GOTREF(__pyx_t_4);
15716  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error)
15717  __Pyx_GOTREF(__pyx_t_5);
15718  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15719  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
15720  __Pyx_GOTREF(__pyx_t_4);
15721  __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_np); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1049, __pyx_L1_error)
15722  __Pyx_GOTREF(__pyx_t_20);
15723  __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_linalg); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1049, __pyx_L1_error)
15724  __Pyx_GOTREF(__pyx_t_21);
15725  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
15726  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_inv); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1049, __pyx_L1_error)
15727  __Pyx_GOTREF(__pyx_t_20);
15728  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
15729  __pyx_t_21 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1049, __pyx_L1_error)
15730  __Pyx_GOTREF(__pyx_t_21);
15731  __pyx_t_22 = NULL;
15732  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
15733  __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_20);
15734  if (likely(__pyx_t_22)) {
15735  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
15736  __Pyx_INCREF(__pyx_t_22);
15737  __Pyx_INCREF(function);
15738  __Pyx_DECREF_SET(__pyx_t_20, function);
15739  }
15740  }
15741  __pyx_t_2 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_22, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_21);
15742  __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
15743  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
15744  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1049, __pyx_L1_error)
15745  __Pyx_GOTREF(__pyx_t_2);
15746  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
15747  __pyx_t_20 = NULL;
15748  __pyx_t_14 = 0;
15749  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
15750  __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_5);
15751  if (likely(__pyx_t_20)) {
15752  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
15753  __Pyx_INCREF(__pyx_t_20);
15754  __Pyx_INCREF(function);
15755  __Pyx_DECREF_SET(__pyx_t_5, function);
15756  __pyx_t_14 = 1;
15757  }
15758  }
15759  #if CYTHON_FAST_PYCALL
15760  if (PyFunction_Check(__pyx_t_5)) {
15761  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_4, __pyx_t_2};
15762  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
15763  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
15764  __Pyx_GOTREF(__pyx_t_1);
15765  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15766  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15767  } else
15768  #endif
15769  #if CYTHON_FAST_PYCCALL
15770  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
15771  PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_4, __pyx_t_2};
15772  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
15773  __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
15774  __Pyx_GOTREF(__pyx_t_1);
15775  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15776  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15777  } else
15778  #endif
15779  {
15780  __pyx_t_21 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1049, __pyx_L1_error)
15781  __Pyx_GOTREF(__pyx_t_21);
15782  if (__pyx_t_20) {
15783  __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_20); __pyx_t_20 = NULL;
15784  }
15785  __Pyx_GIVEREF(__pyx_t_4);
15786  PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_14, __pyx_t_4);
15787  __Pyx_GIVEREF(__pyx_t_2);
15788  PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_14, __pyx_t_2);
15789  __pyx_t_4 = 0;
15790  __pyx_t_2 = 0;
15791  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1049, __pyx_L1_error)
15792  __Pyx_GOTREF(__pyx_t_1);
15793  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
15794  }
15795  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15796  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1049, __pyx_L1_error)
15797  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15798  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
15799  __pyx_v_AW = __pyx_t_6;
15800  __pyx_t_6.memview = NULL;
15801  __pyx_t_6.data = NULL;
15802 
15803  /* "mprans/MeshSmoothing.pyx":1050
15804  * A[1,1] = vec_c[1]-vec_a[1]
15805  * AW = np.dot(A, np.linalg.inv(W))
15806  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
15807  * IMRElementsArray_[eN] += IMR
15808  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
15809  */
15810  __pyx_t_16 = 0;
15811  __pyx_t_15 = 0;
15812  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_AW.shape[0];
15813  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_AW.shape[1];
15814  __pyx_t_18 = 0;
15815  __pyx_t_19 = 1;
15816  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_AW.shape[0];
15817  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_AW.shape[1];
15818  __pyx_t_23 = 1;
15819  __pyx_t_24 = 0;
15820  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_AW.shape[0];
15821  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_AW.shape[1];
15822  __pyx_t_25 = 1;
15823  __pyx_t_26 = 1;
15824  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_AW.shape[0];
15825  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_AW.shape[1];
15826  __pyx_t_27 = 0;
15827  __pyx_t_28 = 0;
15828  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_AW.shape[0];
15829  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_AW.shape[1];
15830  __pyx_t_29 = 1;
15831  __pyx_t_30 = 1;
15832  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_AW.shape[0];
15833  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_AW.shape[1];
15834  __pyx_t_31 = 0;
15835  __pyx_t_32 = 1;
15836  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_AW.shape[0];
15837  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_AW.shape[1];
15838  __pyx_t_33 = 1;
15839  __pyx_t_34 = 0;
15840  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_AW.shape[0];
15841  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_AW.shape[1];
15842  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_16 * __pyx_v_AW.strides[0]) ) + __pyx_t_15 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_18 * __pyx_v_AW.strides[0]) ) + __pyx_t_19 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_23 * __pyx_v_AW.strides[0]) ) + __pyx_t_24 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_25 * __pyx_v_AW.strides[0]) ) + __pyx_t_26 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_27 * __pyx_v_AW.strides[0]) ) + __pyx_t_28 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_29 * __pyx_v_AW.strides[0]) ) + __pyx_t_30 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_31 * __pyx_v_AW.strides[0]) ) + __pyx_t_32 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_33 * __pyx_v_AW.strides[0]) ) + __pyx_t_34 * __pyx_v_AW.strides[1]) ))))))));
15843 
15844  /* "mprans/MeshSmoothing.pyx":1051
15845  * AW = np.dot(A, np.linalg.inv(W))
15846  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15847  * IMRElementsArray_[eN] += IMR # <<<<<<<<<<<<<<
15848  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
15849  *
15850  */
15851  __pyx_t_34 = __pyx_v_eN;
15852  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMRElementsArray_.shape[0];
15853  *((double *) ( /* dim=0 */ (__pyx_v_IMRElementsArray_.data + __pyx_t_34 * __pyx_v_IMRElementsArray_.strides[0]) )) += __pyx_v_IMR;
15854 
15855  /* "mprans/MeshSmoothing.pyx":1041
15856  * cdef int node
15857  * for eN in range(nElements):
15858  * for iN, node in enumerate(elementNodesArray[eN]): # <<<<<<<<<<<<<<
15859  * vec_a = nodeArray[elementNodesArray[eN, iN]]
15860  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
15861  */
15862  }
15863  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15864 
15865  /* "mprans/MeshSmoothing.pyx":1052
15866  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
15867  * IMRElementsArray_[eN] += IMR
15868  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3. # <<<<<<<<<<<<<<
15869  *
15870  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0,
15871  */
15872  __pyx_t_34 = __pyx_v_eN;
15873  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_IMRElementsArray_.shape[0];
15874  __pyx_t_33 = __pyx_v_eN;
15875  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_IMRElementsArray_.shape[0];
15876  *((double *) ( /* dim=0 */ (__pyx_v_IMRElementsArray_.data + __pyx_t_33 * __pyx_v_IMRElementsArray_.strides[0]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_IMRElementsArray_.data + __pyx_t_34 * __pyx_v_IMRElementsArray_.strides[0]) ))) / 3.);
15877  }
15878 
15879  /* "mprans/MeshSmoothing.pyx":1024
15880  * IMRNodesArray_[node] = IMRNodesArray_[node]/nEl
15881  *
15882  * cdef void cyUpdateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
15883  * double[:,:] nodeArray,
15884  * int[:,:] elementNodesArray,
15885  */
15886 
15887  /* function exit code */
15888  goto __pyx_L0;
15889  __pyx_L1_error:;
15890  __Pyx_XDECREF(__pyx_t_1);
15891  __Pyx_XDECREF(__pyx_t_2);
15892  __Pyx_XDECREF(__pyx_t_3);
15893  __Pyx_XDECREF(__pyx_t_4);
15894  __Pyx_XDECREF(__pyx_t_5);
15895  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
15896  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
15897  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
15898  __Pyx_XDECREF(__pyx_t_20);
15899  __Pyx_XDECREF(__pyx_t_21);
15900  __Pyx_XDECREF(__pyx_t_22);
15901  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyUpdateInverseMeanRatioTriangleElements", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
15902  __pyx_L0:;
15903  __PYX_XDEC_MEMVIEW(&__pyx_v_W, 1);
15904  __PYX_XDEC_MEMVIEW(&__pyx_v_A, 1);
15905  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
15906  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
15907  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
15908  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
15909  __Pyx_RefNannyFinishContext();
15910 }
15911 
15912 /* "mprans/MeshSmoothing.pyx":1054
15913  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
15914  *
15915  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
15916  * double[:,:] nodeArray,
15917  * int[:,:] elementNodesArray,
15918  */
15919 
15920 static double __pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle(int __pyx_v_node0, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle *__pyx_optional_args) {
15921 
15922  /* "mprans/MeshSmoothing.pyx":1059
15923  * int[:] nodeElementOffsets,
15924  * int[:] nodeElementsArray,
15925  * bool el_average=False): # <<<<<<<<<<<<<<
15926  * cdef double[:,:] W = np.array([[1., 0.5],
15927  * [0., sqrt(3)/2.]])
15928  */
15929  bool __pyx_v_el_average = ((bool)0);
15930  __Pyx_memviewslice __pyx_v_W = { 0, 0, { 0 }, { 0 }, { 0 } };
15931  __Pyx_memviewslice __pyx_v_A = { 0, 0, { 0 }, { 0 }, { 0 } };
15932  __Pyx_memviewslice __pyx_v_AW = { 0, 0, { 0 }, { 0 }, { 0 } };
15933  double __pyx_v_IMR_node;
15934  int __pyx_v_nEl;
15935  __Pyx_memviewslice __pyx_v_vec_a = { 0, 0, { 0 }, { 0 }, { 0 } };
15936  __Pyx_memviewslice __pyx_v_vec_b = { 0, 0, { 0 }, { 0 }, { 0 } };
15937  __Pyx_memviewslice __pyx_v_vec_c = { 0, 0, { 0 }, { 0 }, { 0 } };
15938  double __pyx_v_IMR;
15939  int __pyx_v_eOffset;
15940  int __pyx_v_iN;
15941  int __pyx_v_node;
15942  int __pyx_v_eN;
15943  int __pyx_v_nNel;
15944  double __pyx_r;
15945  __Pyx_RefNannyDeclarations
15946  PyObject *__pyx_t_1 = NULL;
15947  PyObject *__pyx_t_2 = NULL;
15948  PyObject *__pyx_t_3 = NULL;
15949  PyObject *__pyx_t_4 = NULL;
15950  PyObject *__pyx_t_5 = NULL;
15951  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
15952  Py_ssize_t __pyx_t_7;
15953  int __pyx_t_8;
15954  int __pyx_t_9;
15955  int __pyx_t_10;
15956  Py_ssize_t __pyx_t_11;
15957  int __pyx_t_12;
15958  int __pyx_t_13;
15959  int __pyx_t_14;
15960  Py_ssize_t __pyx_t_15;
15961  int __pyx_t_16;
15962  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
15963  Py_ssize_t __pyx_t_18;
15964  Py_ssize_t __pyx_t_19;
15965  PyObject *__pyx_t_20 = NULL;
15966  PyObject *__pyx_t_21 = NULL;
15967  int __pyx_t_22;
15968  Py_ssize_t __pyx_t_23;
15969  Py_ssize_t __pyx_t_24;
15970  Py_ssize_t __pyx_t_25;
15971  Py_ssize_t __pyx_t_26;
15972  Py_ssize_t __pyx_t_27;
15973  Py_ssize_t __pyx_t_28;
15974  Py_ssize_t __pyx_t_29;
15975  Py_ssize_t __pyx_t_30;
15976  Py_ssize_t __pyx_t_31;
15977  Py_ssize_t __pyx_t_32;
15978  Py_ssize_t __pyx_t_33;
15979  Py_ssize_t __pyx_t_34;
15980  int __pyx_lineno = 0;
15981  const char *__pyx_filename = NULL;
15982  int __pyx_clineno = 0;
15983  __Pyx_RefNannySetupContext("cyGetInverseMeanRatioSingleTriangle", 0);
15984  if (__pyx_optional_args) {
15985  if (__pyx_optional_args->__pyx_n > 0) {
15986  __pyx_v_el_average = __pyx_optional_args->el_average;
15987  }
15988  }
15989 
15990  /* "mprans/MeshSmoothing.pyx":1060
15991  * int[:] nodeElementsArray,
15992  * bool el_average=False):
15993  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
15994  * [0., sqrt(3)/2.]])
15995  * cdef double[:,:] A = np.zeros((2,2))
15996  */
15997  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
15998  __Pyx_GOTREF(__pyx_t_2);
15999  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1060, __pyx_L1_error)
16000  __Pyx_GOTREF(__pyx_t_3);
16001  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16002  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
16003  __Pyx_GOTREF(__pyx_t_2);
16004  __Pyx_INCREF(__pyx_float_1_);
16005  __Pyx_GIVEREF(__pyx_float_1_);
16006  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_float_1_);
16007  __Pyx_INCREF(__pyx_float_0_5);
16008  __Pyx_GIVEREF(__pyx_float_0_5);
16009  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_float_0_5);
16010 
16011  /* "mprans/MeshSmoothing.pyx":1061
16012  * bool el_average=False):
16013  * cdef double[:,:] W = np.array([[1., 0.5],
16014  * [0., sqrt(3)/2.]]) # <<<<<<<<<<<<<<
16015  * cdef double[:,:] A = np.zeros((2,2))
16016  * cdef double[:,:] AW = np.zeros((2,2))
16017  */
16018  __pyx_t_4 = PyFloat_FromDouble((sqrt(3.0) / 2.)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1061, __pyx_L1_error)
16019  __Pyx_GOTREF(__pyx_t_4);
16020  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1061, __pyx_L1_error)
16021  __Pyx_GOTREF(__pyx_t_5);
16022  __Pyx_INCREF(__pyx_float_0_);
16023  __Pyx_GIVEREF(__pyx_float_0_);
16024  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_float_0_);
16025  __Pyx_GIVEREF(__pyx_t_4);
16026  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
16027  __pyx_t_4 = 0;
16028 
16029  /* "mprans/MeshSmoothing.pyx":1060
16030  * int[:] nodeElementsArray,
16031  * bool el_average=False):
16032  * cdef double[:,:] W = np.array([[1., 0.5], # <<<<<<<<<<<<<<
16033  * [0., sqrt(3)/2.]])
16034  * cdef double[:,:] A = np.zeros((2,2))
16035  */
16036  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
16037  __Pyx_GOTREF(__pyx_t_4);
16038  __Pyx_GIVEREF(__pyx_t_2);
16039  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
16040  __Pyx_GIVEREF(__pyx_t_5);
16041  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
16042  __pyx_t_2 = 0;
16043  __pyx_t_5 = 0;
16044  __pyx_t_5 = NULL;
16045  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16046  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
16047  if (likely(__pyx_t_5)) {
16048  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16049  __Pyx_INCREF(__pyx_t_5);
16050  __Pyx_INCREF(function);
16051  __Pyx_DECREF_SET(__pyx_t_3, function);
16052  }
16053  }
16054  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
16055  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16056  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16057  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1060, __pyx_L1_error)
16058  __Pyx_GOTREF(__pyx_t_1);
16059  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16060  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1060, __pyx_L1_error)
16061  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16062  __pyx_v_W = __pyx_t_6;
16063  __pyx_t_6.memview = NULL;
16064  __pyx_t_6.data = NULL;
16065 
16066  /* "mprans/MeshSmoothing.pyx":1062
16067  * cdef double[:,:] W = np.array([[1., 0.5],
16068  * [0., sqrt(3)/2.]])
16069  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
16070  * cdef double[:,:] AW = np.zeros((2,2))
16071  * cdef double IMR_node = 0.
16072  */
16073  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1062, __pyx_L1_error)
16074  __Pyx_GOTREF(__pyx_t_3);
16075  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1062, __pyx_L1_error)
16076  __Pyx_GOTREF(__pyx_t_4);
16077  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16078  __pyx_t_3 = NULL;
16079  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16080  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
16081  if (likely(__pyx_t_3)) {
16082  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16083  __Pyx_INCREF(__pyx_t_3);
16084  __Pyx_INCREF(function);
16085  __Pyx_DECREF_SET(__pyx_t_4, function);
16086  }
16087  }
16088  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_3, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_tuple__6);
16089  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16090  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1062, __pyx_L1_error)
16091  __Pyx_GOTREF(__pyx_t_1);
16092  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16093  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1062, __pyx_L1_error)
16094  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16095  __pyx_v_A = __pyx_t_6;
16096  __pyx_t_6.memview = NULL;
16097  __pyx_t_6.data = NULL;
16098 
16099  /* "mprans/MeshSmoothing.pyx":1063
16100  * [0., sqrt(3)/2.]])
16101  * cdef double[:,:] A = np.zeros((2,2))
16102  * cdef double[:,:] AW = np.zeros((2,2)) # <<<<<<<<<<<<<<
16103  * cdef double IMR_node = 0.
16104  * cdef int nEl = 0
16105  */
16106  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
16107  __Pyx_GOTREF(__pyx_t_4);
16108  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1063, __pyx_L1_error)
16109  __Pyx_GOTREF(__pyx_t_3);
16110  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16111  __pyx_t_4 = NULL;
16112  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
16113  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
16114  if (likely(__pyx_t_4)) {
16115  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16116  __Pyx_INCREF(__pyx_t_4);
16117  __Pyx_INCREF(function);
16118  __Pyx_DECREF_SET(__pyx_t_3, function);
16119  }
16120  }
16121  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_tuple__6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_tuple__6);
16122  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
16123  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1063, __pyx_L1_error)
16124  __Pyx_GOTREF(__pyx_t_1);
16125  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16126  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1063, __pyx_L1_error)
16127  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16128  __pyx_v_AW = __pyx_t_6;
16129  __pyx_t_6.memview = NULL;
16130  __pyx_t_6.data = NULL;
16131 
16132  /* "mprans/MeshSmoothing.pyx":1064
16133  * cdef double[:,:] A = np.zeros((2,2))
16134  * cdef double[:,:] AW = np.zeros((2,2))
16135  * cdef double IMR_node = 0. # <<<<<<<<<<<<<<
16136  * cdef int nEl = 0
16137  * cdef double[:] vec_a
16138  */
16139  __pyx_v_IMR_node = 0.;
16140 
16141  /* "mprans/MeshSmoothing.pyx":1065
16142  * cdef double[:,:] AW = np.zeros((2,2))
16143  * cdef double IMR_node = 0.
16144  * cdef int nEl = 0 # <<<<<<<<<<<<<<
16145  * cdef double[:] vec_a
16146  * cdef double[:] vec_b
16147  */
16148  __pyx_v_nEl = 0;
16149 
16150  /* "mprans/MeshSmoothing.pyx":1074
16151  * cdef int node
16152  * cdef int eN
16153  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
16154  * for eOffset in range(nodeElementOffsets[node0],
16155  * nodeElementOffsets[node0+1]):
16156  */
16157  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
16158 
16159  /* "mprans/MeshSmoothing.pyx":1076
16160  * cdef int nNel = elementNodesArray.shape[1]
16161  * for eOffset in range(nodeElementOffsets[node0],
16162  * nodeElementOffsets[node0+1]): # <<<<<<<<<<<<<<
16163  * eN = nodeElementsArray[eOffset]
16164  * nEl += 1
16165  */
16166  __pyx_t_7 = (__pyx_v_node0 + 1);
16167  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
16168  __pyx_t_8 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) )));
16169 
16170  /* "mprans/MeshSmoothing.pyx":1075
16171  * cdef int eN
16172  * cdef int nNel = elementNodesArray.shape[1]
16173  * for eOffset in range(nodeElementOffsets[node0], # <<<<<<<<<<<<<<
16174  * nodeElementOffsets[node0+1]):
16175  * eN = nodeElementsArray[eOffset]
16176  */
16177  __pyx_t_7 = __pyx_v_node0;
16178  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nodeElementOffsets.shape[0];
16179 
16180  /* "mprans/MeshSmoothing.pyx":1076
16181  * cdef int nNel = elementNodesArray.shape[1]
16182  * for eOffset in range(nodeElementOffsets[node0],
16183  * nodeElementOffsets[node0+1]): # <<<<<<<<<<<<<<
16184  * eN = nodeElementsArray[eOffset]
16185  * nEl += 1
16186  */
16187  __pyx_t_9 = __pyx_t_8;
16188  for (__pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_7 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
16189 
16190  /* "mprans/MeshSmoothing.pyx":1075
16191  * cdef int eN
16192  * cdef int nNel = elementNodesArray.shape[1]
16193  * for eOffset in range(nodeElementOffsets[node0], # <<<<<<<<<<<<<<
16194  * nodeElementOffsets[node0+1]):
16195  * eN = nodeElementsArray[eOffset]
16196  */
16197  __pyx_v_eOffset = __pyx_t_10;
16198 
16199  /* "mprans/MeshSmoothing.pyx":1077
16200  * for eOffset in range(nodeElementOffsets[node0],
16201  * nodeElementOffsets[node0+1]):
16202  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
16203  * nEl += 1
16204  * ################
16205  */
16206  __pyx_t_11 = __pyx_v_eOffset;
16207  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nodeElementsArray.shape[0];
16208  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_11 * __pyx_v_nodeElementsArray.strides[0]) )));
16209 
16210  /* "mprans/MeshSmoothing.pyx":1078
16211  * nodeElementOffsets[node0+1]):
16212  * eN = nodeElementsArray[eOffset]
16213  * nEl += 1 # <<<<<<<<<<<<<<
16214  * ################
16215  * for iN in range(nNel):
16216  */
16217  __pyx_v_nEl = (__pyx_v_nEl + 1);
16218 
16219  /* "mprans/MeshSmoothing.pyx":1080
16220  * nEl += 1
16221  * ################
16222  * for iN in range(nNel): # <<<<<<<<<<<<<<
16223  * node = elementNodesArray[eN, iN]
16224  * if el_average:
16225  */
16226  __pyx_t_12 = __pyx_v_nNel;
16227  __pyx_t_13 = __pyx_t_12;
16228  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
16229  __pyx_v_iN = __pyx_t_14;
16230 
16231  /* "mprans/MeshSmoothing.pyx":1081
16232  * ################
16233  * for iN in range(nNel):
16234  * node = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
16235  * if el_average:
16236  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16237  */
16238  __pyx_t_11 = __pyx_v_eN;
16239  __pyx_t_15 = __pyx_v_iN;
16240  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[0];
16241  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[1];
16242  __pyx_v_node = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_11 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_15 * __pyx_v_elementNodesArray.strides[1]) )));
16243 
16244  /* "mprans/MeshSmoothing.pyx":1082
16245  * for iN in range(nNel):
16246  * node = elementNodesArray[eN, iN]
16247  * if el_average: # <<<<<<<<<<<<<<
16248  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16249  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16250  */
16251  __pyx_t_16 = (__pyx_v_el_average != 0);
16252  if (__pyx_t_16) {
16253 
16254  /* "mprans/MeshSmoothing.pyx":1083
16255  * node = elementNodesArray[eN, iN]
16256  * if el_average:
16257  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
16258  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16259  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16260  */
16261  __pyx_t_15 = __pyx_v_eN;
16262  __pyx_t_11 = __pyx_v_iN;
16263  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[0];
16264  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[1];
16265  __pyx_t_17.data = __pyx_v_nodeArray.data;
16266  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
16267  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
16268  {
16269  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_15 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementNodesArray.strides[1]) )));
16270  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16271  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16272  if (__pyx_tmp_idx < 0)
16273  __pyx_tmp_idx += __pyx_tmp_shape;
16274  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
16275 }
16276 
16277 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
16278 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
16279  __pyx_t_17.suboffsets[0] = -1;
16280 
16281 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
16282  __pyx_v_vec_a = __pyx_t_17;
16283  __pyx_t_17.memview = NULL;
16284  __pyx_t_17.data = NULL;
16285 
16286  /* "mprans/MeshSmoothing.pyx":1084
16287  * if el_average:
16288  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16289  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
16290  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16291  * A[0,0] = vec_b[0]-vec_a[0]
16292  */
16293  __pyx_t_11 = __pyx_v_eN;
16294  __pyx_t_15 = (__pyx_v_iN - 1);
16295  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[0];
16296  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[1];
16297  __pyx_t_17.data = __pyx_v_nodeArray.data;
16298  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
16299  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
16300  {
16301  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_11 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_15 * __pyx_v_elementNodesArray.strides[1]) )));
16302  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16303  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16304  if (__pyx_tmp_idx < 0)
16305  __pyx_tmp_idx += __pyx_tmp_shape;
16306  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
16307 }
16308 
16309 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
16310 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
16311  __pyx_t_17.suboffsets[0] = -1;
16312 
16313 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
16314  __pyx_v_vec_b = __pyx_t_17;
16315  __pyx_t_17.memview = NULL;
16316  __pyx_t_17.data = NULL;
16317 
16318  /* "mprans/MeshSmoothing.pyx":1085
16319  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16320  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16321  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
16322  * A[0,0] = vec_b[0]-vec_a[0]
16323  * A[1,0] = vec_b[1]-vec_a[1]
16324  */
16325  __pyx_t_15 = __pyx_v_eN;
16326  __pyx_t_11 = (__pyx_v_iN - 2);
16327  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_elementNodesArray.shape[0];
16328  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementNodesArray.shape[1];
16329  __pyx_t_17.data = __pyx_v_nodeArray.data;
16330  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
16331  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
16332  {
16333  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_15 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementNodesArray.strides[1]) )));
16334  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16335  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16336  if (__pyx_tmp_idx < 0)
16337  __pyx_tmp_idx += __pyx_tmp_shape;
16338  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
16339 }
16340 
16341 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
16342 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
16343  __pyx_t_17.suboffsets[0] = -1;
16344 
16345 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
16346  __pyx_v_vec_c = __pyx_t_17;
16347  __pyx_t_17.memview = NULL;
16348  __pyx_t_17.data = NULL;
16349 
16350  /* "mprans/MeshSmoothing.pyx":1086
16351  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16352  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16353  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
16354  * A[1,0] = vec_b[1]-vec_a[1]
16355  * A[0,1] = vec_c[0]-vec_a[0]
16356  */
16357  __pyx_t_11 = 0;
16358  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec_b.shape[0];
16359  __pyx_t_15 = 0;
16360  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_a.shape[0];
16361  __pyx_t_18 = 0;
16362  __pyx_t_19 = 0;
16363  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[0];
16364  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[1];
16365  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_18 * __pyx_v_A.strides[0]) ) + __pyx_t_19 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_11 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_15 * __pyx_v_vec_a.strides[0]) ))));
16366 
16367  /* "mprans/MeshSmoothing.pyx":1087
16368  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16369  * A[0,0] = vec_b[0]-vec_a[0]
16370  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
16371  * A[0,1] = vec_c[0]-vec_a[0]
16372  * A[1,1] = vec_c[1]-vec_a[1]
16373  */
16374  __pyx_t_15 = 1;
16375  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_b.shape[0];
16376  __pyx_t_11 = 1;
16377  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec_a.shape[0];
16378  __pyx_t_19 = 1;
16379  __pyx_t_18 = 0;
16380  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[0];
16381  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[1];
16382  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_19 * __pyx_v_A.strides[0]) ) + __pyx_t_18 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_15 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_11 * __pyx_v_vec_a.strides[0]) ))));
16383 
16384  /* "mprans/MeshSmoothing.pyx":1088
16385  * A[0,0] = vec_b[0]-vec_a[0]
16386  * A[1,0] = vec_b[1]-vec_a[1]
16387  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
16388  * A[1,1] = vec_c[1]-vec_a[1]
16389  * AW = np.dot(A, np.linalg.inv(W))
16390  */
16391  __pyx_t_11 = 0;
16392  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec_c.shape[0];
16393  __pyx_t_15 = 0;
16394  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_a.shape[0];
16395  __pyx_t_18 = 0;
16396  __pyx_t_19 = 1;
16397  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[0];
16398  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[1];
16399  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_18 * __pyx_v_A.strides[0]) ) + __pyx_t_19 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_11 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_15 * __pyx_v_vec_a.strides[0]) ))));
16400 
16401  /* "mprans/MeshSmoothing.pyx":1089
16402  * A[1,0] = vec_b[1]-vec_a[1]
16403  * A[0,1] = vec_c[0]-vec_a[0]
16404  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
16405  * AW = np.dot(A, np.linalg.inv(W))
16406  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16407  */
16408  __pyx_t_15 = 1;
16409  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vec_c.shape[0];
16410  __pyx_t_11 = 1;
16411  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_vec_a.shape[0];
16412  __pyx_t_19 = 1;
16413  __pyx_t_18 = 1;
16414  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_A.shape[0];
16415  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_A.shape[1];
16416  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_19 * __pyx_v_A.strides[0]) ) + __pyx_t_18 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_15 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_11 * __pyx_v_vec_a.strides[0]) ))));
16417 
16418  /* "mprans/MeshSmoothing.pyx":1090
16419  * A[0,1] = vec_c[0]-vec_a[0]
16420  * A[1,1] = vec_c[1]-vec_a[1]
16421  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
16422  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16423  * IMR_node += IMR/3. # /3. because 3 nodes in element
16424  */
16425  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error)
16426  __Pyx_GOTREF(__pyx_t_3);
16427  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
16428  __Pyx_GOTREF(__pyx_t_4);
16429  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16430  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1090, __pyx_L1_error)
16431  __Pyx_GOTREF(__pyx_t_3);
16432  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
16433  __Pyx_GOTREF(__pyx_t_2);
16434  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linalg); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1090, __pyx_L1_error)
16435  __Pyx_GOTREF(__pyx_t_20);
16436  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16437  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_inv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1090, __pyx_L1_error)
16438  __Pyx_GOTREF(__pyx_t_2);
16439  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
16440  __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1090, __pyx_L1_error)
16441  __Pyx_GOTREF(__pyx_t_20);
16442  __pyx_t_21 = NULL;
16443  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
16444  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_2);
16445  if (likely(__pyx_t_21)) {
16446  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
16447  __Pyx_INCREF(__pyx_t_21);
16448  __Pyx_INCREF(function);
16449  __Pyx_DECREF_SET(__pyx_t_2, function);
16450  }
16451  }
16452  __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_21, __pyx_t_20) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_20);
16453  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
16454  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
16455  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
16456  __Pyx_GOTREF(__pyx_t_5);
16457  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16458  __pyx_t_2 = NULL;
16459  __pyx_t_22 = 0;
16460  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
16461  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
16462  if (likely(__pyx_t_2)) {
16463  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16464  __Pyx_INCREF(__pyx_t_2);
16465  __Pyx_INCREF(function);
16466  __Pyx_DECREF_SET(__pyx_t_4, function);
16467  __pyx_t_22 = 1;
16468  }
16469  }
16470  #if CYTHON_FAST_PYCALL
16471  if (PyFunction_Check(__pyx_t_4)) {
16472  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
16473  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
16474  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16475  __Pyx_GOTREF(__pyx_t_1);
16476  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16477  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16478  } else
16479  #endif
16480  #if CYTHON_FAST_PYCCALL
16481  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
16482  PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_5};
16483  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
16484  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16485  __Pyx_GOTREF(__pyx_t_1);
16486  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16487  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16488  } else
16489  #endif
16490  {
16491  __pyx_t_20 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1090, __pyx_L1_error)
16492  __Pyx_GOTREF(__pyx_t_20);
16493  if (__pyx_t_2) {
16494  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_2); __pyx_t_2 = NULL;
16495  }
16496  __Pyx_GIVEREF(__pyx_t_3);
16497  PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_22, __pyx_t_3);
16498  __Pyx_GIVEREF(__pyx_t_5);
16499  PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_22, __pyx_t_5);
16500  __pyx_t_3 = 0;
16501  __pyx_t_5 = 0;
16502  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1090, __pyx_L1_error)
16503  __Pyx_GOTREF(__pyx_t_1);
16504  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
16505  }
16506  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16507  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1090, __pyx_L1_error)
16508  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16509  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
16510  __pyx_v_AW = __pyx_t_6;
16511  __pyx_t_6.memview = NULL;
16512  __pyx_t_6.data = NULL;
16513 
16514  /* "mprans/MeshSmoothing.pyx":1091
16515  * A[1,1] = vec_c[1]-vec_a[1]
16516  * AW = np.dot(A, np.linalg.inv(W))
16517  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
16518  * IMR_node += IMR/3. # /3. because 3 nodes in element
16519  * else:
16520  */
16521  __pyx_t_11 = 0;
16522  __pyx_t_15 = 0;
16523  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_AW.shape[0];
16524  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_AW.shape[1];
16525  __pyx_t_18 = 0;
16526  __pyx_t_19 = 1;
16527  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_AW.shape[0];
16528  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_AW.shape[1];
16529  __pyx_t_23 = 1;
16530  __pyx_t_24 = 0;
16531  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_AW.shape[0];
16532  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_AW.shape[1];
16533  __pyx_t_25 = 1;
16534  __pyx_t_26 = 1;
16535  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_AW.shape[0];
16536  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_AW.shape[1];
16537  __pyx_t_27 = 0;
16538  __pyx_t_28 = 0;
16539  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_AW.shape[0];
16540  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_AW.shape[1];
16541  __pyx_t_29 = 1;
16542  __pyx_t_30 = 1;
16543  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_AW.shape[0];
16544  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_AW.shape[1];
16545  __pyx_t_31 = 0;
16546  __pyx_t_32 = 1;
16547  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_AW.shape[0];
16548  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_AW.shape[1];
16549  __pyx_t_33 = 1;
16550  __pyx_t_34 = 0;
16551  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_AW.shape[0];
16552  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_AW.shape[1];
16553  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_11 * __pyx_v_AW.strides[0]) ) + __pyx_t_15 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_18 * __pyx_v_AW.strides[0]) ) + __pyx_t_19 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_23 * __pyx_v_AW.strides[0]) ) + __pyx_t_24 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_25 * __pyx_v_AW.strides[0]) ) + __pyx_t_26 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_27 * __pyx_v_AW.strides[0]) ) + __pyx_t_28 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_29 * __pyx_v_AW.strides[0]) ) + __pyx_t_30 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_31 * __pyx_v_AW.strides[0]) ) + __pyx_t_32 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_33 * __pyx_v_AW.strides[0]) ) + __pyx_t_34 * __pyx_v_AW.strides[1]) ))))))));
16554 
16555  /* "mprans/MeshSmoothing.pyx":1092
16556  * AW = np.dot(A, np.linalg.inv(W))
16557  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16558  * IMR_node += IMR/3. # /3. because 3 nodes in element # <<<<<<<<<<<<<<
16559  * else:
16560  * if node == node0:
16561  */
16562  __pyx_v_IMR_node = (__pyx_v_IMR_node + (__pyx_v_IMR / 3.));
16563 
16564  /* "mprans/MeshSmoothing.pyx":1082
16565  * for iN in range(nNel):
16566  * node = elementNodesArray[eN, iN]
16567  * if el_average: # <<<<<<<<<<<<<<
16568  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16569  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16570  */
16571  goto __pyx_L7;
16572  }
16573 
16574  /* "mprans/MeshSmoothing.pyx":1094
16575  * IMR_node += IMR/3. # /3. because 3 nodes in element
16576  * else:
16577  * if node == node0: # <<<<<<<<<<<<<<
16578  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16579  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16580  */
16581  /*else*/ {
16582  __pyx_t_16 = ((__pyx_v_node == __pyx_v_node0) != 0);
16583  if (__pyx_t_16) {
16584 
16585  /* "mprans/MeshSmoothing.pyx":1095
16586  * else:
16587  * if node == node0:
16588  * vec_a = nodeArray[elementNodesArray[eN, iN]] # <<<<<<<<<<<<<<
16589  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16590  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16591  */
16592  __pyx_t_34 = __pyx_v_eN;
16593  __pyx_t_33 = __pyx_v_iN;
16594  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_elementNodesArray.shape[0];
16595  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_elementNodesArray.shape[1];
16596  __pyx_t_17.data = __pyx_v_nodeArray.data;
16597  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
16598  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
16599  {
16600  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_34 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_33 * __pyx_v_elementNodesArray.strides[1]) )));
16601  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16602  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16603  if (__pyx_tmp_idx < 0)
16604  __pyx_tmp_idx += __pyx_tmp_shape;
16605  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
16606 }
16607 
16608 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
16609 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
16610  __pyx_t_17.suboffsets[0] = -1;
16611 
16612 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
16613  __pyx_v_vec_a = __pyx_t_17;
16614  __pyx_t_17.memview = NULL;
16615  __pyx_t_17.data = NULL;
16616 
16617  /* "mprans/MeshSmoothing.pyx":1096
16618  * if node == node0:
16619  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16620  * vec_b = nodeArray[elementNodesArray[eN, iN-1]] # <<<<<<<<<<<<<<
16621  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16622  * A[0,0] = vec_b[0]-vec_a[0]
16623  */
16624  __pyx_t_33 = __pyx_v_eN;
16625  __pyx_t_34 = (__pyx_v_iN - 1);
16626  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_elementNodesArray.shape[0];
16627  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_elementNodesArray.shape[1];
16628  __pyx_t_17.data = __pyx_v_nodeArray.data;
16629  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
16630  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
16631  {
16632  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_33 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_34 * __pyx_v_elementNodesArray.strides[1]) )));
16633  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16634  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16635  if (__pyx_tmp_idx < 0)
16636  __pyx_tmp_idx += __pyx_tmp_shape;
16637  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
16638 }
16639 
16640 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
16641 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
16642  __pyx_t_17.suboffsets[0] = -1;
16643 
16644 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
16645  __pyx_v_vec_b = __pyx_t_17;
16646  __pyx_t_17.memview = NULL;
16647  __pyx_t_17.data = NULL;
16648 
16649  /* "mprans/MeshSmoothing.pyx":1097
16650  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16651  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16652  * vec_c = nodeArray[elementNodesArray[eN, iN-2]] # <<<<<<<<<<<<<<
16653  * A[0,0] = vec_b[0]-vec_a[0]
16654  * A[1,0] = vec_b[1]-vec_a[1]
16655  */
16656  __pyx_t_34 = __pyx_v_eN;
16657  __pyx_t_33 = (__pyx_v_iN - 2);
16658  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_elementNodesArray.shape[0];
16659  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_elementNodesArray.shape[1];
16660  __pyx_t_17.data = __pyx_v_nodeArray.data;
16661  __pyx_t_17.memview = __pyx_v_nodeArray.memview;
16662  __PYX_INC_MEMVIEW(&__pyx_t_17, 0);
16663  {
16664  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_34 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_33 * __pyx_v_elementNodesArray.strides[1]) )));
16665  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
16666  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
16667  if (__pyx_tmp_idx < 0)
16668  __pyx_tmp_idx += __pyx_tmp_shape;
16669  __pyx_t_17.data += __pyx_tmp_idx * __pyx_tmp_stride;
16670 }
16671 
16672 __pyx_t_17.shape[0] = __pyx_v_nodeArray.shape[1];
16673 __pyx_t_17.strides[0] = __pyx_v_nodeArray.strides[1];
16674  __pyx_t_17.suboffsets[0] = -1;
16675 
16676 __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
16677  __pyx_v_vec_c = __pyx_t_17;
16678  __pyx_t_17.memview = NULL;
16679  __pyx_t_17.data = NULL;
16680 
16681  /* "mprans/MeshSmoothing.pyx":1098
16682  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16683  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16684  * A[0,0] = vec_b[0]-vec_a[0] # <<<<<<<<<<<<<<
16685  * A[1,0] = vec_b[1]-vec_a[1]
16686  * A[0,1] = vec_c[0]-vec_a[0]
16687  */
16688  __pyx_t_33 = 0;
16689  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_vec_b.shape[0];
16690  __pyx_t_34 = 0;
16691  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_vec_a.shape[0];
16692  __pyx_t_32 = 0;
16693  __pyx_t_31 = 0;
16694  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_A.shape[0];
16695  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_A.shape[1];
16696  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_32 * __pyx_v_A.strides[0]) ) + __pyx_t_31 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_33 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_34 * __pyx_v_vec_a.strides[0]) ))));
16697 
16698  /* "mprans/MeshSmoothing.pyx":1099
16699  * vec_c = nodeArray[elementNodesArray[eN, iN-2]]
16700  * A[0,0] = vec_b[0]-vec_a[0]
16701  * A[1,0] = vec_b[1]-vec_a[1] # <<<<<<<<<<<<<<
16702  * A[0,1] = vec_c[0]-vec_a[0]
16703  * A[1,1] = vec_c[1]-vec_a[1]
16704  */
16705  __pyx_t_34 = 1;
16706  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_vec_b.shape[0];
16707  __pyx_t_33 = 1;
16708  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_vec_a.shape[0];
16709  __pyx_t_31 = 1;
16710  __pyx_t_32 = 0;
16711  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_A.shape[0];
16712  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_A.shape[1];
16713  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_31 * __pyx_v_A.strides[0]) ) + __pyx_t_32 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_b.data + __pyx_t_34 * __pyx_v_vec_b.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_33 * __pyx_v_vec_a.strides[0]) ))));
16714 
16715  /* "mprans/MeshSmoothing.pyx":1100
16716  * A[0,0] = vec_b[0]-vec_a[0]
16717  * A[1,0] = vec_b[1]-vec_a[1]
16718  * A[0,1] = vec_c[0]-vec_a[0] # <<<<<<<<<<<<<<
16719  * A[1,1] = vec_c[1]-vec_a[1]
16720  * AW = np.dot(A, np.linalg.inv(W))
16721  */
16722  __pyx_t_33 = 0;
16723  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_vec_c.shape[0];
16724  __pyx_t_34 = 0;
16725  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_vec_a.shape[0];
16726  __pyx_t_32 = 0;
16727  __pyx_t_31 = 1;
16728  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_A.shape[0];
16729  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_A.shape[1];
16730  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_32 * __pyx_v_A.strides[0]) ) + __pyx_t_31 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_33 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_34 * __pyx_v_vec_a.strides[0]) ))));
16731 
16732  /* "mprans/MeshSmoothing.pyx":1101
16733  * A[1,0] = vec_b[1]-vec_a[1]
16734  * A[0,1] = vec_c[0]-vec_a[0]
16735  * A[1,1] = vec_c[1]-vec_a[1] # <<<<<<<<<<<<<<
16736  * AW = np.dot(A, np.linalg.inv(W))
16737  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16738  */
16739  __pyx_t_34 = 1;
16740  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_vec_c.shape[0];
16741  __pyx_t_33 = 1;
16742  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_vec_a.shape[0];
16743  __pyx_t_31 = 1;
16744  __pyx_t_32 = 1;
16745  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_A.shape[0];
16746  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_A.shape[1];
16747  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_A.data + __pyx_t_31 * __pyx_v_A.strides[0]) ) + __pyx_t_32 * __pyx_v_A.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vec_c.data + __pyx_t_34 * __pyx_v_vec_c.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_vec_a.data + __pyx_t_33 * __pyx_v_vec_a.strides[0]) ))));
16748 
16749  /* "mprans/MeshSmoothing.pyx":1102
16750  * A[0,1] = vec_c[0]-vec_a[0]
16751  * A[1,1] = vec_c[1]-vec_a[1]
16752  * AW = np.dot(A, np.linalg.inv(W)) # <<<<<<<<<<<<<<
16753  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16754  * IMR_node += IMR
16755  */
16756  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
16757  __Pyx_GOTREF(__pyx_t_4);
16758  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dot); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1102, __pyx_L1_error)
16759  __Pyx_GOTREF(__pyx_t_20);
16760  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16761  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_A, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error)
16762  __Pyx_GOTREF(__pyx_t_4);
16763  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
16764  __Pyx_GOTREF(__pyx_t_3);
16765  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_linalg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
16766  __Pyx_GOTREF(__pyx_t_2);
16767  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16768  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_inv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error)
16769  __Pyx_GOTREF(__pyx_t_3);
16770  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16771  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_W, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
16772  __Pyx_GOTREF(__pyx_t_2);
16773  __pyx_t_21 = NULL;
16774  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
16775  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_3);
16776  if (likely(__pyx_t_21)) {
16777  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
16778  __Pyx_INCREF(__pyx_t_21);
16779  __Pyx_INCREF(function);
16780  __Pyx_DECREF_SET(__pyx_t_3, function);
16781  }
16782  }
16783  __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_21, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
16784  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
16785  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16786  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error)
16787  __Pyx_GOTREF(__pyx_t_5);
16788  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16789  __pyx_t_3 = NULL;
16790  __pyx_t_22 = 0;
16791  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
16792  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_20);
16793  if (likely(__pyx_t_3)) {
16794  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
16795  __Pyx_INCREF(__pyx_t_3);
16796  __Pyx_INCREF(function);
16797  __Pyx_DECREF_SET(__pyx_t_20, function);
16798  __pyx_t_22 = 1;
16799  }
16800  }
16801  #if CYTHON_FAST_PYCALL
16802  if (PyFunction_Check(__pyx_t_20)) {
16803  PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
16804  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
16805  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16806  __Pyx_GOTREF(__pyx_t_1);
16807  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16808  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16809  } else
16810  #endif
16811  #if CYTHON_FAST_PYCCALL
16812  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
16813  PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_t_5};
16814  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_22, 2+__pyx_t_22); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
16815  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
16816  __Pyx_GOTREF(__pyx_t_1);
16817  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16818  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16819  } else
16820  #endif
16821  {
16822  __pyx_t_2 = PyTuple_New(2+__pyx_t_22); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1102, __pyx_L1_error)
16823  __Pyx_GOTREF(__pyx_t_2);
16824  if (__pyx_t_3) {
16825  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
16826  }
16827  __Pyx_GIVEREF(__pyx_t_4);
16828  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_22, __pyx_t_4);
16829  __Pyx_GIVEREF(__pyx_t_5);
16830  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_22, __pyx_t_5);
16831  __pyx_t_4 = 0;
16832  __pyx_t_5 = 0;
16833  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1102, __pyx_L1_error)
16834  __Pyx_GOTREF(__pyx_t_1);
16835  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16836  }
16837  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
16838  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1102, __pyx_L1_error)
16839  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16840  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
16841  __pyx_v_AW = __pyx_t_6;
16842  __pyx_t_6.memview = NULL;
16843  __pyx_t_6.data = NULL;
16844 
16845  /* "mprans/MeshSmoothing.pyx":1103
16846  * A[1,1] = vec_c[1]-vec_a[1]
16847  * AW = np.dot(A, np.linalg.inv(W))
16848  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0])) # <<<<<<<<<<<<<<
16849  * IMR_node += IMR
16850  * IMR_node = IMR_node/nEl
16851  */
16852  __pyx_t_33 = 0;
16853  __pyx_t_34 = 0;
16854  if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_v_AW.shape[0];
16855  if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_v_AW.shape[1];
16856  __pyx_t_32 = 0;
16857  __pyx_t_31 = 1;
16858  if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_v_AW.shape[0];
16859  if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_v_AW.shape[1];
16860  __pyx_t_30 = 1;
16861  __pyx_t_29 = 0;
16862  if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_v_AW.shape[0];
16863  if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_v_AW.shape[1];
16864  __pyx_t_28 = 1;
16865  __pyx_t_27 = 1;
16866  if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_v_AW.shape[0];
16867  if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_v_AW.shape[1];
16868  __pyx_t_26 = 0;
16869  __pyx_t_25 = 0;
16870  if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_v_AW.shape[0];
16871  if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_v_AW.shape[1];
16872  __pyx_t_24 = 1;
16873  __pyx_t_23 = 1;
16874  if (__pyx_t_24 < 0) __pyx_t_24 += __pyx_v_AW.shape[0];
16875  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_AW.shape[1];
16876  __pyx_t_19 = 0;
16877  __pyx_t_18 = 1;
16878  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_AW.shape[0];
16879  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_AW.shape[1];
16880  __pyx_t_15 = 1;
16881  __pyx_t_11 = 0;
16882  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_AW.shape[0];
16883  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_AW.shape[1];
16884  __pyx_v_IMR = ((((pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_33 * __pyx_v_AW.strides[0]) ) + __pyx_t_34 * __pyx_v_AW.strides[1]) ))), 2.0) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_32 * __pyx_v_AW.strides[0]) ) + __pyx_t_31 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_30 * __pyx_v_AW.strides[0]) ) + __pyx_t_29 * __pyx_v_AW.strides[1]) ))), 2.0)) + pow((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_28 * __pyx_v_AW.strides[0]) ) + __pyx_t_27 * __pyx_v_AW.strides[1]) ))), 2.0)) / (2.0 * fabs((((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_26 * __pyx_v_AW.strides[0]) ) + __pyx_t_25 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_24 * __pyx_v_AW.strides[0]) ) + __pyx_t_23 * __pyx_v_AW.strides[1]) )))) - ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_19 * __pyx_v_AW.strides[0]) ) + __pyx_t_18 * __pyx_v_AW.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_AW.data + __pyx_t_15 * __pyx_v_AW.strides[0]) ) + __pyx_t_11 * __pyx_v_AW.strides[1]) ))))))));
16885 
16886  /* "mprans/MeshSmoothing.pyx":1104
16887  * AW = np.dot(A, np.linalg.inv(W))
16888  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16889  * IMR_node += IMR # <<<<<<<<<<<<<<
16890  * IMR_node = IMR_node/nEl
16891  * return IMR_node
16892  */
16893  __pyx_v_IMR_node = (__pyx_v_IMR_node + __pyx_v_IMR);
16894 
16895  /* "mprans/MeshSmoothing.pyx":1094
16896  * IMR_node += IMR/3. # /3. because 3 nodes in element
16897  * else:
16898  * if node == node0: # <<<<<<<<<<<<<<
16899  * vec_a = nodeArray[elementNodesArray[eN, iN]]
16900  * vec_b = nodeArray[elementNodesArray[eN, iN-1]]
16901  */
16902  }
16903  }
16904  __pyx_L7:;
16905  }
16906  }
16907 
16908  /* "mprans/MeshSmoothing.pyx":1105
16909  * IMR = (AW[0,0]**2+AW[0,1]**2+AW[1,0]**2+AW[1,1]**2)/(2*abs(AW[0,0]*AW[1,1]-AW[0,1]*AW[1,0]))
16910  * IMR_node += IMR
16911  * IMR_node = IMR_node/nEl # <<<<<<<<<<<<<<
16912  * return IMR_node
16913  *
16914  */
16915  __pyx_v_IMR_node = (__pyx_v_IMR_node / __pyx_v_nEl);
16916 
16917  /* "mprans/MeshSmoothing.pyx":1106
16918  * IMR_node += IMR
16919  * IMR_node = IMR_node/nEl
16920  * return IMR_node # <<<<<<<<<<<<<<
16921  *
16922  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion,
16923  */
16924  __pyx_r = __pyx_v_IMR_node;
16925  goto __pyx_L0;
16926 
16927  /* "mprans/MeshSmoothing.pyx":1054
16928  * IMRElementsArray_[eN] = IMRElementsArray_[eN]/3.
16929  *
16930  * cdef double cyGetInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
16931  * double[:,:] nodeArray,
16932  * int[:,:] elementNodesArray,
16933  */
16934 
16935  /* function exit code */
16936  __pyx_L1_error:;
16937  __Pyx_XDECREF(__pyx_t_1);
16938  __Pyx_XDECREF(__pyx_t_2);
16939  __Pyx_XDECREF(__pyx_t_3);
16940  __Pyx_XDECREF(__pyx_t_4);
16941  __Pyx_XDECREF(__pyx_t_5);
16942  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
16943  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
16944  __Pyx_XDECREF(__pyx_t_20);
16945  __Pyx_XDECREF(__pyx_t_21);
16946  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyGetInverseMeanRatioSingleTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
16947  __pyx_r = 0;
16948  __pyx_L0:;
16949  __PYX_XDEC_MEMVIEW(&__pyx_v_W, 1);
16950  __PYX_XDEC_MEMVIEW(&__pyx_v_A, 1);
16951  __PYX_XDEC_MEMVIEW(&__pyx_v_AW, 1);
16952  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_a, 1);
16953  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_b, 1);
16954  __PYX_XDEC_MEMVIEW(&__pyx_v_vec_c, 1);
16955  __Pyx_RefNannyFinishContext();
16956  return __pyx_r;
16957 }
16958 
16959 /* "mprans/MeshSmoothing.pyx":1108
16960  * return IMR_node
16961  *
16962  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
16963  * double[:] dilation,
16964  * double[:,:] nodeArray,
16965  */
16966 
16967 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality(__Pyx_memviewslice __pyx_v_distortion, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_dilation, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nNodes_owned, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementNodesArray, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality *__pyx_optional_args) {
16968 
16969  /* "mprans/MeshSmoothing.pyx":1116
16970  * int[:] nodeElementsArray,
16971  * int[:,:] elementNodesArray,
16972  * bool apply_directly=False): # <<<<<<<<<<<<<<
16973  * cdef double[:,:] disp = nodeArray.copy()
16974  * cdef double[:,:] nodeArrayMod
16975  */
16976  bool __pyx_v_apply_directly = ((bool)0);
16977  __Pyx_memviewslice __pyx_v_disp = { 0, 0, { 0 }, { 0 }, { 0 } };
16978  __Pyx_memviewslice __pyx_v_nodeArrayMod = { 0, 0, { 0 }, { 0 }, { 0 } };
16979  double __pyx_v_weighted_pos[3];
16980  int __pyx_v_nNel;
16981  double __pyx_v_weight;
16982  double __pyx_v_weights;
16983  int __pyx_v_node;
16984  int __pyx_v_eOffset;
16985  int __pyx_v_eN;
16986  int __pyx_v_eNnode;
16987  int __pyx_v_iN;
16988  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
16989  __Pyx_RefNannyDeclarations
16990  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
16991  int __pyx_t_2;
16992  int __pyx_t_3;
16993  int __pyx_t_4;
16994  int __pyx_t_5;
16995  Py_ssize_t __pyx_t_6;
16996  int __pyx_t_7;
16997  int __pyx_t_8;
16998  int __pyx_t_9;
16999  Py_ssize_t __pyx_t_10;
17000  int __pyx_t_11;
17001  int __pyx_t_12;
17002  int __pyx_t_13;
17003  Py_ssize_t __pyx_t_14;
17004  long __pyx_t_15;
17005  Py_ssize_t __pyx_t_16;
17006  Py_ssize_t __pyx_t_17;
17007  Py_ssize_t __pyx_t_18;
17008  int __pyx_lineno = 0;
17009  const char *__pyx_filename = NULL;
17010  int __pyx_clineno = 0;
17011  __Pyx_RefNannySetupContext("cySmoothNodesQuality", 0);
17012  if (__pyx_optional_args) {
17013  if (__pyx_optional_args->__pyx_n > 0) {
17014  __pyx_v_apply_directly = __pyx_optional_args->apply_directly;
17015  }
17016  }
17017 
17018  /* "mprans/MeshSmoothing.pyx":1117
17019  * int[:,:] elementNodesArray,
17020  * bool apply_directly=False):
17021  * cdef double[:,:] disp = nodeArray.copy() # <<<<<<<<<<<<<<
17022  * cdef double[:,:] nodeArrayMod
17023  * if not apply_directly:
17024  */
17025  __pyx_t_1 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1117, __pyx_L1_error)
17026  __pyx_v_disp = __pyx_t_1;
17027  __pyx_t_1.memview = NULL;
17028  __pyx_t_1.data = NULL;
17029 
17030  /* "mprans/MeshSmoothing.pyx":1119
17031  * cdef double[:,:] disp = nodeArray.copy()
17032  * cdef double[:,:] nodeArrayMod
17033  * if not apply_directly: # <<<<<<<<<<<<<<
17034  * nodeArrayMod = nodeArray.copy()
17035  * else:
17036  */
17037  __pyx_t_2 = ((!(__pyx_v_apply_directly != 0)) != 0);
17038  if (__pyx_t_2) {
17039 
17040  /* "mprans/MeshSmoothing.pyx":1120
17041  * cdef double[:,:] nodeArrayMod
17042  * if not apply_directly:
17043  * nodeArrayMod = nodeArray.copy() # <<<<<<<<<<<<<<
17044  * else:
17045  * nodeArrayMod = nodeArray
17046  */
17047  __pyx_t_1 = __pyx_memoryview_copy_slice_d_dc_double_c(__pyx_v_nodeArray); if (unlikely(!__pyx_t_1.memview)) __PYX_ERR(0, 1120, __pyx_L1_error)
17048  __pyx_v_nodeArrayMod = __pyx_t_1;
17049  __pyx_t_1.memview = NULL;
17050  __pyx_t_1.data = NULL;
17051 
17052  /* "mprans/MeshSmoothing.pyx":1119
17053  * cdef double[:,:] disp = nodeArray.copy()
17054  * cdef double[:,:] nodeArrayMod
17055  * if not apply_directly: # <<<<<<<<<<<<<<
17056  * nodeArrayMod = nodeArray.copy()
17057  * else:
17058  */
17059  goto __pyx_L3;
17060  }
17061 
17062  /* "mprans/MeshSmoothing.pyx":1122
17063  * nodeArrayMod = nodeArray.copy()
17064  * else:
17065  * nodeArrayMod = nodeArray # <<<<<<<<<<<<<<
17066  * cdef double[3] weighted_pos
17067  * cdef int nNel = elementNodesArray.shape[1]
17068  */
17069  /*else*/ {
17070  __PYX_INC_MEMVIEW(&__pyx_v_nodeArray, 0);
17071  __pyx_v_nodeArrayMod = __pyx_v_nodeArray;
17072  }
17073  __pyx_L3:;
17074 
17075  /* "mprans/MeshSmoothing.pyx":1124
17076  * nodeArrayMod = nodeArray
17077  * cdef double[3] weighted_pos
17078  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
17079  * cdef double weight = 0
17080  * cdef double weights = 0
17081  */
17082  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
17083 
17084  /* "mprans/MeshSmoothing.pyx":1125
17085  * cdef double[3] weighted_pos
17086  * cdef int nNel = elementNodesArray.shape[1]
17087  * cdef double weight = 0 # <<<<<<<<<<<<<<
17088  * cdef double weights = 0
17089  * cdef int node
17090  */
17091  __pyx_v_weight = 0.0;
17092 
17093  /* "mprans/MeshSmoothing.pyx":1126
17094  * cdef int nNel = elementNodesArray.shape[1]
17095  * cdef double weight = 0
17096  * cdef double weights = 0 # <<<<<<<<<<<<<<
17097  * cdef int node
17098  * cdef int eOffset
17099  */
17100  __pyx_v_weights = 0.0;
17101 
17102  /* "mprans/MeshSmoothing.pyx":1132
17103  * cdef int eNnode
17104  * cdef int iN
17105  * for node in range(nNodes_owned): # <<<<<<<<<<<<<<
17106  * if nodeMaterialTypes[node] == 0:
17107  * weights = 0
17108  */
17109  __pyx_t_3 = __pyx_v_nNodes_owned;
17110  __pyx_t_4 = __pyx_t_3;
17111  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
17112  __pyx_v_node = __pyx_t_5;
17113 
17114  /* "mprans/MeshSmoothing.pyx":1133
17115  * cdef int iN
17116  * for node in range(nNodes_owned):
17117  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
17118  * weights = 0
17119  * weighted_pos[0] = 0
17120  */
17121  __pyx_t_6 = __pyx_v_node;
17122  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeMaterialTypes.shape[0];
17123  __pyx_t_2 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_6 * __pyx_v_nodeMaterialTypes.strides[0]) ))) == 0) != 0);
17124  if (__pyx_t_2) {
17125 
17126  /* "mprans/MeshSmoothing.pyx":1134
17127  * for node in range(nNodes_owned):
17128  * if nodeMaterialTypes[node] == 0:
17129  * weights = 0 # <<<<<<<<<<<<<<
17130  * weighted_pos[0] = 0
17131  * weighted_pos[1] = 0
17132  */
17133  __pyx_v_weights = 0.0;
17134 
17135  /* "mprans/MeshSmoothing.pyx":1135
17136  * if nodeMaterialTypes[node] == 0:
17137  * weights = 0
17138  * weighted_pos[0] = 0 # <<<<<<<<<<<<<<
17139  * weighted_pos[1] = 0
17140  * weighted_pos[2] = 0
17141  */
17142  (__pyx_v_weighted_pos[0]) = 0.0;
17143 
17144  /* "mprans/MeshSmoothing.pyx":1136
17145  * weights = 0
17146  * weighted_pos[0] = 0
17147  * weighted_pos[1] = 0 # <<<<<<<<<<<<<<
17148  * weighted_pos[2] = 0
17149  * for eOffset in range(nodeElementOffsets[node],
17150  */
17151  (__pyx_v_weighted_pos[1]) = 0.0;
17152 
17153  /* "mprans/MeshSmoothing.pyx":1137
17154  * weighted_pos[0] = 0
17155  * weighted_pos[1] = 0
17156  * weighted_pos[2] = 0 # <<<<<<<<<<<<<<
17157  * for eOffset in range(nodeElementOffsets[node],
17158  * nodeElementOffsets[node+1]):
17159  */
17160  (__pyx_v_weighted_pos[2]) = 0.0;
17161 
17162  /* "mprans/MeshSmoothing.pyx":1139
17163  * weighted_pos[2] = 0
17164  * for eOffset in range(nodeElementOffsets[node],
17165  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
17166  * eN = nodeElementsArray[eOffset]
17167  * for iN in range(nNel):
17168  */
17169  __pyx_t_6 = (__pyx_v_node + 1);
17170  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeElementOffsets.shape[0];
17171  __pyx_t_7 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_6 * __pyx_v_nodeElementOffsets.strides[0]) )));
17172 
17173  /* "mprans/MeshSmoothing.pyx":1138
17174  * weighted_pos[1] = 0
17175  * weighted_pos[2] = 0
17176  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
17177  * nodeElementOffsets[node+1]):
17178  * eN = nodeElementsArray[eOffset]
17179  */
17180  __pyx_t_6 = __pyx_v_node;
17181  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeElementOffsets.shape[0];
17182 
17183  /* "mprans/MeshSmoothing.pyx":1139
17184  * weighted_pos[2] = 0
17185  * for eOffset in range(nodeElementOffsets[node],
17186  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
17187  * eN = nodeElementsArray[eOffset]
17188  * for iN in range(nNel):
17189  */
17190  __pyx_t_8 = __pyx_t_7;
17191  for (__pyx_t_9 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_6 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
17192 
17193  /* "mprans/MeshSmoothing.pyx":1138
17194  * weighted_pos[1] = 0
17195  * weighted_pos[2] = 0
17196  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
17197  * nodeElementOffsets[node+1]):
17198  * eN = nodeElementsArray[eOffset]
17199  */
17200  __pyx_v_eOffset = __pyx_t_9;
17201 
17202  /* "mprans/MeshSmoothing.pyx":1140
17203  * for eOffset in range(nodeElementOffsets[node],
17204  * nodeElementOffsets[node+1]):
17205  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
17206  * for iN in range(nNel):
17207  * eNnode = elementNodesArray[eN, iN]
17208  */
17209  __pyx_t_10 = __pyx_v_eOffset;
17210  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeElementsArray.shape[0];
17211  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_10 * __pyx_v_nodeElementsArray.strides[0]) )));
17212 
17213  /* "mprans/MeshSmoothing.pyx":1141
17214  * nodeElementOffsets[node+1]):
17215  * eN = nodeElementsArray[eOffset]
17216  * for iN in range(nNel): # <<<<<<<<<<<<<<
17217  * eNnode = elementNodesArray[eN, iN]
17218  * if eNnode != node:
17219  */
17220  __pyx_t_11 = __pyx_v_nNel;
17221  __pyx_t_12 = __pyx_t_11;
17222  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
17223  __pyx_v_iN = __pyx_t_13;
17224 
17225  /* "mprans/MeshSmoothing.pyx":1142
17226  * eN = nodeElementsArray[eOffset]
17227  * for iN in range(nNel):
17228  * eNnode = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
17229  * if eNnode != node:
17230  * weight = distortion[eN]
17231  */
17232  __pyx_t_10 = __pyx_v_eN;
17233  __pyx_t_14 = __pyx_v_iN;
17234  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementNodesArray.shape[0];
17235  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementNodesArray.shape[1];
17236  __pyx_v_eNnode = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_10 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_14 * __pyx_v_elementNodesArray.strides[1]) )));
17237 
17238  /* "mprans/MeshSmoothing.pyx":1143
17239  * for iN in range(nNel):
17240  * eNnode = elementNodesArray[eN, iN]
17241  * if eNnode != node: # <<<<<<<<<<<<<<
17242  * weight = distortion[eN]
17243  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17244  */
17245  __pyx_t_2 = ((__pyx_v_eNnode != __pyx_v_node) != 0);
17246  if (__pyx_t_2) {
17247 
17248  /* "mprans/MeshSmoothing.pyx":1144
17249  * eNnode = elementNodesArray[eN, iN]
17250  * if eNnode != node:
17251  * weight = distortion[eN] # <<<<<<<<<<<<<<
17252  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17253  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17254  */
17255  __pyx_t_14 = __pyx_v_eN;
17256  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_distortion.shape[0];
17257  __pyx_v_weight = (*((double *) ( /* dim=0 */ (__pyx_v_distortion.data + __pyx_t_14 * __pyx_v_distortion.strides[0]) )));
17258 
17259  /* "mprans/MeshSmoothing.pyx":1145
17260  * if eNnode != node:
17261  * weight = distortion[eN]
17262  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight # <<<<<<<<<<<<<<
17263  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17264  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17265  */
17266  __pyx_t_15 = 0;
17267  __pyx_t_14 = __pyx_v_eNnode;
17268  __pyx_t_10 = 0;
17269  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArrayMod.shape[0];
17270  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArrayMod.shape[1];
17271  (__pyx_v_weighted_pos[__pyx_t_15]) = ((__pyx_v_weighted_pos[__pyx_t_15]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_14 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_10 * __pyx_v_nodeArrayMod.strides[1]) ))) * __pyx_v_weight));
17272 
17273  /* "mprans/MeshSmoothing.pyx":1146
17274  * weight = distortion[eN]
17275  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17276  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight # <<<<<<<<<<<<<<
17277  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17278  * weights += weight
17279  */
17280  __pyx_t_15 = 1;
17281  __pyx_t_10 = __pyx_v_eNnode;
17282  __pyx_t_14 = 1;
17283  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArrayMod.shape[0];
17284  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArrayMod.shape[1];
17285  (__pyx_v_weighted_pos[__pyx_t_15]) = ((__pyx_v_weighted_pos[__pyx_t_15]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_10 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArrayMod.strides[1]) ))) * __pyx_v_weight));
17286 
17287  /* "mprans/MeshSmoothing.pyx":1147
17288  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17289  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17290  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight # <<<<<<<<<<<<<<
17291  * weights += weight
17292  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17293  */
17294  __pyx_t_15 = 2;
17295  __pyx_t_14 = __pyx_v_eNnode;
17296  __pyx_t_10 = 2;
17297  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArrayMod.shape[0];
17298  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArrayMod.shape[1];
17299  (__pyx_v_weighted_pos[__pyx_t_15]) = ((__pyx_v_weighted_pos[__pyx_t_15]) + ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_14 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_10 * __pyx_v_nodeArrayMod.strides[1]) ))) * __pyx_v_weight));
17300 
17301  /* "mprans/MeshSmoothing.pyx":1148
17302  * weighted_pos[1] += nodeArrayMod[eNnode, 1]*weight
17303  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17304  * weights += weight # <<<<<<<<<<<<<<
17305  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17306  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17307  */
17308  __pyx_v_weights = (__pyx_v_weights + __pyx_v_weight);
17309 
17310  /* "mprans/MeshSmoothing.pyx":1143
17311  * for iN in range(nNel):
17312  * eNnode = elementNodesArray[eN, iN]
17313  * if eNnode != node: # <<<<<<<<<<<<<<
17314  * weight = distortion[eN]
17315  * weighted_pos[0] += nodeArrayMod[eNnode, 0]*weight
17316  */
17317  }
17318  }
17319 
17320  /* "mprans/MeshSmoothing.pyx":1149
17321  * weighted_pos[2] += nodeArrayMod[eNnode, 2]*weight
17322  * weights += weight
17323  * nodeArrayMod[node, 0] = weighted_pos[0]/weights # <<<<<<<<<<<<<<
17324  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17325  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17326  */
17327  __pyx_t_10 = __pyx_v_node;
17328  __pyx_t_14 = 0;
17329  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArrayMod.shape[0];
17330  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArrayMod.shape[1];
17331  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_10 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArrayMod.strides[1]) )) = ((__pyx_v_weighted_pos[0]) / __pyx_v_weights);
17332 
17333  /* "mprans/MeshSmoothing.pyx":1150
17334  * weights += weight
17335  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17336  * nodeArrayMod[node, 1] = weighted_pos[1]/weights # <<<<<<<<<<<<<<
17337  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17338  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17339  */
17340  __pyx_t_14 = __pyx_v_node;
17341  __pyx_t_10 = 1;
17342  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArrayMod.shape[0];
17343  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArrayMod.shape[1];
17344  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_14 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_10 * __pyx_v_nodeArrayMod.strides[1]) )) = ((__pyx_v_weighted_pos[1]) / __pyx_v_weights);
17345 
17346  /* "mprans/MeshSmoothing.pyx":1151
17347  * nodeArrayMod[node, 0] = weighted_pos[0]/weights
17348  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17349  * nodeArrayMod[node, 2] = weighted_pos[2]/weights # <<<<<<<<<<<<<<
17350  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17351  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17352  */
17353  __pyx_t_10 = __pyx_v_node;
17354  __pyx_t_14 = 2;
17355  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArrayMod.shape[0];
17356  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArrayMod.shape[1];
17357  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArrayMod.data + __pyx_t_10 * __pyx_v_nodeArrayMod.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArrayMod.strides[1]) )) = ((__pyx_v_weighted_pos[2]) / __pyx_v_weights);
17358  }
17359 
17360  /* "mprans/MeshSmoothing.pyx":1133
17361  * cdef int iN
17362  * for node in range(nNodes_owned):
17363  * if nodeMaterialTypes[node] == 0: # <<<<<<<<<<<<<<
17364  * weights = 0
17365  * weighted_pos[0] = 0
17366  */
17367  }
17368 
17369  /* "mprans/MeshSmoothing.pyx":1152
17370  * nodeArrayMod[node, 1] = weighted_pos[1]/weights
17371  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17372  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0] # <<<<<<<<<<<<<<
17373  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17374  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2]
17375  */
17376  __pyx_t_6 = __pyx_v_node;
17377  __pyx_t_14 = 0;
17378  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_disp.shape[0];
17379  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_disp.shape[1];
17380  __pyx_t_10 = __pyx_v_node;
17381  __pyx_t_16 = 0;
17382  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArray.shape[0];
17383  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray.shape[1];
17384  __pyx_t_17 = __pyx_v_node;
17385  __pyx_t_18 = 0;
17386  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[0];
17387  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_disp.shape[1];
17388  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_17 * __pyx_v_disp.strides[0]) ) + __pyx_t_18 * __pyx_v_disp.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_6 * __pyx_v_disp.strides[0]) ) + __pyx_t_14 * __pyx_v_disp.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_10 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray.strides[1]) ))));
17389 
17390  /* "mprans/MeshSmoothing.pyx":1153
17391  * nodeArrayMod[node, 2] = weighted_pos[2]/weights
17392  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17393  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1] # <<<<<<<<<<<<<<
17394  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2]
17395  * return disp
17396  */
17397  __pyx_t_16 = __pyx_v_node;
17398  __pyx_t_10 = 1;
17399  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_disp.shape[0];
17400  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_disp.shape[1];
17401  __pyx_t_14 = __pyx_v_node;
17402  __pyx_t_6 = 1;
17403  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray.shape[0];
17404  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeArray.shape[1];
17405  __pyx_t_18 = __pyx_v_node;
17406  __pyx_t_17 = 1;
17407  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_disp.shape[0];
17408  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[1];
17409  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_18 * __pyx_v_disp.strides[0]) ) + __pyx_t_17 * __pyx_v_disp.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_16 * __pyx_v_disp.strides[0]) ) + __pyx_t_10 * __pyx_v_disp.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_14 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_6 * __pyx_v_nodeArray.strides[1]) ))));
17410 
17411  /* "mprans/MeshSmoothing.pyx":1154
17412  * disp[node, 0] = disp[node, 0]-nodeArray[node, 0]
17413  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17414  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2] # <<<<<<<<<<<<<<
17415  * return disp
17416  *
17417  */
17418  __pyx_t_6 = __pyx_v_node;
17419  __pyx_t_14 = 2;
17420  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_disp.shape[0];
17421  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_disp.shape[1];
17422  __pyx_t_10 = __pyx_v_node;
17423  __pyx_t_16 = 2;
17424  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArray.shape[0];
17425  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeArray.shape[1];
17426  __pyx_t_17 = __pyx_v_node;
17427  __pyx_t_18 = 2;
17428  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_disp.shape[0];
17429  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_disp.shape[1];
17430  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_17 * __pyx_v_disp.strides[0]) ) + __pyx_t_18 * __pyx_v_disp.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_disp.data + __pyx_t_6 * __pyx_v_disp.strides[0]) ) + __pyx_t_14 * __pyx_v_disp.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_10 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_16 * __pyx_v_nodeArray.strides[1]) ))));
17431  }
17432 
17433  /* "mprans/MeshSmoothing.pyx":1155
17434  * disp[node, 1] = disp[node, 1]-nodeArray[node, 1]
17435  * disp[node, 2] = disp[node, 2]-nodeArray[node, 2]
17436  * return disp # <<<<<<<<<<<<<<
17437  *
17438  * cdef int pyxGetLocalNearestNode(double[:] coords,
17439  */
17440  __PYX_INC_MEMVIEW(&__pyx_v_disp, 0);
17441  __pyx_r = __pyx_v_disp;
17442  goto __pyx_L0;
17443 
17444  /* "mprans/MeshSmoothing.pyx":1108
17445  * return IMR_node
17446  *
17447  * cdef double[:,:] cySmoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
17448  * double[:] dilation,
17449  * double[:,:] nodeArray,
17450  */
17451 
17452  /* function exit code */
17453  __pyx_L1_error:;
17454  __PYX_XDEC_MEMVIEW(&__pyx_t_1, 1);
17455  __pyx_r.data = NULL;
17456  __pyx_r.memview = NULL;
17457  __Pyx_AddTraceback("mprans.MeshSmoothing.cySmoothNodesQuality", __pyx_clineno, __pyx_lineno, __pyx_filename);
17458  goto __pyx_L2;
17459  __pyx_L0:;
17460  if (unlikely(!__pyx_r.memview)) {
17461  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
17462  }
17463  __pyx_L2:;
17464  __PYX_XDEC_MEMVIEW(&__pyx_v_disp, 1);
17465  __PYX_XDEC_MEMVIEW(&__pyx_v_nodeArrayMod, 1);
17466  __Pyx_RefNannyFinishContext();
17467  return __pyx_r;
17468 }
17469 
17470 /* "mprans/MeshSmoothing.pyx":1157
17471  * return disp
17472  *
17473  * cdef int pyxGetLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
17474  * double[:,:] nodeArray,
17475  * int[:] nodeStarOffsets,
17476  */
17477 
17478 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, int __pyx_v_node) {
17479  int __pyx_v_nearest_node;
17480  int __pyx_v_nearest_node0;
17481  double __pyx_v_dist;
17482  double __pyx_v_min_dist;
17483  __Pyx_memviewslice __pyx_v_node_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
17484  bool __pyx_v_found_node;
17485  int __pyx_v_i;
17486  int __pyx_v_nOffset;
17487  int __pyx_r;
17488  __Pyx_RefNannyDeclarations
17489  __Pyx_memviewslice __pyx_t_1 = { 0, 0, { 0 }, { 0 }, { 0 } };
17490  Py_ssize_t __pyx_t_2;
17491  Py_ssize_t __pyx_t_3;
17492  Py_ssize_t __pyx_t_4;
17493  Py_ssize_t __pyx_t_5;
17494  Py_ssize_t __pyx_t_6;
17495  Py_ssize_t __pyx_t_7;
17496  Py_ssize_t __pyx_t_8;
17497  Py_ssize_t __pyx_t_9;
17498  Py_ssize_t __pyx_t_10;
17499  Py_ssize_t __pyx_t_11;
17500  Py_ssize_t __pyx_t_12;
17501  Py_ssize_t __pyx_t_13;
17502  int __pyx_t_14;
17503  int __pyx_t_15;
17504  int __pyx_t_16;
17505  int __pyx_t_17;
17506  Py_ssize_t __pyx_t_18;
17507  __Pyx_RefNannySetupContext("pyxGetLocalNearestNode", 0);
17508 
17509  /* "mprans/MeshSmoothing.pyx":1163
17510  * int node):
17511  * # determine local nearest node distance
17512  * cdef int nearest_node = node # <<<<<<<<<<<<<<
17513  * cdef int nearest_node0 = node
17514  * cdef double dist
17515  */
17516  __pyx_v_nearest_node = __pyx_v_node;
17517 
17518  /* "mprans/MeshSmoothing.pyx":1164
17519  * # determine local nearest node distance
17520  * cdef int nearest_node = node
17521  * cdef int nearest_node0 = node # <<<<<<<<<<<<<<
17522  * cdef double dist
17523  * cdef double min_dist
17524  */
17525  __pyx_v_nearest_node0 = __pyx_v_node;
17526 
17527  /* "mprans/MeshSmoothing.pyx":1167
17528  * cdef double dist
17529  * cdef double min_dist
17530  * cdef double[:] node_coords = nodeArray[nearest_node] # <<<<<<<<<<<<<<
17531  * cdef bool found_node = False
17532  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17533  */
17534  __pyx_t_1.data = __pyx_v_nodeArray.data;
17535  __pyx_t_1.memview = __pyx_v_nodeArray.memview;
17536  __PYX_INC_MEMVIEW(&__pyx_t_1, 0);
17537  {
17538  Py_ssize_t __pyx_tmp_idx = __pyx_v_nearest_node;
17539  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
17540  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
17541  if (__pyx_tmp_idx < 0)
17542  __pyx_tmp_idx += __pyx_tmp_shape;
17543  __pyx_t_1.data += __pyx_tmp_idx * __pyx_tmp_stride;
17544 }
17545 
17546 __pyx_t_1.shape[0] = __pyx_v_nodeArray.shape[1];
17547 __pyx_t_1.strides[0] = __pyx_v_nodeArray.strides[1];
17548  __pyx_t_1.suboffsets[0] = -1;
17549 
17550 __pyx_v_node_coords = __pyx_t_1;
17551  __pyx_t_1.memview = NULL;
17552  __pyx_t_1.data = NULL;
17553 
17554  /* "mprans/MeshSmoothing.pyx":1168
17555  * cdef double min_dist
17556  * cdef double[:] node_coords = nodeArray[nearest_node]
17557  * cdef bool found_node = False # <<<<<<<<<<<<<<
17558  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17559  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17560  */
17561  __pyx_v_found_node = 0;
17562 
17563  /* "mprans/MeshSmoothing.pyx":1169
17564  * cdef double[:] node_coords = nodeArray[nearest_node]
17565  * cdef bool found_node = False
17566  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
17567  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17568  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17569  */
17570  __pyx_t_2 = 0;
17571  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_node_coords.shape[0];
17572  __pyx_t_3 = 0;
17573  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coords.shape[0];
17574  __pyx_t_4 = 0;
17575  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_node_coords.shape[0];
17576  __pyx_t_5 = 0;
17577  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
17578 
17579  /* "mprans/MeshSmoothing.pyx":1170
17580  * cdef bool found_node = False
17581  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17582  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17583  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17584  * cdef int i = 0
17585  */
17586  __pyx_t_6 = 1;
17587  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node_coords.shape[0];
17588  __pyx_t_7 = 1;
17589  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coords.shape[0];
17590  __pyx_t_8 = 1;
17591  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_node_coords.shape[0];
17592  __pyx_t_9 = 1;
17593  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coords.shape[0];
17594 
17595  /* "mprans/MeshSmoothing.pyx":1171
17596  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17597  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17598  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2]) # <<<<<<<<<<<<<<
17599  * cdef int i = 0
17600  * cdef int nOffset
17601  */
17602  __pyx_t_10 = 2;
17603  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_node_coords.shape[0];
17604  __pyx_t_11 = 2;
17605  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coords.shape[0];
17606  __pyx_t_12 = 2;
17607  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_node_coords.shape[0];
17608  __pyx_t_13 = 2;
17609  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_coords.shape[0];
17610 
17611  /* "mprans/MeshSmoothing.pyx":1170
17612  * cdef bool found_node = False
17613  * min_dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17614  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17615  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17616  * cdef int i = 0
17617  */
17618  __pyx_v_min_dist = (((((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_2 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_3 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_4 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_6 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_7 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_8 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_9 * __pyx_v_coords.strides[0]) )))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_10 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_11 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_12 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_13 * __pyx_v_coords.strides[0]) ))))));
17619 
17620  /* "mprans/MeshSmoothing.pyx":1172
17621  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17622  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17623  * cdef int i = 0 # <<<<<<<<<<<<<<
17624  * cdef int nOffset
17625  * while found_node is False:
17626  */
17627  __pyx_v_i = 0;
17628 
17629  /* "mprans/MeshSmoothing.pyx":1174
17630  * cdef int i = 0
17631  * cdef int nOffset
17632  * while found_node is False: # <<<<<<<<<<<<<<
17633  * nearest_node0 = nearest_node
17634  * for nOffset in range(nodeStarOffsets[nearest_node0],
17635  */
17636  while (1) {
17637  __pyx_t_14 = ((__pyx_v_found_node == 0) != 0);
17638  if (!__pyx_t_14) break;
17639 
17640  /* "mprans/MeshSmoothing.pyx":1175
17641  * cdef int nOffset
17642  * while found_node is False:
17643  * nearest_node0 = nearest_node # <<<<<<<<<<<<<<
17644  * for nOffset in range(nodeStarOffsets[nearest_node0],
17645  * nodeStarOffsets[nearest_node0+1]):
17646  */
17647  __pyx_v_nearest_node0 = __pyx_v_nearest_node;
17648 
17649  /* "mprans/MeshSmoothing.pyx":1177
17650  * nearest_node0 = nearest_node
17651  * for nOffset in range(nodeStarOffsets[nearest_node0],
17652  * nodeStarOffsets[nearest_node0+1]): # <<<<<<<<<<<<<<
17653  * node = nodeStarArray[nOffset]
17654  * node_coords = nodeArray[node]
17655  */
17656  __pyx_t_13 = (__pyx_v_nearest_node0 + 1);
17657  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeStarOffsets.shape[0];
17658  __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_13 * __pyx_v_nodeStarOffsets.strides[0]) )));
17659 
17660  /* "mprans/MeshSmoothing.pyx":1176
17661  * while found_node is False:
17662  * nearest_node0 = nearest_node
17663  * for nOffset in range(nodeStarOffsets[nearest_node0], # <<<<<<<<<<<<<<
17664  * nodeStarOffsets[nearest_node0+1]):
17665  * node = nodeStarArray[nOffset]
17666  */
17667  __pyx_t_13 = __pyx_v_nearest_node0;
17668  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeStarOffsets.shape[0];
17669 
17670  /* "mprans/MeshSmoothing.pyx":1177
17671  * nearest_node0 = nearest_node
17672  * for nOffset in range(nodeStarOffsets[nearest_node0],
17673  * nodeStarOffsets[nearest_node0+1]): # <<<<<<<<<<<<<<
17674  * node = nodeStarArray[nOffset]
17675  * node_coords = nodeArray[node]
17676  */
17677  __pyx_t_16 = __pyx_t_15;
17678  for (__pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_13 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
17679 
17680  /* "mprans/MeshSmoothing.pyx":1176
17681  * while found_node is False:
17682  * nearest_node0 = nearest_node
17683  * for nOffset in range(nodeStarOffsets[nearest_node0], # <<<<<<<<<<<<<<
17684  * nodeStarOffsets[nearest_node0+1]):
17685  * node = nodeStarArray[nOffset]
17686  */
17687  __pyx_v_nOffset = __pyx_t_17;
17688 
17689  /* "mprans/MeshSmoothing.pyx":1178
17690  * for nOffset in range(nodeStarOffsets[nearest_node0],
17691  * nodeStarOffsets[nearest_node0+1]):
17692  * node = nodeStarArray[nOffset] # <<<<<<<<<<<<<<
17693  * node_coords = nodeArray[node]
17694  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17695  */
17696  __pyx_t_12 = __pyx_v_nOffset;
17697  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nodeStarArray.shape[0];
17698  __pyx_v_node = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_12 * __pyx_v_nodeStarArray.strides[0]) )));
17699 
17700  /* "mprans/MeshSmoothing.pyx":1179
17701  * nodeStarOffsets[nearest_node0+1]):
17702  * node = nodeStarArray[nOffset]
17703  * node_coords = nodeArray[node] # <<<<<<<<<<<<<<
17704  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17705  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17706  */
17707  __pyx_t_1.data = __pyx_v_nodeArray.data;
17708  __pyx_t_1.memview = __pyx_v_nodeArray.memview;
17709  __PYX_INC_MEMVIEW(&__pyx_t_1, 0);
17710  {
17711  Py_ssize_t __pyx_tmp_idx = __pyx_v_node;
17712  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
17713  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
17714  if (__pyx_tmp_idx < 0)
17715  __pyx_tmp_idx += __pyx_tmp_shape;
17716  __pyx_t_1.data += __pyx_tmp_idx * __pyx_tmp_stride;
17717 }
17718 
17719 __pyx_t_1.shape[0] = __pyx_v_nodeArray.shape[1];
17720 __pyx_t_1.strides[0] = __pyx_v_nodeArray.strides[1];
17721  __pyx_t_1.suboffsets[0] = -1;
17722 
17723 __PYX_XDEC_MEMVIEW(&__pyx_v_node_coords, 1);
17724  __pyx_v_node_coords = __pyx_t_1;
17725  __pyx_t_1.memview = NULL;
17726  __pyx_t_1.data = NULL;
17727 
17728  /* "mprans/MeshSmoothing.pyx":1180
17729  * node = nodeStarArray[nOffset]
17730  * node_coords = nodeArray[node]
17731  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
17732  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17733  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17734  */
17735  __pyx_t_12 = 0;
17736  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_node_coords.shape[0];
17737  __pyx_t_11 = 0;
17738  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_coords.shape[0];
17739  __pyx_t_10 = 0;
17740  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_node_coords.shape[0];
17741  __pyx_t_9 = 0;
17742  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_coords.shape[0];
17743 
17744  /* "mprans/MeshSmoothing.pyx":1181
17745  * node_coords = nodeArray[node]
17746  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17747  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17748  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17749  * if dist < min_dist:
17750  */
17751  __pyx_t_8 = 1;
17752  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_node_coords.shape[0];
17753  __pyx_t_7 = 1;
17754  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_coords.shape[0];
17755  __pyx_t_6 = 1;
17756  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node_coords.shape[0];
17757  __pyx_t_5 = 1;
17758  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
17759 
17760  /* "mprans/MeshSmoothing.pyx":1182
17761  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17762  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17763  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2]) # <<<<<<<<<<<<<<
17764  * if dist < min_dist:
17765  * min_dist = dist
17766  */
17767  __pyx_t_4 = 2;
17768  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_node_coords.shape[0];
17769  __pyx_t_3 = 2;
17770  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coords.shape[0];
17771  __pyx_t_2 = 2;
17772  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_node_coords.shape[0];
17773  __pyx_t_18 = 2;
17774  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_coords.shape[0];
17775 
17776  /* "mprans/MeshSmoothing.pyx":1181
17777  * node_coords = nodeArray[node]
17778  * dist = (node_coords[0]-coords[0])*(node_coords[0]-coords[0])+\
17779  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
17780  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17781  * if dist < min_dist:
17782  */
17783  __pyx_v_dist = (((((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_12 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_11 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_10 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_9 * __pyx_v_coords.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_8 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_7 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_6 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) )))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_4 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_3 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_node_coords.data + __pyx_t_2 * __pyx_v_node_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_18 * __pyx_v_coords.strides[0]) ))))));
17784 
17785  /* "mprans/MeshSmoothing.pyx":1183
17786  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17787  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17788  * if dist < min_dist: # <<<<<<<<<<<<<<
17789  * min_dist = dist
17790  * nearest_node = node
17791  */
17792  __pyx_t_14 = ((__pyx_v_dist < __pyx_v_min_dist) != 0);
17793  if (__pyx_t_14) {
17794 
17795  /* "mprans/MeshSmoothing.pyx":1184
17796  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17797  * if dist < min_dist:
17798  * min_dist = dist # <<<<<<<<<<<<<<
17799  * nearest_node = node
17800  * if nearest_node0 == nearest_node:
17801  */
17802  __pyx_v_min_dist = __pyx_v_dist;
17803 
17804  /* "mprans/MeshSmoothing.pyx":1185
17805  * if dist < min_dist:
17806  * min_dist = dist
17807  * nearest_node = node # <<<<<<<<<<<<<<
17808  * if nearest_node0 == nearest_node:
17809  * found_node = True
17810  */
17811  __pyx_v_nearest_node = __pyx_v_node;
17812 
17813  /* "mprans/MeshSmoothing.pyx":1183
17814  * (node_coords[1]-coords[1])*(node_coords[1]-coords[1])+\
17815  * (node_coords[2]-coords[2])*(node_coords[2]-coords[2])
17816  * if dist < min_dist: # <<<<<<<<<<<<<<
17817  * min_dist = dist
17818  * nearest_node = node
17819  */
17820  }
17821  }
17822 
17823  /* "mprans/MeshSmoothing.pyx":1186
17824  * min_dist = dist
17825  * nearest_node = node
17826  * if nearest_node0 == nearest_node: # <<<<<<<<<<<<<<
17827  * found_node = True
17828  * i += 1
17829  */
17830  __pyx_t_14 = ((__pyx_v_nearest_node0 == __pyx_v_nearest_node) != 0);
17831  if (__pyx_t_14) {
17832 
17833  /* "mprans/MeshSmoothing.pyx":1187
17834  * nearest_node = node
17835  * if nearest_node0 == nearest_node:
17836  * found_node = True # <<<<<<<<<<<<<<
17837  * i += 1
17838  * return nearest_node
17839  */
17840  __pyx_v_found_node = 1;
17841 
17842  /* "mprans/MeshSmoothing.pyx":1186
17843  * min_dist = dist
17844  * nearest_node = node
17845  * if nearest_node0 == nearest_node: # <<<<<<<<<<<<<<
17846  * found_node = True
17847  * i += 1
17848  */
17849  }
17850 
17851  /* "mprans/MeshSmoothing.pyx":1188
17852  * if nearest_node0 == nearest_node:
17853  * found_node = True
17854  * i += 1 # <<<<<<<<<<<<<<
17855  * return nearest_node
17856  *
17857  */
17858  __pyx_v_i = (__pyx_v_i + 1);
17859  }
17860 
17861  /* "mprans/MeshSmoothing.pyx":1189
17862  * found_node = True
17863  * i += 1
17864  * return nearest_node # <<<<<<<<<<<<<<
17865  *
17866  *
17867  */
17868  __pyx_r = __pyx_v_nearest_node;
17869  goto __pyx_L0;
17870 
17871  /* "mprans/MeshSmoothing.pyx":1157
17872  * return disp
17873  *
17874  * cdef int pyxGetLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
17875  * double[:,:] nodeArray,
17876  * int[:] nodeStarOffsets,
17877  */
17878 
17879  /* function exit code */
17880  __pyx_L0:;
17881  __PYX_XDEC_MEMVIEW(&__pyx_v_node_coords, 1);
17882  __Pyx_RefNannyFinishContext();
17883  return __pyx_r;
17884 }
17885 
17886 /* "mprans/MeshSmoothing.pyx":1192
17887  *
17888  *
17889  * cdef int pyxGetLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
17890  * double[:,:] elementBarycentersArray,
17891  * int[:,:] elementNeighborsArray,
17892  */
17893 
17894 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_elementBarycentersArray, __Pyx_memviewslice __pyx_v_elementNeighborsArray, int __pyx_v_eN) {
17895  int __pyx_v_nearest_eN;
17896  int __pyx_v_nearest_eN0;
17897  double __pyx_v_dist;
17898  double __pyx_v_min_dist;
17899  double __pyx_v_eN_coords[3];
17900  bool __pyx_v_found_eN;
17901  int __pyx_v_eN_;
17902  int __pyx_v_nEneig;
17903  int __pyx_v_iEn;
17904  int __pyx_v_i;
17905  int __pyx_r;
17906  __Pyx_RefNannyDeclarations
17907  Py_ssize_t __pyx_t_1;
17908  Py_ssize_t __pyx_t_2;
17909  Py_ssize_t __pyx_t_3;
17910  Py_ssize_t __pyx_t_4;
17911  Py_ssize_t __pyx_t_5;
17912  Py_ssize_t __pyx_t_6;
17913  int __pyx_t_7;
17914  int __pyx_t_8;
17915  int __pyx_t_9;
17916  int __pyx_t_10;
17917  __Pyx_RefNannySetupContext("pyxGetLocalNearestElement", 0);
17918 
17919  /* "mprans/MeshSmoothing.pyx":1197
17920  * int eN):
17921  * # determine local nearest node distance
17922  * cdef int nearest_eN = eN # <<<<<<<<<<<<<<
17923  * cdef int nearest_eN0 = eN
17924  * cdef double dist
17925  */
17926  __pyx_v_nearest_eN = __pyx_v_eN;
17927 
17928  /* "mprans/MeshSmoothing.pyx":1198
17929  * # determine local nearest node distance
17930  * cdef int nearest_eN = eN
17931  * cdef int nearest_eN0 = eN # <<<<<<<<<<<<<<
17932  * cdef double dist
17933  * cdef double min_dist
17934  */
17935  __pyx_v_nearest_eN0 = __pyx_v_eN;
17936 
17937  /* "mprans/MeshSmoothing.pyx":1202
17938  * cdef double min_dist
17939  * cdef double[3] eN_coords
17940  * cdef bool found_eN = False # <<<<<<<<<<<<<<
17941  * cdef int nOffset
17942  * cdef int eN_
17943  */
17944  __pyx_v_found_eN = 0;
17945 
17946  /* "mprans/MeshSmoothing.pyx":1205
17947  * cdef int nOffset
17948  * cdef int eN_
17949  * eN_coords[0] = elementBarycentersArray[eN, 0] # <<<<<<<<<<<<<<
17950  * eN_coords[1] = elementBarycentersArray[eN, 1]
17951  * eN_coords[2] = elementBarycentersArray[eN, 2]
17952  */
17953  __pyx_t_1 = __pyx_v_eN;
17954  __pyx_t_2 = 0;
17955  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_elementBarycentersArray.shape[0];
17956  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_elementBarycentersArray.shape[1];
17957  (__pyx_v_eN_coords[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_1 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_2 * __pyx_v_elementBarycentersArray.strides[1]) )));
17958 
17959  /* "mprans/MeshSmoothing.pyx":1206
17960  * cdef int eN_
17961  * eN_coords[0] = elementBarycentersArray[eN, 0]
17962  * eN_coords[1] = elementBarycentersArray[eN, 1] # <<<<<<<<<<<<<<
17963  * eN_coords[2] = elementBarycentersArray[eN, 2]
17964  * cdef int nEneig = elementNeighborsArray.shape[1]
17965  */
17966  __pyx_t_2 = __pyx_v_eN;
17967  __pyx_t_1 = 1;
17968  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_elementBarycentersArray.shape[0];
17969  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_elementBarycentersArray.shape[1];
17970  (__pyx_v_eN_coords[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_2 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_1 * __pyx_v_elementBarycentersArray.strides[1]) )));
17971 
17972  /* "mprans/MeshSmoothing.pyx":1207
17973  * eN_coords[0] = elementBarycentersArray[eN, 0]
17974  * eN_coords[1] = elementBarycentersArray[eN, 1]
17975  * eN_coords[2] = elementBarycentersArray[eN, 2] # <<<<<<<<<<<<<<
17976  * cdef int nEneig = elementNeighborsArray.shape[1]
17977  * cdef int iEn
17978  */
17979  __pyx_t_1 = __pyx_v_eN;
17980  __pyx_t_2 = 2;
17981  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_elementBarycentersArray.shape[0];
17982  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_elementBarycentersArray.shape[1];
17983  (__pyx_v_eN_coords[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_1 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_2 * __pyx_v_elementBarycentersArray.strides[1]) )));
17984 
17985  /* "mprans/MeshSmoothing.pyx":1208
17986  * eN_coords[1] = elementBarycentersArray[eN, 1]
17987  * eN_coords[2] = elementBarycentersArray[eN, 2]
17988  * cdef int nEneig = elementNeighborsArray.shape[1] # <<<<<<<<<<<<<<
17989  * cdef int iEn
17990  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
17991  */
17992  __pyx_v_nEneig = (__pyx_v_elementNeighborsArray.shape[1]);
17993 
17994  /* "mprans/MeshSmoothing.pyx":1210
17995  * cdef int nEneig = elementNeighborsArray.shape[1]
17996  * cdef int iEn
17997  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
17998  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
17999  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18000  */
18001  __pyx_t_2 = 0;
18002  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coords.shape[0];
18003  __pyx_t_1 = 0;
18004  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coords.shape[0];
18005 
18006  /* "mprans/MeshSmoothing.pyx":1211
18007  * cdef int iEn
18008  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18009  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18010  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18011  * cdef int i = 0
18012  */
18013  __pyx_t_3 = 1;
18014  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coords.shape[0];
18015  __pyx_t_4 = 1;
18016  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coords.shape[0];
18017 
18018  /* "mprans/MeshSmoothing.pyx":1212
18019  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18020  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18021  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]) # <<<<<<<<<<<<<<
18022  * cdef int i = 0
18023  * while found_eN is False:
18024  */
18025  __pyx_t_5 = 2;
18026  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
18027  __pyx_t_6 = 2;
18028  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18029 
18030  /* "mprans/MeshSmoothing.pyx":1211
18031  * cdef int iEn
18032  * min_dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18033  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18034  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18035  * cdef int i = 0
18036  */
18037  __pyx_v_min_dist = (((((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_2 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_1 * __pyx_v_coords.strides[0]) ))))) + (((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_3 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_4 * __pyx_v_coords.strides[0]) )))))) + (((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) ))))));
18038 
18039  /* "mprans/MeshSmoothing.pyx":1213
18040  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18041  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18042  * cdef int i = 0 # <<<<<<<<<<<<<<
18043  * while found_eN is False:
18044  * nearest_eN0 = nearest_eN
18045  */
18046  __pyx_v_i = 0;
18047 
18048  /* "mprans/MeshSmoothing.pyx":1214
18049  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18050  * cdef int i = 0
18051  * while found_eN is False: # <<<<<<<<<<<<<<
18052  * nearest_eN0 = nearest_eN
18053  *
18054  */
18055  while (1) {
18056  __pyx_t_7 = ((__pyx_v_found_eN == 0) != 0);
18057  if (!__pyx_t_7) break;
18058 
18059  /* "mprans/MeshSmoothing.pyx":1215
18060  * cdef int i = 0
18061  * while found_eN is False:
18062  * nearest_eN0 = nearest_eN # <<<<<<<<<<<<<<
18063  *
18064  * for iEn in range(nEneig):
18065  */
18066  __pyx_v_nearest_eN0 = __pyx_v_nearest_eN;
18067 
18068  /* "mprans/MeshSmoothing.pyx":1217
18069  * nearest_eN0 = nearest_eN
18070  *
18071  * for iEn in range(nEneig): # <<<<<<<<<<<<<<
18072  * eN_ = elementNeighborsArray[nearest_eN0, iEn]
18073  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18074  */
18075  __pyx_t_8 = __pyx_v_nEneig;
18076  __pyx_t_9 = __pyx_t_8;
18077  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
18078  __pyx_v_iEn = __pyx_t_10;
18079 
18080  /* "mprans/MeshSmoothing.pyx":1218
18081  *
18082  * for iEn in range(nEneig):
18083  * eN_ = elementNeighborsArray[nearest_eN0, iEn] # <<<<<<<<<<<<<<
18084  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18085  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18086  */
18087  __pyx_t_6 = __pyx_v_nearest_eN0;
18088  __pyx_t_5 = __pyx_v_iEn;
18089  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementNeighborsArray.shape[0];
18090  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNeighborsArray.shape[1];
18091  __pyx_v_eN_ = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNeighborsArray.data + __pyx_t_6 * __pyx_v_elementNeighborsArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNeighborsArray.strides[1]) )));
18092 
18093  /* "mprans/MeshSmoothing.pyx":1219
18094  * for iEn in range(nEneig):
18095  * eN_ = elementNeighborsArray[nearest_eN0, iEn]
18096  * eN_coords[0] = elementBarycentersArray[eN_, 0] # <<<<<<<<<<<<<<
18097  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18098  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18099  */
18100  __pyx_t_5 = __pyx_v_eN_;
18101  __pyx_t_6 = 0;
18102  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray.shape[0];
18103  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBarycentersArray.shape[1];
18104  (__pyx_v_eN_coords[0]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_5 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBarycentersArray.strides[1]) )));
18105 
18106  /* "mprans/MeshSmoothing.pyx":1220
18107  * eN_ = elementNeighborsArray[nearest_eN0, iEn]
18108  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18109  * eN_coords[1] = elementBarycentersArray[eN_, 1] # <<<<<<<<<<<<<<
18110  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18111  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18112  */
18113  __pyx_t_6 = __pyx_v_eN_;
18114  __pyx_t_5 = 1;
18115  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBarycentersArray.shape[0];
18116  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray.shape[1];
18117  (__pyx_v_eN_coords[1]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_6 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBarycentersArray.strides[1]) )));
18118 
18119  /* "mprans/MeshSmoothing.pyx":1221
18120  * eN_coords[0] = elementBarycentersArray[eN_, 0]
18121  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18122  * eN_coords[2] = elementBarycentersArray[eN_, 2] # <<<<<<<<<<<<<<
18123  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18124  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18125  */
18126  __pyx_t_5 = __pyx_v_eN_;
18127  __pyx_t_6 = 2;
18128  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray.shape[0];
18129  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBarycentersArray.shape[1];
18130  (__pyx_v_eN_coords[2]) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_5 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBarycentersArray.strides[1]) )));
18131 
18132  /* "mprans/MeshSmoothing.pyx":1222
18133  * eN_coords[1] = elementBarycentersArray[eN_, 1]
18134  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18135  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18136  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18137  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18138  */
18139  __pyx_t_6 = 0;
18140  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18141  __pyx_t_5 = 0;
18142  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
18143 
18144  /* "mprans/MeshSmoothing.pyx":1223
18145  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18146  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18147  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18148  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18149  * if dist < min_dist:
18150  */
18151  __pyx_t_4 = 1;
18152  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coords.shape[0];
18153  __pyx_t_3 = 1;
18154  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coords.shape[0];
18155 
18156  /* "mprans/MeshSmoothing.pyx":1224
18157  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18158  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18159  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]) # <<<<<<<<<<<<<<
18160  * if dist < min_dist:
18161  * min_dist = dist
18162  */
18163  __pyx_t_1 = 2;
18164  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coords.shape[0];
18165  __pyx_t_2 = 2;
18166  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coords.shape[0];
18167 
18168  /* "mprans/MeshSmoothing.pyx":1223
18169  * eN_coords[2] = elementBarycentersArray[eN_, 2]
18170  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18171  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18172  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18173  * if dist < min_dist:
18174  */
18175  __pyx_v_dist = (((((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) ))))) + (((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_4 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_3 * __pyx_v_coords.strides[0]) )))))) + (((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_1 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_2 * __pyx_v_coords.strides[0]) ))))));
18176 
18177  /* "mprans/MeshSmoothing.pyx":1225
18178  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18179  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18180  * if dist < min_dist: # <<<<<<<<<<<<<<
18181  * min_dist = dist
18182  * nearest_eN = eN_
18183  */
18184  __pyx_t_7 = ((__pyx_v_dist < __pyx_v_min_dist) != 0);
18185  if (__pyx_t_7) {
18186 
18187  /* "mprans/MeshSmoothing.pyx":1226
18188  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18189  * if dist < min_dist:
18190  * min_dist = dist # <<<<<<<<<<<<<<
18191  * nearest_eN = eN_
18192  * if nearest_eN0 == nearest_eN:
18193  */
18194  __pyx_v_min_dist = __pyx_v_dist;
18195 
18196  /* "mprans/MeshSmoothing.pyx":1227
18197  * if dist < min_dist:
18198  * min_dist = dist
18199  * nearest_eN = eN_ # <<<<<<<<<<<<<<
18200  * if nearest_eN0 == nearest_eN:
18201  * found_eN = True
18202  */
18203  __pyx_v_nearest_eN = __pyx_v_eN_;
18204 
18205  /* "mprans/MeshSmoothing.pyx":1225
18206  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18207  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
18208  * if dist < min_dist: # <<<<<<<<<<<<<<
18209  * min_dist = dist
18210  * nearest_eN = eN_
18211  */
18212  }
18213  }
18214 
18215  /* "mprans/MeshSmoothing.pyx":1228
18216  * min_dist = dist
18217  * nearest_eN = eN_
18218  * if nearest_eN0 == nearest_eN: # <<<<<<<<<<<<<<
18219  * found_eN = True
18220  * i += 1
18221  */
18222  __pyx_t_7 = ((__pyx_v_nearest_eN0 == __pyx_v_nearest_eN) != 0);
18223  if (__pyx_t_7) {
18224 
18225  /* "mprans/MeshSmoothing.pyx":1229
18226  * nearest_eN = eN_
18227  * if nearest_eN0 == nearest_eN:
18228  * found_eN = True # <<<<<<<<<<<<<<
18229  * i += 1
18230  * return nearest_eN
18231  */
18232  __pyx_v_found_eN = 1;
18233 
18234  /* "mprans/MeshSmoothing.pyx":1228
18235  * min_dist = dist
18236  * nearest_eN = eN_
18237  * if nearest_eN0 == nearest_eN: # <<<<<<<<<<<<<<
18238  * found_eN = True
18239  * i += 1
18240  */
18241  }
18242 
18243  /* "mprans/MeshSmoothing.pyx":1230
18244  * if nearest_eN0 == nearest_eN:
18245  * found_eN = True
18246  * i += 1 # <<<<<<<<<<<<<<
18247  * return nearest_eN
18248  *
18249  */
18250  __pyx_v_i = (__pyx_v_i + 1);
18251  }
18252 
18253  /* "mprans/MeshSmoothing.pyx":1231
18254  * found_eN = True
18255  * i += 1
18256  * return nearest_eN # <<<<<<<<<<<<<<
18257  *
18258  * cdef int[:] pyxGetLocalNearestElementIntersection(double[:] coords,
18259  */
18260  __pyx_r = __pyx_v_nearest_eN;
18261  goto __pyx_L0;
18262 
18263  /* "mprans/MeshSmoothing.pyx":1192
18264  *
18265  *
18266  * cdef int pyxGetLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
18267  * double[:,:] elementBarycentersArray,
18268  * int[:,:] elementNeighborsArray,
18269  */
18270 
18271  /* function exit code */
18272  __pyx_L0:;
18273  __Pyx_RefNannyFinishContext();
18274  return __pyx_r;
18275 }
18276 
18277 /* "mprans/MeshSmoothing.pyx":1233
18278  * return nearest_eN
18279  *
18280  * cdef int[:] pyxGetLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
18281  * double[:] starting_coords,
18282  * double[:,:,:] elementBoundaryNormalsArray,
18283  */
18284 
18285 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_starting_coords, __Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBoundaryElementsArray, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_exteriorElementBoundariesBoolArray, int __pyx_v_eN) {
18286  int __pyx_v_result[2];
18287  double __pyx_v_eN_coords[3];
18288  double __pyx_v_min_dist;
18289  double __pyx_v_direction[3];
18290  int __pyx_v_maxit;
18291  int __pyx_v_nEbn;
18292  int __pyx_v_nearest_eN;
18293  int __pyx_v_nearest_eN0;
18294  bool __pyx_v_found_eN;
18295  int __pyx_v_i;
18296  __Pyx_memviewslice __pyx_v_bound_bar = { 0, 0, { 0 }, { 0 }, { 0 } };
18297  double __pyx_v_alpha;
18298  int __pyx_v_b_i;
18299  int __pyx_v_b_i_last;
18300  __Pyx_memviewslice __pyx_v_normal = { 0, 0, { 0 }, { 0 }, { 0 } };
18301  double __pyx_v_dot;
18302  double __pyx_v_dot2;
18303  int __pyx_v_it;
18304  int __pyx_v_eN_;
18305  int __pyx_v_j;
18306  int __pyx_v_k;
18307  double __pyx_v_alpha_min;
18308  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
18309  __Pyx_RefNannyDeclarations
18310  Py_ssize_t __pyx_t_1;
18311  Py_ssize_t __pyx_t_2;
18312  Py_ssize_t __pyx_t_3;
18313  Py_ssize_t __pyx_t_4;
18314  Py_ssize_t __pyx_t_5;
18315  Py_ssize_t __pyx_t_6;
18316  int __pyx_t_7;
18317  int __pyx_t_8;
18318  int __pyx_t_9;
18319  int __pyx_t_10;
18320  int __pyx_t_11;
18321  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
18322  int __pyx_t_13;
18323  long __pyx_t_14;
18324  PyObject *__pyx_t_15 = NULL;
18325  PyObject *__pyx_t_16 = NULL;
18326  PyObject *__pyx_t_17 = NULL;
18327  struct __pyx_array_obj *__pyx_t_18 = NULL;
18328  __Pyx_memviewslice __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
18329  int __pyx_lineno = 0;
18330  const char *__pyx_filename = NULL;
18331  int __pyx_clineno = 0;
18332  __Pyx_RefNannySetupContext("pyxGetLocalNearestElementIntersection", 0);
18333 
18334  /* "mprans/MeshSmoothing.pyx":1244
18335  * cdef int[2] result
18336  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
18337  * result[0] = -1 # <<<<<<<<<<<<<<
18338  * result[1] = -1
18339  * cdef double[3] eN_coords
18340  */
18341  (__pyx_v_result[0]) = -1;
18342 
18343  /* "mprans/MeshSmoothing.pyx":1245
18344  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
18345  * result[0] = -1
18346  * result[1] = -1 # <<<<<<<<<<<<<<
18347  * cdef double[3] eN_coords
18348  * eN_coords[0] = starting_coords[0]
18349  */
18350  (__pyx_v_result[1]) = -1;
18351 
18352  /* "mprans/MeshSmoothing.pyx":1247
18353  * result[1] = -1
18354  * cdef double[3] eN_coords
18355  * eN_coords[0] = starting_coords[0] # <<<<<<<<<<<<<<
18356  * eN_coords[1] = starting_coords[1]
18357  * eN_coords[2] = starting_coords[2]
18358  */
18359  __pyx_t_1 = 0;
18360  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_starting_coords.shape[0];
18361  (__pyx_v_eN_coords[0]) = (*((double *) ( /* dim=0 */ (__pyx_v_starting_coords.data + __pyx_t_1 * __pyx_v_starting_coords.strides[0]) )));
18362 
18363  /* "mprans/MeshSmoothing.pyx":1248
18364  * cdef double[3] eN_coords
18365  * eN_coords[0] = starting_coords[0]
18366  * eN_coords[1] = starting_coords[1] # <<<<<<<<<<<<<<
18367  * eN_coords[2] = starting_coords[2]
18368  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18369  */
18370  __pyx_t_1 = 1;
18371  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_starting_coords.shape[0];
18372  (__pyx_v_eN_coords[1]) = (*((double *) ( /* dim=0 */ (__pyx_v_starting_coords.data + __pyx_t_1 * __pyx_v_starting_coords.strides[0]) )));
18373 
18374  /* "mprans/MeshSmoothing.pyx":1249
18375  * eN_coords[0] = starting_coords[0]
18376  * eN_coords[1] = starting_coords[1]
18377  * eN_coords[2] = starting_coords[2] # <<<<<<<<<<<<<<
18378  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18379  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18380  */
18381  __pyx_t_1 = 2;
18382  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_starting_coords.shape[0];
18383  (__pyx_v_eN_coords[2]) = (*((double *) ( /* dim=0 */ (__pyx_v_starting_coords.data + __pyx_t_1 * __pyx_v_starting_coords.strides[0]) )));
18384 
18385  /* "mprans/MeshSmoothing.pyx":1250
18386  * eN_coords[1] = starting_coords[1]
18387  * eN_coords[2] = starting_coords[2]
18388  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18389  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18390  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18391  */
18392  __pyx_t_1 = 0;
18393  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_coords.shape[0];
18394  __pyx_t_2 = 0;
18395  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coords.shape[0];
18396 
18397  /* "mprans/MeshSmoothing.pyx":1251
18398  * eN_coords[2] = starting_coords[2]
18399  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18400  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
18401  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18402  * cdef double[3] direction
18403  */
18404  __pyx_t_3 = 1;
18405  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_coords.shape[0];
18406  __pyx_t_4 = 1;
18407  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_coords.shape[0];
18408 
18409  /* "mprans/MeshSmoothing.pyx":1252
18410  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
18411  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18412  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])) # <<<<<<<<<<<<<<
18413  * cdef double[3] direction
18414  * direction[0] = (coords[0]-eN_coords[0])/min_dist
18415  */
18416  __pyx_t_5 = 2;
18417  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_coords.shape[0];
18418  __pyx_t_6 = 2;
18419  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18420 
18421  /* "mprans/MeshSmoothing.pyx":1250
18422  * eN_coords[1] = starting_coords[1]
18423  * eN_coords[2] = starting_coords[2]
18424  * cdef double min_dist = sqrt((eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
18425  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
18426  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18427  */
18428  __pyx_v_min_dist = sqrt((((((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_1 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[0]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_2 * __pyx_v_coords.strides[0]) ))))) + (((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_3 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[1]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_4 * __pyx_v_coords.strides[0]) )))))) + (((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_5 * __pyx_v_coords.strides[0]) )))) * ((__pyx_v_eN_coords[2]) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) )))))));
18429 
18430  /* "mprans/MeshSmoothing.pyx":1254
18431  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]))
18432  * cdef double[3] direction
18433  * direction[0] = (coords[0]-eN_coords[0])/min_dist # <<<<<<<<<<<<<<
18434  * direction[1] = (coords[1]-eN_coords[1])/min_dist
18435  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18436  */
18437  __pyx_t_6 = 0;
18438  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18439  (__pyx_v_direction[0]) = (((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) ))) - (__pyx_v_eN_coords[0])) / __pyx_v_min_dist);
18440 
18441  /* "mprans/MeshSmoothing.pyx":1255
18442  * cdef double[3] direction
18443  * direction[0] = (coords[0]-eN_coords[0])/min_dist
18444  * direction[1] = (coords[1]-eN_coords[1])/min_dist # <<<<<<<<<<<<<<
18445  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18446  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18447  */
18448  __pyx_t_6 = 1;
18449  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18450  (__pyx_v_direction[1]) = (((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) ))) - (__pyx_v_eN_coords[1])) / __pyx_v_min_dist);
18451 
18452  /* "mprans/MeshSmoothing.pyx":1256
18453  * direction[0] = (coords[0]-eN_coords[0])/min_dist
18454  * direction[1] = (coords[1]-eN_coords[1])/min_dist
18455  * direction[2] = (coords[2]-eN_coords[2])/min_dist # <<<<<<<<<<<<<<
18456  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18457  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18458  */
18459  __pyx_t_6 = 2;
18460  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
18461  (__pyx_v_direction[2]) = (((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) ))) - (__pyx_v_eN_coords[2])) / __pyx_v_min_dist);
18462 
18463  /* "mprans/MeshSmoothing.pyx":1257
18464  * direction[1] = (coords[1]-eN_coords[1])/min_dist
18465  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18466  * cdef int maxit = 5*elementBoundariesArray.shape[0] # <<<<<<<<<<<<<<
18467  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18468  * cdef int nearest_eN = eN
18469  */
18470  __pyx_v_maxit = (5 * (__pyx_v_elementBoundariesArray.shape[0]));
18471 
18472  /* "mprans/MeshSmoothing.pyx":1258
18473  * direction[2] = (coords[2]-eN_coords[2])/min_dist
18474  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18475  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element # <<<<<<<<<<<<<<
18476  * cdef int nearest_eN = eN
18477  * cdef int nearest_eN0 = eN
18478  */
18479  __pyx_v_nEbn = (__pyx_v_elementBoundariesArray.shape[1]);
18480 
18481  /* "mprans/MeshSmoothing.pyx":1259
18482  * cdef int maxit = 5*elementBoundariesArray.shape[0]
18483  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18484  * cdef int nearest_eN = eN # <<<<<<<<<<<<<<
18485  * cdef int nearest_eN0 = eN
18486  * cdef int nOffsets
18487  */
18488  __pyx_v_nearest_eN = __pyx_v_eN;
18489 
18490  /* "mprans/MeshSmoothing.pyx":1260
18491  * cdef int nEbn = elementBoundariesArray.shape[1] # nb boundaries per element
18492  * cdef int nearest_eN = eN
18493  * cdef int nearest_eN0 = eN # <<<<<<<<<<<<<<
18494  * cdef int nOffsets
18495  * cdef double dist
18496  */
18497  __pyx_v_nearest_eN0 = __pyx_v_eN;
18498 
18499  /* "mprans/MeshSmoothing.pyx":1263
18500  * cdef int nOffsets
18501  * cdef double dist
18502  * cdef bool found_eN = False # <<<<<<<<<<<<<<
18503  * cdef int i = 0
18504  * cdef double[:] bound_bar # barycenter of boundary
18505  */
18506  __pyx_v_found_eN = 0;
18507 
18508  /* "mprans/MeshSmoothing.pyx":1264
18509  * cdef double dist
18510  * cdef bool found_eN = False
18511  * cdef int i = 0 # <<<<<<<<<<<<<<
18512  * cdef double[:] bound_bar # barycenter of boundary
18513  * cdef double alpha # distance
18514  */
18515  __pyx_v_i = 0;
18516 
18517  /* "mprans/MeshSmoothing.pyx":1268
18518  * cdef double alpha # distance
18519  * cdef int b_i # boundary index element
18520  * cdef int b_i_last = -1 # <<<<<<<<<<<<<<
18521  * cdef double[:] normal # element boundary normal
18522  * cdef double dot # dot product result
18523  */
18524  __pyx_v_b_i_last = -1;
18525 
18526  /* "mprans/MeshSmoothing.pyx":1272
18527  * cdef double dot # dot product result
18528  * cdef double dot2 # dot product 2 result
18529  * cdef int it = 0 # <<<<<<<<<<<<<<
18530  * cdef int eN_
18531  * cdef int j
18532  */
18533  __pyx_v_it = 0;
18534 
18535  /* "mprans/MeshSmoothing.pyx":1276
18536  * cdef int j
18537  * cdef int k
18538  * while found_eN is False and it < maxit: # <<<<<<<<<<<<<<
18539  * nearest_eN0 = nearest_eN
18540  * alpha_min = 1e12
18541  */
18542  while (1) {
18543  __pyx_t_8 = ((__pyx_v_found_eN == 0) != 0);
18544  if (__pyx_t_8) {
18545  } else {
18546  __pyx_t_7 = __pyx_t_8;
18547  goto __pyx_L5_bool_binop_done;
18548  }
18549  __pyx_t_8 = ((__pyx_v_it < __pyx_v_maxit) != 0);
18550  __pyx_t_7 = __pyx_t_8;
18551  __pyx_L5_bool_binop_done:;
18552  if (!__pyx_t_7) break;
18553 
18554  /* "mprans/MeshSmoothing.pyx":1277
18555  * cdef int k
18556  * while found_eN is False and it < maxit:
18557  * nearest_eN0 = nearest_eN # <<<<<<<<<<<<<<
18558  * alpha_min = 1e12
18559  * for j in range(nEbn):
18560  */
18561  __pyx_v_nearest_eN0 = __pyx_v_nearest_eN;
18562 
18563  /* "mprans/MeshSmoothing.pyx":1278
18564  * while found_eN is False and it < maxit:
18565  * nearest_eN0 = nearest_eN
18566  * alpha_min = 1e12 # <<<<<<<<<<<<<<
18567  * for j in range(nEbn):
18568  * b_i = elementBoundariesArray[nearest_eN0, j]
18569  */
18570  __pyx_v_alpha_min = 1e12;
18571 
18572  /* "mprans/MeshSmoothing.pyx":1279
18573  * nearest_eN0 = nearest_eN
18574  * alpha_min = 1e12
18575  * for j in range(nEbn): # <<<<<<<<<<<<<<
18576  * b_i = elementBoundariesArray[nearest_eN0, j]
18577  * # if b_i != b_i_last:
18578  */
18579  __pyx_t_9 = __pyx_v_nEbn;
18580  __pyx_t_10 = __pyx_t_9;
18581  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
18582  __pyx_v_j = __pyx_t_11;
18583 
18584  /* "mprans/MeshSmoothing.pyx":1280
18585  * alpha_min = 1e12
18586  * for j in range(nEbn):
18587  * b_i = elementBoundariesArray[nearest_eN0, j] # <<<<<<<<<<<<<<
18588  * # if b_i != b_i_last:
18589  * normal = elementBoundaryNormalsArray[nearest_eN0, j]
18590  */
18591  __pyx_t_6 = __pyx_v_nearest_eN0;
18592  __pyx_t_5 = __pyx_v_j;
18593  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[0];
18594  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[1];
18595  __pyx_v_b_i = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[1]) )));
18596 
18597  /* "mprans/MeshSmoothing.pyx":1282
18598  * b_i = elementBoundariesArray[nearest_eN0, j]
18599  * # if b_i != b_i_last:
18600  * normal = elementBoundaryNormalsArray[nearest_eN0, j] # <<<<<<<<<<<<<<
18601  * bound_bar = elementBoundaryBarycentersArray[b_i]
18602  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18603  */
18604  __pyx_t_12.data = __pyx_v_elementBoundaryNormalsArray.data;
18605  __pyx_t_12.memview = __pyx_v_elementBoundaryNormalsArray.memview;
18606  __PYX_INC_MEMVIEW(&__pyx_t_12, 0);
18607  {
18608  Py_ssize_t __pyx_tmp_idx = __pyx_v_nearest_eN0;
18609  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBoundaryNormalsArray.shape[0];
18610  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBoundaryNormalsArray.strides[0];
18611  if (__pyx_tmp_idx < 0)
18612  __pyx_tmp_idx += __pyx_tmp_shape;
18613  __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
18614 }
18615 
18616 {
18617  Py_ssize_t __pyx_tmp_idx = __pyx_v_j;
18618  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBoundaryNormalsArray.shape[1];
18619  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBoundaryNormalsArray.strides[1];
18620  if (__pyx_tmp_idx < 0)
18621  __pyx_tmp_idx += __pyx_tmp_shape;
18622  __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
18623 }
18624 
18625 __pyx_t_12.shape[0] = __pyx_v_elementBoundaryNormalsArray.shape[2];
18626 __pyx_t_12.strides[0] = __pyx_v_elementBoundaryNormalsArray.strides[2];
18627  __pyx_t_12.suboffsets[0] = -1;
18628 
18629 __PYX_XDEC_MEMVIEW(&__pyx_v_normal, 1);
18630  __pyx_v_normal = __pyx_t_12;
18631  __pyx_t_12.memview = NULL;
18632  __pyx_t_12.data = NULL;
18633 
18634  /* "mprans/MeshSmoothing.pyx":1283
18635  * # if b_i != b_i_last:
18636  * normal = elementBoundaryNormalsArray[nearest_eN0, j]
18637  * bound_bar = elementBoundaryBarycentersArray[b_i] # <<<<<<<<<<<<<<
18638  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18639  * if dot > 0.:
18640  */
18641  __pyx_t_12.data = __pyx_v_elementBoundaryBarycentersArray.data;
18642  __pyx_t_12.memview = __pyx_v_elementBoundaryBarycentersArray.memview;
18643  __PYX_INC_MEMVIEW(&__pyx_t_12, 0);
18644  {
18645  Py_ssize_t __pyx_tmp_idx = __pyx_v_b_i;
18646  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBoundaryBarycentersArray.shape[0];
18647  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBoundaryBarycentersArray.strides[0];
18648  if (__pyx_tmp_idx < 0)
18649  __pyx_tmp_idx += __pyx_tmp_shape;
18650  __pyx_t_12.data += __pyx_tmp_idx * __pyx_tmp_stride;
18651 }
18652 
18653 __pyx_t_12.shape[0] = __pyx_v_elementBoundaryBarycentersArray.shape[1];
18654 __pyx_t_12.strides[0] = __pyx_v_elementBoundaryBarycentersArray.strides[1];
18655  __pyx_t_12.suboffsets[0] = -1;
18656 
18657 __PYX_XDEC_MEMVIEW(&__pyx_v_bound_bar, 1);
18658  __pyx_v_bound_bar = __pyx_t_12;
18659  __pyx_t_12.memview = NULL;
18660  __pyx_t_12.data = NULL;
18661 
18662  /* "mprans/MeshSmoothing.pyx":1284
18663  * normal = elementBoundaryNormalsArray[nearest_eN0, j]
18664  * bound_bar = elementBoundaryBarycentersArray[b_i]
18665  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2] # <<<<<<<<<<<<<<
18666  * if dot > 0.:
18667  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18668  */
18669  __pyx_t_5 = 0;
18670  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_normal.shape[0];
18671  __pyx_t_6 = 1;
18672  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_normal.shape[0];
18673  __pyx_t_4 = 2;
18674  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_normal.shape[0];
18675  __pyx_v_dot = ((((*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_5 * __pyx_v_normal.strides[0]) ))) * (__pyx_v_direction[0])) + ((*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_6 * __pyx_v_normal.strides[0]) ))) * (__pyx_v_direction[1]))) + ((*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_4 * __pyx_v_normal.strides[0]) ))) * (__pyx_v_direction[2])));
18676 
18677  /* "mprans/MeshSmoothing.pyx":1285
18678  * bound_bar = elementBoundaryBarycentersArray[b_i]
18679  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18680  * if dot > 0.: # <<<<<<<<<<<<<<
18681  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18682  * if dot2 >= 0.:
18683  */
18684  __pyx_t_7 = ((__pyx_v_dot > 0.) != 0);
18685  if (__pyx_t_7) {
18686 
18687  /* "mprans/MeshSmoothing.pyx":1286
18688  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18689  * if dot > 0.:
18690  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2] # <<<<<<<<<<<<<<
18691  * if dot2 >= 0.:
18692  * alpha = dot2/dot
18693  */
18694  __pyx_t_4 = 0;
18695  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_bound_bar.shape[0];
18696  __pyx_t_6 = 0;
18697  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_normal.shape[0];
18698  __pyx_t_5 = 1;
18699  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_bound_bar.shape[0];
18700  __pyx_t_3 = 1;
18701  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_normal.shape[0];
18702  __pyx_t_2 = 2;
18703  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_bound_bar.shape[0];
18704  __pyx_t_1 = 2;
18705  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_normal.shape[0];
18706  __pyx_v_dot2 = (((((*((double *) ( /* dim=0 */ (__pyx_v_bound_bar.data + __pyx_t_4 * __pyx_v_bound_bar.strides[0]) ))) - (__pyx_v_eN_coords[0])) * (*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_6 * __pyx_v_normal.strides[0]) )))) + (((*((double *) ( /* dim=0 */ (__pyx_v_bound_bar.data + __pyx_t_5 * __pyx_v_bound_bar.strides[0]) ))) - (__pyx_v_eN_coords[1])) * (*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_3 * __pyx_v_normal.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_bound_bar.data + __pyx_t_2 * __pyx_v_bound_bar.strides[0]) ))) - (__pyx_v_eN_coords[2])) * (*((double *) ( /* dim=0 */ (__pyx_v_normal.data + __pyx_t_1 * __pyx_v_normal.strides[0]) )))));
18707 
18708  /* "mprans/MeshSmoothing.pyx":1287
18709  * if dot > 0.:
18710  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18711  * if dot2 >= 0.: # <<<<<<<<<<<<<<
18712  * alpha = dot2/dot
18713  * if 0. <= alpha < alpha_min:
18714  */
18715  __pyx_t_7 = ((__pyx_v_dot2 >= 0.) != 0);
18716  if (__pyx_t_7) {
18717 
18718  /* "mprans/MeshSmoothing.pyx":1288
18719  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18720  * if dot2 >= 0.:
18721  * alpha = dot2/dot # <<<<<<<<<<<<<<
18722  * if 0. <= alpha < alpha_min:
18723  * alpha_min = alpha
18724  */
18725  __pyx_v_alpha = (__pyx_v_dot2 / __pyx_v_dot);
18726 
18727  /* "mprans/MeshSmoothing.pyx":1289
18728  * if dot2 >= 0.:
18729  * alpha = dot2/dot
18730  * if 0. <= alpha < alpha_min: # <<<<<<<<<<<<<<
18731  * alpha_min = alpha
18732  * for k in range(2):
18733  */
18734  __pyx_t_7 = (0. <= __pyx_v_alpha);
18735  if (__pyx_t_7) {
18736  __pyx_t_7 = (__pyx_v_alpha < __pyx_v_alpha_min);
18737  }
18738  __pyx_t_8 = (__pyx_t_7 != 0);
18739  if (__pyx_t_8) {
18740 
18741  /* "mprans/MeshSmoothing.pyx":1290
18742  * alpha = dot2/dot
18743  * if 0. <= alpha < alpha_min:
18744  * alpha_min = alpha # <<<<<<<<<<<<<<
18745  * for k in range(2):
18746  * eN_ = elementBoundaryElementsArray[b_i, k]
18747  */
18748  __pyx_v_alpha_min = __pyx_v_alpha;
18749 
18750  /* "mprans/MeshSmoothing.pyx":1291
18751  * if 0. <= alpha < alpha_min:
18752  * alpha_min = alpha
18753  * for k in range(2): # <<<<<<<<<<<<<<
18754  * eN_ = elementBoundaryElementsArray[b_i, k]
18755  * if eN_ != nearest_eN0:
18756  */
18757  for (__pyx_t_13 = 0; __pyx_t_13 < 2; __pyx_t_13+=1) {
18758  __pyx_v_k = __pyx_t_13;
18759 
18760  /* "mprans/MeshSmoothing.pyx":1292
18761  * alpha_min = alpha
18762  * for k in range(2):
18763  * eN_ = elementBoundaryElementsArray[b_i, k] # <<<<<<<<<<<<<<
18764  * if eN_ != nearest_eN0:
18765  * nearest_eN = eN_
18766  */
18767  __pyx_t_1 = __pyx_v_b_i;
18768  __pyx_t_2 = __pyx_v_k;
18769  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_elementBoundaryElementsArray.shape[0];
18770  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_elementBoundaryElementsArray.shape[1];
18771  __pyx_v_eN_ = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryElementsArray.data + __pyx_t_1 * __pyx_v_elementBoundaryElementsArray.strides[0]) ) + __pyx_t_2 * __pyx_v_elementBoundaryElementsArray.strides[1]) )));
18772 
18773  /* "mprans/MeshSmoothing.pyx":1293
18774  * for k in range(2):
18775  * eN_ = elementBoundaryElementsArray[b_i, k]
18776  * if eN_ != nearest_eN0: # <<<<<<<<<<<<<<
18777  * nearest_eN = eN_
18778  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18779  */
18780  __pyx_t_8 = ((__pyx_v_eN_ != __pyx_v_nearest_eN0) != 0);
18781  if (__pyx_t_8) {
18782 
18783  /* "mprans/MeshSmoothing.pyx":1294
18784  * eN_ = elementBoundaryElementsArray[b_i, k]
18785  * if eN_ != nearest_eN0:
18786  * nearest_eN = eN_ # <<<<<<<<<<<<<<
18787  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18788  * b_i_last = b_i
18789  */
18790  __pyx_v_nearest_eN = __pyx_v_eN_;
18791 
18792  /* "mprans/MeshSmoothing.pyx":1293
18793  * for k in range(2):
18794  * eN_ = elementBoundaryElementsArray[b_i, k]
18795  * if eN_ != nearest_eN0: # <<<<<<<<<<<<<<
18796  * nearest_eN = eN_
18797  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18798  */
18799  }
18800  }
18801 
18802  /* "mprans/MeshSmoothing.pyx":1296
18803  * nearest_eN = eN_
18804  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18805  * b_i_last = b_i # <<<<<<<<<<<<<<
18806  * if nearest_eN != nearest_eN0:
18807  * if min_dist-alpha_min >=0:
18808  */
18809  __pyx_v_b_i_last = __pyx_v_b_i;
18810 
18811  /* "mprans/MeshSmoothing.pyx":1289
18812  * if dot2 >= 0.:
18813  * alpha = dot2/dot
18814  * if 0. <= alpha < alpha_min: # <<<<<<<<<<<<<<
18815  * alpha_min = alpha
18816  * for k in range(2):
18817  */
18818  }
18819 
18820  /* "mprans/MeshSmoothing.pyx":1287
18821  * if dot > 0.:
18822  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18823  * if dot2 >= 0.: # <<<<<<<<<<<<<<
18824  * alpha = dot2/dot
18825  * if 0. <= alpha < alpha_min:
18826  */
18827  }
18828 
18829  /* "mprans/MeshSmoothing.pyx":1285
18830  * bound_bar = elementBoundaryBarycentersArray[b_i]
18831  * dot = normal[0]*direction[0]+normal[1]*direction[1]+normal[2]*direction[2]
18832  * if dot > 0.: # <<<<<<<<<<<<<<
18833  * dot2 = (bound_bar[0]-eN_coords[0])*normal[0]+(bound_bar[1]-eN_coords[1])*normal[1]+(bound_bar[2]-eN_coords[2])*normal[2]
18834  * if dot2 >= 0.:
18835  */
18836  }
18837  }
18838 
18839  /* "mprans/MeshSmoothing.pyx":1297
18840  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18841  * b_i_last = b_i
18842  * if nearest_eN != nearest_eN0: # <<<<<<<<<<<<<<
18843  * if min_dist-alpha_min >=0:
18844  * eN_coords[0] += alpha_min*direction[0]
18845  */
18846  __pyx_t_8 = ((__pyx_v_nearest_eN != __pyx_v_nearest_eN0) != 0);
18847  if (__pyx_t_8) {
18848 
18849  /* "mprans/MeshSmoothing.pyx":1298
18850  * b_i_last = b_i
18851  * if nearest_eN != nearest_eN0:
18852  * if min_dist-alpha_min >=0: # <<<<<<<<<<<<<<
18853  * eN_coords[0] += alpha_min*direction[0]
18854  * eN_coords[1] += alpha_min*direction[1]
18855  */
18856  __pyx_t_8 = (((__pyx_v_min_dist - __pyx_v_alpha_min) >= 0.0) != 0);
18857  if (__pyx_t_8) {
18858 
18859  /* "mprans/MeshSmoothing.pyx":1299
18860  * if nearest_eN != nearest_eN0:
18861  * if min_dist-alpha_min >=0:
18862  * eN_coords[0] += alpha_min*direction[0] # <<<<<<<<<<<<<<
18863  * eN_coords[1] += alpha_min*direction[1]
18864  * eN_coords[2] += alpha_min*direction[2]
18865  */
18866  __pyx_t_14 = 0;
18867  (__pyx_v_eN_coords[__pyx_t_14]) = ((__pyx_v_eN_coords[__pyx_t_14]) + (__pyx_v_alpha_min * (__pyx_v_direction[0])));
18868 
18869  /* "mprans/MeshSmoothing.pyx":1300
18870  * if min_dist-alpha_min >=0:
18871  * eN_coords[0] += alpha_min*direction[0]
18872  * eN_coords[1] += alpha_min*direction[1] # <<<<<<<<<<<<<<
18873  * eN_coords[2] += alpha_min*direction[2]
18874  * min_dist -= alpha_min
18875  */
18876  __pyx_t_14 = 1;
18877  (__pyx_v_eN_coords[__pyx_t_14]) = ((__pyx_v_eN_coords[__pyx_t_14]) + (__pyx_v_alpha_min * (__pyx_v_direction[1])));
18878 
18879  /* "mprans/MeshSmoothing.pyx":1301
18880  * eN_coords[0] += alpha_min*direction[0]
18881  * eN_coords[1] += alpha_min*direction[1]
18882  * eN_coords[2] += alpha_min*direction[2] # <<<<<<<<<<<<<<
18883  * min_dist -= alpha_min
18884  * else: # going too far
18885  */
18886  __pyx_t_14 = 2;
18887  (__pyx_v_eN_coords[__pyx_t_14]) = ((__pyx_v_eN_coords[__pyx_t_14]) + (__pyx_v_alpha_min * (__pyx_v_direction[2])));
18888 
18889  /* "mprans/MeshSmoothing.pyx":1302
18890  * eN_coords[1] += alpha_min*direction[1]
18891  * eN_coords[2] += alpha_min*direction[2]
18892  * min_dist -= alpha_min # <<<<<<<<<<<<<<
18893  * else: # going too far
18894  * nearest_eN = nearest_eN0
18895  */
18896  __pyx_v_min_dist = (__pyx_v_min_dist - __pyx_v_alpha_min);
18897 
18898  /* "mprans/MeshSmoothing.pyx":1298
18899  * b_i_last = b_i
18900  * if nearest_eN != nearest_eN0:
18901  * if min_dist-alpha_min >=0: # <<<<<<<<<<<<<<
18902  * eN_coords[0] += alpha_min*direction[0]
18903  * eN_coords[1] += alpha_min*direction[1]
18904  */
18905  goto __pyx_L16;
18906  }
18907 
18908  /* "mprans/MeshSmoothing.pyx":1304
18909  * min_dist -= alpha_min
18910  * else: # going too far
18911  * nearest_eN = nearest_eN0 # <<<<<<<<<<<<<<
18912  * if nearest_eN0 == nearest_eN or nearest_eN == -1:
18913  * found_eN = True
18914  */
18915  /*else*/ {
18916  __pyx_v_nearest_eN = __pyx_v_nearest_eN0;
18917  }
18918  __pyx_L16:;
18919 
18920  /* "mprans/MeshSmoothing.pyx":1297
18921  * # nearest_eN = elementBoundaryElementsArray[nearest_eN0]
18922  * b_i_last = b_i
18923  * if nearest_eN != nearest_eN0: # <<<<<<<<<<<<<<
18924  * if min_dist-alpha_min >=0:
18925  * eN_coords[0] += alpha_min*direction[0]
18926  */
18927  }
18928 
18929  /* "mprans/MeshSmoothing.pyx":1305
18930  * else: # going too far
18931  * nearest_eN = nearest_eN0
18932  * if nearest_eN0 == nearest_eN or nearest_eN == -1: # <<<<<<<<<<<<<<
18933  * found_eN = True
18934  * i += 1
18935  */
18936  __pyx_t_7 = ((__pyx_v_nearest_eN0 == __pyx_v_nearest_eN) != 0);
18937  if (!__pyx_t_7) {
18938  } else {
18939  __pyx_t_8 = __pyx_t_7;
18940  goto __pyx_L18_bool_binop_done;
18941  }
18942  __pyx_t_7 = ((__pyx_v_nearest_eN == -1L) != 0);
18943  __pyx_t_8 = __pyx_t_7;
18944  __pyx_L18_bool_binop_done:;
18945  if (__pyx_t_8) {
18946 
18947  /* "mprans/MeshSmoothing.pyx":1306
18948  * nearest_eN = nearest_eN0
18949  * if nearest_eN0 == nearest_eN or nearest_eN == -1:
18950  * found_eN = True # <<<<<<<<<<<<<<
18951  * i += 1
18952  * it += 1
18953  */
18954  __pyx_v_found_eN = 1;
18955 
18956  /* "mprans/MeshSmoothing.pyx":1305
18957  * else: # going too far
18958  * nearest_eN = nearest_eN0
18959  * if nearest_eN0 == nearest_eN or nearest_eN == -1: # <<<<<<<<<<<<<<
18960  * found_eN = True
18961  * i += 1
18962  */
18963  }
18964 
18965  /* "mprans/MeshSmoothing.pyx":1307
18966  * if nearest_eN0 == nearest_eN or nearest_eN == -1:
18967  * found_eN = True
18968  * i += 1 # <<<<<<<<<<<<<<
18969  * it += 1
18970  * if it >= maxit:
18971  */
18972  __pyx_v_i = (__pyx_v_i + 1);
18973 
18974  /* "mprans/MeshSmoothing.pyx":1308
18975  * found_eN = True
18976  * i += 1
18977  * it += 1 # <<<<<<<<<<<<<<
18978  * if it >= maxit:
18979  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
18980  */
18981  __pyx_v_it = (__pyx_v_it + 1);
18982  }
18983 
18984  /* "mprans/MeshSmoothing.pyx":1309
18985  * i += 1
18986  * it += 1
18987  * if it >= maxit: # <<<<<<<<<<<<<<
18988  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
18989  * x=coords[0],
18990  */
18991  __pyx_t_8 = ((__pyx_v_it >= __pyx_v_maxit) != 0);
18992  if (__pyx_t_8) {
18993 
18994  /* "mprans/MeshSmoothing.pyx":1310
18995  * it += 1
18996  * if it >= maxit:
18997  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN, # <<<<<<<<<<<<<<
18998  * x=coords[0],
18999  * y=coords[1],
19000  */
19001  #ifndef CYTHON_WITHOUT_ASSERTIONS
19002  if (unlikely(!Py_OptimizeFlag)) {
19003  if (unlikely(!0)) {
19004  __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_could_not_find_element_element_e, __pyx_n_s_format); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1310, __pyx_L1_error)
19005  __Pyx_GOTREF(__pyx_t_15);
19006  __pyx_t_16 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1310, __pyx_L1_error)
19007  __Pyx_GOTREF(__pyx_t_16);
19008  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1310, __pyx_L1_error)
19009  __Pyx_GOTREF(__pyx_t_17);
19010  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_eN, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19011  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19012 
19013  /* "mprans/MeshSmoothing.pyx":1311
19014  * if it >= maxit:
19015  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19016  * x=coords[0], # <<<<<<<<<<<<<<
19017  * y=coords[1],
19018  * z=coords[2],
19019  */
19020  __pyx_t_2 = 0;
19021  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coords.shape[0];
19022  __pyx_t_17 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_2 * __pyx_v_coords.strides[0]) )))); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1311, __pyx_L1_error)
19023  __Pyx_GOTREF(__pyx_t_17);
19024  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_x, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19025  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19026 
19027  /* "mprans/MeshSmoothing.pyx":1312
19028  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19029  * x=coords[0],
19030  * y=coords[1], # <<<<<<<<<<<<<<
19031  * z=coords[2],
19032  * nearest_eN=nearest_eN,
19033  */
19034  __pyx_t_2 = 1;
19035  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coords.shape[0];
19036  __pyx_t_17 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_2 * __pyx_v_coords.strides[0]) )))); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1312, __pyx_L1_error)
19037  __Pyx_GOTREF(__pyx_t_17);
19038  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_y, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19039  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19040 
19041  /* "mprans/MeshSmoothing.pyx":1313
19042  * x=coords[0],
19043  * y=coords[1],
19044  * z=coords[2], # <<<<<<<<<<<<<<
19045  * nearest_eN=nearest_eN,
19046  * x2=eN_coords[0],
19047  */
19048  __pyx_t_2 = 2;
19049  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_coords.shape[0];
19050  __pyx_t_17 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_2 * __pyx_v_coords.strides[0]) )))); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1313, __pyx_L1_error)
19051  __Pyx_GOTREF(__pyx_t_17);
19052  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_z, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19053  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19054 
19055  /* "mprans/MeshSmoothing.pyx":1314
19056  * y=coords[1],
19057  * z=coords[2],
19058  * nearest_eN=nearest_eN, # <<<<<<<<<<<<<<
19059  * x2=eN_coords[0],
19060  * y2=eN_coords[1],
19061  */
19062  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_nearest_eN); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1314, __pyx_L1_error)
19063  __Pyx_GOTREF(__pyx_t_17);
19064  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_nearest_eN, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19065  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19066 
19067  /* "mprans/MeshSmoothing.pyx":1315
19068  * z=coords[2],
19069  * nearest_eN=nearest_eN,
19070  * x2=eN_coords[0], # <<<<<<<<<<<<<<
19071  * y2=eN_coords[1],
19072  * z2=eN_coords[2],
19073  */
19074  __pyx_t_17 = PyFloat_FromDouble((__pyx_v_eN_coords[0])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1315, __pyx_L1_error)
19075  __Pyx_GOTREF(__pyx_t_17);
19076  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_x2, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19077  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19078 
19079  /* "mprans/MeshSmoothing.pyx":1316
19080  * nearest_eN=nearest_eN,
19081  * x2=eN_coords[0],
19082  * y2=eN_coords[1], # <<<<<<<<<<<<<<
19083  * z2=eN_coords[2],
19084  * maxit=maxit)
19085  */
19086  __pyx_t_17 = PyFloat_FromDouble((__pyx_v_eN_coords[1])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1316, __pyx_L1_error)
19087  __Pyx_GOTREF(__pyx_t_17);
19088  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_y2, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19089  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19090 
19091  /* "mprans/MeshSmoothing.pyx":1317
19092  * x2=eN_coords[0],
19093  * y2=eN_coords[1],
19094  * z2=eN_coords[2], # <<<<<<<<<<<<<<
19095  * maxit=maxit)
19096  * result[0] = nearest_eN
19097  */
19098  __pyx_t_17 = PyFloat_FromDouble((__pyx_v_eN_coords[2])); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1317, __pyx_L1_error)
19099  __Pyx_GOTREF(__pyx_t_17);
19100  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_z2, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19101  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19102 
19103  /* "mprans/MeshSmoothing.pyx":1318
19104  * y2=eN_coords[1],
19105  * z2=eN_coords[2],
19106  * maxit=maxit) # <<<<<<<<<<<<<<
19107  * result[0] = nearest_eN
19108  * result[1] = b_i_last
19109  */
19110  __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_maxit); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1318, __pyx_L1_error)
19111  __Pyx_GOTREF(__pyx_t_17);
19112  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_maxit, __pyx_t_17) < 0) __PYX_ERR(0, 1310, __pyx_L1_error)
19113  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19114 
19115  /* "mprans/MeshSmoothing.pyx":1310
19116  * it += 1
19117  * if it >= maxit:
19118  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN, # <<<<<<<<<<<<<<
19119  * x=coords[0],
19120  * y=coords[1],
19121  */
19122  __pyx_t_17 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_empty_tuple, __pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1310, __pyx_L1_error)
19123  __Pyx_GOTREF(__pyx_t_17);
19124  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
19125  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
19126  __pyx_t_16 = PyTuple_Pack(1, __pyx_t_17); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1310, __pyx_L1_error)
19127  __Pyx_GOTREF(__pyx_t_16);
19128  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19129  PyErr_SetObject(PyExc_AssertionError, __pyx_t_16);
19130  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
19131  __PYX_ERR(0, 1310, __pyx_L1_error)
19132  }
19133  }
19134  #endif
19135 
19136  /* "mprans/MeshSmoothing.pyx":1309
19137  * i += 1
19138  * it += 1
19139  * if it >= maxit: # <<<<<<<<<<<<<<
19140  * assert 1>2, 'could not find element! (element {eN}: {x}, {y}, {z}), nearest_eN {nearest_eN}: closest coords: {x2}, {y2}, {z2}, after {maxit} iterations'.format(eN=eN,
19141  * x=coords[0],
19142  */
19143  }
19144 
19145  /* "mprans/MeshSmoothing.pyx":1319
19146  * z2=eN_coords[2],
19147  * maxit=maxit)
19148  * result[0] = nearest_eN # <<<<<<<<<<<<<<
19149  * result[1] = b_i_last
19150  * return result
19151  */
19152  (__pyx_v_result[0]) = __pyx_v_nearest_eN;
19153 
19154  /* "mprans/MeshSmoothing.pyx":1320
19155  * maxit=maxit)
19156  * result[0] = nearest_eN
19157  * result[1] = b_i_last # <<<<<<<<<<<<<<
19158  * return result
19159  *
19160  */
19161  (__pyx_v_result[1]) = __pyx_v_b_i_last;
19162 
19163  /* "mprans/MeshSmoothing.pyx":1321
19164  * result[0] = nearest_eN
19165  * result[1] = b_i_last
19166  * return result # <<<<<<<<<<<<<<
19167  *
19168  * cdef int pyxGetLocalNearestElementAroundNode(double[:] coords,
19169  */
19170  __pyx_t_17 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 1321, __pyx_L1_error)
19171  __Pyx_GOTREF(__pyx_t_17);
19172  __pyx_t_16 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)2)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1321, __pyx_L1_error)
19173  __Pyx_GOTREF(__pyx_t_16);
19174  __pyx_t_18 = __pyx_array_new(__pyx_t_16, sizeof(int), PyBytes_AS_STRING(__pyx_t_17), (char *) "fortran", (char *) __pyx_v_result);
19175  if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1321, __pyx_L1_error)
19176  __Pyx_GOTREF(__pyx_t_18);
19177  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
19178  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
19179  __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_t_18), PyBUF_WRITABLE); if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 1321, __pyx_L1_error)
19180  __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
19181  __pyx_r = __pyx_t_19;
19182  __pyx_t_19.memview = NULL;
19183  __pyx_t_19.data = NULL;
19184  goto __pyx_L0;
19185 
19186  /* "mprans/MeshSmoothing.pyx":1233
19187  * return nearest_eN
19188  *
19189  * cdef int[:] pyxGetLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
19190  * double[:] starting_coords,
19191  * double[:,:,:] elementBoundaryNormalsArray,
19192  */
19193 
19194  /* function exit code */
19195  __pyx_L1_error:;
19196  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
19197  __Pyx_XDECREF(__pyx_t_15);
19198  __Pyx_XDECREF(__pyx_t_16);
19199  __Pyx_XDECREF(__pyx_t_17);
19200  __Pyx_XDECREF(((PyObject *)__pyx_t_18));
19201  __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
19202  __pyx_r.data = NULL;
19203  __pyx_r.memview = NULL;
19204  __Pyx_AddTraceback("mprans.MeshSmoothing.pyxGetLocalNearestElementIntersection", __pyx_clineno, __pyx_lineno, __pyx_filename);
19205  goto __pyx_L2;
19206  __pyx_L0:;
19207  if (unlikely(!__pyx_r.memview)) {
19208  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
19209  }
19210  __pyx_L2:;
19211  __PYX_XDEC_MEMVIEW(&__pyx_v_bound_bar, 1);
19212  __PYX_XDEC_MEMVIEW(&__pyx_v_normal, 1);
19213  __Pyx_RefNannyFinishContext();
19214  return __pyx_r;
19215 }
19216 
19217 /* "mprans/MeshSmoothing.pyx":1323
19218  * return result
19219  *
19220  * cdef int pyxGetLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
19221  * int[:] nodeElementOffsets,
19222  * int[:] nodeElementsArray,
19223  */
19224 
19225 static int __pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode(__Pyx_memviewslice __pyx_v_coords, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_node) {
19226  double __pyx_v_dist;
19227  double __pyx_v_min_dist;
19228  __Pyx_memviewslice __pyx_v_eN_coords = { 0, 0, { 0 }, { 0 }, { 0 } };
19229  int __pyx_v_i;
19230  int __pyx_v_eN;
19231  int __pyx_v_iEn;
19232  int __pyx_v_rmin;
19233  int __pyx_v_rmax;
19234  int __pyx_v_nearest_eN;
19235  int __pyx_r;
19236  __Pyx_RefNannyDeclarations
19237  Py_ssize_t __pyx_t_1;
19238  int __pyx_t_2;
19239  int __pyx_t_3;
19240  int __pyx_t_4;
19241  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
19242  Py_ssize_t __pyx_t_6;
19243  Py_ssize_t __pyx_t_7;
19244  Py_ssize_t __pyx_t_8;
19245  Py_ssize_t __pyx_t_9;
19246  Py_ssize_t __pyx_t_10;
19247  Py_ssize_t __pyx_t_11;
19248  Py_ssize_t __pyx_t_12;
19249  Py_ssize_t __pyx_t_13;
19250  Py_ssize_t __pyx_t_14;
19251  Py_ssize_t __pyx_t_15;
19252  Py_ssize_t __pyx_t_16;
19253  int __pyx_t_17;
19254  int __pyx_t_18;
19255  __Pyx_RefNannySetupContext("pyxGetLocalNearestElementAroundNode", 0);
19256 
19257  /* "mprans/MeshSmoothing.pyx":1331
19258  * cdef double min_dist
19259  * cdef double[:] eN_coords
19260  * cdef int i = 0 # <<<<<<<<<<<<<<
19261  * cdef int eN
19262  * cdef int iEn
19263  */
19264  __pyx_v_i = 0;
19265 
19266  /* "mprans/MeshSmoothing.pyx":1334
19267  * cdef int eN
19268  * cdef int iEn
19269  * cdef int rmin = nodeElementOffsets[node] # <<<<<<<<<<<<<<
19270  * cdef int rmax = nodeElementOffsets[node+1]
19271  * for iEn in range(rmin, rmax):
19272  */
19273  __pyx_t_1 = __pyx_v_node;
19274  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeElementOffsets.shape[0];
19275  __pyx_v_rmin = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_1 * __pyx_v_nodeElementOffsets.strides[0]) )));
19276 
19277  /* "mprans/MeshSmoothing.pyx":1335
19278  * cdef int iEn
19279  * cdef int rmin = nodeElementOffsets[node]
19280  * cdef int rmax = nodeElementOffsets[node+1] # <<<<<<<<<<<<<<
19281  * for iEn in range(rmin, rmax):
19282  * eN = nodeElementsArray[iEn]
19283  */
19284  __pyx_t_1 = (__pyx_v_node + 1);
19285  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeElementOffsets.shape[0];
19286  __pyx_v_rmax = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_1 * __pyx_v_nodeElementOffsets.strides[0]) )));
19287 
19288  /* "mprans/MeshSmoothing.pyx":1336
19289  * cdef int rmin = nodeElementOffsets[node]
19290  * cdef int rmax = nodeElementOffsets[node+1]
19291  * for iEn in range(rmin, rmax): # <<<<<<<<<<<<<<
19292  * eN = nodeElementsArray[iEn]
19293  * eN_coords = elementBarycentersArray[eN]
19294  */
19295  __pyx_t_2 = __pyx_v_rmax;
19296  __pyx_t_3 = __pyx_t_2;
19297  for (__pyx_t_4 = __pyx_v_rmin; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19298  __pyx_v_iEn = __pyx_t_4;
19299 
19300  /* "mprans/MeshSmoothing.pyx":1337
19301  * cdef int rmax = nodeElementOffsets[node+1]
19302  * for iEn in range(rmin, rmax):
19303  * eN = nodeElementsArray[iEn] # <<<<<<<<<<<<<<
19304  * eN_coords = elementBarycentersArray[eN]
19305  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19306  */
19307  __pyx_t_1 = __pyx_v_iEn;
19308  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeElementsArray.shape[0];
19309  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_1 * __pyx_v_nodeElementsArray.strides[0]) )));
19310 
19311  /* "mprans/MeshSmoothing.pyx":1338
19312  * for iEn in range(rmin, rmax):
19313  * eN = nodeElementsArray[iEn]
19314  * eN_coords = elementBarycentersArray[eN] # <<<<<<<<<<<<<<
19315  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19316  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19317  */
19318  __pyx_t_5.data = __pyx_v_elementBarycentersArray.data;
19319  __pyx_t_5.memview = __pyx_v_elementBarycentersArray.memview;
19320  __PYX_INC_MEMVIEW(&__pyx_t_5, 0);
19321  {
19322  Py_ssize_t __pyx_tmp_idx = __pyx_v_eN;
19323  Py_ssize_t __pyx_tmp_shape = __pyx_v_elementBarycentersArray.shape[0];
19324  Py_ssize_t __pyx_tmp_stride = __pyx_v_elementBarycentersArray.strides[0];
19325  if (__pyx_tmp_idx < 0)
19326  __pyx_tmp_idx += __pyx_tmp_shape;
19327  __pyx_t_5.data += __pyx_tmp_idx * __pyx_tmp_stride;
19328 }
19329 
19330 __pyx_t_5.shape[0] = __pyx_v_elementBarycentersArray.shape[1];
19331 __pyx_t_5.strides[0] = __pyx_v_elementBarycentersArray.strides[1];
19332  __pyx_t_5.suboffsets[0] = -1;
19333 
19334 __PYX_XDEC_MEMVIEW(&__pyx_v_eN_coords, 1);
19335  __pyx_v_eN_coords = __pyx_t_5;
19336  __pyx_t_5.memview = NULL;
19337  __pyx_t_5.data = NULL;
19338 
19339  /* "mprans/MeshSmoothing.pyx":1339
19340  * eN = nodeElementsArray[iEn]
19341  * eN_coords = elementBarycentersArray[eN]
19342  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\ # <<<<<<<<<<<<<<
19343  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19344  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19345  */
19346  __pyx_t_1 = 0;
19347  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_eN_coords.shape[0];
19348  __pyx_t_6 = 0;
19349  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_coords.shape[0];
19350  __pyx_t_7 = 0;
19351  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_eN_coords.shape[0];
19352  __pyx_t_8 = 0;
19353  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_coords.shape[0];
19354 
19355  /* "mprans/MeshSmoothing.pyx":1340
19356  * eN_coords = elementBarycentersArray[eN]
19357  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19358  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
19359  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19360  * if i == 0 or dist < min_dist:
19361  */
19362  __pyx_t_9 = 1;
19363  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_eN_coords.shape[0];
19364  __pyx_t_10 = 1;
19365  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_coords.shape[0];
19366  __pyx_t_11 = 1;
19367  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_eN_coords.shape[0];
19368  __pyx_t_12 = 1;
19369  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_coords.shape[0];
19370 
19371  /* "mprans/MeshSmoothing.pyx":1341
19372  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19373  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19374  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2]) # <<<<<<<<<<<<<<
19375  * if i == 0 or dist < min_dist:
19376  * min_dist = dist
19377  */
19378  __pyx_t_13 = 2;
19379  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_eN_coords.shape[0];
19380  __pyx_t_14 = 2;
19381  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_coords.shape[0];
19382  __pyx_t_15 = 2;
19383  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_eN_coords.shape[0];
19384  __pyx_t_16 = 2;
19385  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_coords.shape[0];
19386 
19387  /* "mprans/MeshSmoothing.pyx":1340
19388  * eN_coords = elementBarycentersArray[eN]
19389  * dist = (eN_coords[0]-coords[0])*(eN_coords[0]-coords[0])+\
19390  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\ # <<<<<<<<<<<<<<
19391  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19392  * if i == 0 or dist < min_dist:
19393  */
19394  __pyx_v_dist = (((((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_1 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_6 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_7 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_8 * __pyx_v_coords.strides[0]) ))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_9 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_10 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_11 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_12 * __pyx_v_coords.strides[0]) )))))) + (((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_13 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_14 * __pyx_v_coords.strides[0]) )))) * ((*((double *) ( /* dim=0 */ (__pyx_v_eN_coords.data + __pyx_t_15 * __pyx_v_eN_coords.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_coords.data + __pyx_t_16 * __pyx_v_coords.strides[0]) ))))));
19395 
19396  /* "mprans/MeshSmoothing.pyx":1342
19397  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19398  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19399  * if i == 0 or dist < min_dist: # <<<<<<<<<<<<<<
19400  * min_dist = dist
19401  * nearest_eN = eN
19402  */
19403  __pyx_t_18 = ((__pyx_v_i == 0) != 0);
19404  if (!__pyx_t_18) {
19405  } else {
19406  __pyx_t_17 = __pyx_t_18;
19407  goto __pyx_L6_bool_binop_done;
19408  }
19409  __pyx_t_18 = ((__pyx_v_dist < __pyx_v_min_dist) != 0);
19410  __pyx_t_17 = __pyx_t_18;
19411  __pyx_L6_bool_binop_done:;
19412  if (__pyx_t_17) {
19413 
19414  /* "mprans/MeshSmoothing.pyx":1343
19415  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19416  * if i == 0 or dist < min_dist:
19417  * min_dist = dist # <<<<<<<<<<<<<<
19418  * nearest_eN = eN
19419  * i += 1
19420  */
19421  __pyx_v_min_dist = __pyx_v_dist;
19422 
19423  /* "mprans/MeshSmoothing.pyx":1344
19424  * if i == 0 or dist < min_dist:
19425  * min_dist = dist
19426  * nearest_eN = eN # <<<<<<<<<<<<<<
19427  * i += 1
19428  * # determine local nearest node distance
19429  */
19430  __pyx_v_nearest_eN = __pyx_v_eN;
19431 
19432  /* "mprans/MeshSmoothing.pyx":1342
19433  * (eN_coords[1]-coords[1])*(eN_coords[1]-coords[1])+\
19434  * (eN_coords[2]-coords[2])*(eN_coords[2]-coords[2])
19435  * if i == 0 or dist < min_dist: # <<<<<<<<<<<<<<
19436  * min_dist = dist
19437  * nearest_eN = eN
19438  */
19439  }
19440 
19441  /* "mprans/MeshSmoothing.pyx":1345
19442  * min_dist = dist
19443  * nearest_eN = eN
19444  * i += 1 # <<<<<<<<<<<<<<
19445  * # determine local nearest node distance
19446  * return nearest_eN
19447  */
19448  __pyx_v_i = (__pyx_v_i + 1);
19449  }
19450 
19451  /* "mprans/MeshSmoothing.pyx":1347
19452  * i += 1
19453  * # determine local nearest node distance
19454  * return nearest_eN # <<<<<<<<<<<<<<
19455  *
19456  * cdef void pyxUpdateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_,
19457  */
19458  __pyx_r = __pyx_v_nearest_eN;
19459  goto __pyx_L0;
19460 
19461  /* "mprans/MeshSmoothing.pyx":1323
19462  * return result
19463  *
19464  * cdef int pyxGetLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
19465  * int[:] nodeElementOffsets,
19466  * int[:] nodeElementsArray,
19467  */
19468 
19469  /* function exit code */
19470  __pyx_L0:;
19471  __PYX_XDEC_MEMVIEW(&__pyx_v_eN_coords, 1);
19472  __Pyx_RefNannyFinishContext();
19473  return __pyx_r;
19474 }
19475 
19476 /* "mprans/MeshSmoothing.pyx":1349
19477  * return nearest_eN
19478  *
19479  * cdef void pyxUpdateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
19480  * double[:,:] nodeArray,
19481  * int[:,:] elementBoundariesArray,
19482  */
19483 
19484 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra(__Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
19485  double __pyx_v_normal_check[3];
19486  double __pyx_v_U[3];
19487  double __pyx_v_V[3];
19488  int __pyx_v_b_i;
19489  __Pyx_memviewslice __pyx_v_node0 = { 0, 0, { 0 }, { 0 }, { 0 } };
19490  __Pyx_memviewslice __pyx_v_node1 = { 0, 0, { 0 }, { 0 }, { 0 } };
19491  __Pyx_memviewslice __pyx_v_node2 = { 0, 0, { 0 }, { 0 }, { 0 } };
19492  int __pyx_v_i;
19493  int __pyx_v_j;
19494  double __pyx_v_dot;
19495  double __pyx_v_lenghtn;
19496  __Pyx_RefNannyDeclarations
19497  int __pyx_t_1;
19498  int __pyx_t_2;
19499  int __pyx_t_3;
19500  int __pyx_t_4;
19501  Py_ssize_t __pyx_t_5;
19502  Py_ssize_t __pyx_t_6;
19503  Py_ssize_t __pyx_t_7;
19504  Py_ssize_t __pyx_t_8;
19505  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
19506  Py_ssize_t __pyx_t_10;
19507  Py_ssize_t __pyx_t_11;
19508  Py_ssize_t __pyx_t_12;
19509  Py_ssize_t __pyx_t_13;
19510  Py_ssize_t __pyx_t_14;
19511  int __pyx_t_15;
19512  __Pyx_RefNannySetupContext("pyxUpdateElementBoundaryNormalsTetra", 0);
19513 
19514  /* "mprans/MeshSmoothing.pyx":1366
19515  * cdef int j
19516  * cdef double dot
19517  * for i in range(nElements): # <<<<<<<<<<<<<<
19518  * for j in range(4):
19519  * b_i = elementBoundariesArray[i, j]
19520  */
19521  __pyx_t_1 = __pyx_v_nElements;
19522  __pyx_t_2 = __pyx_t_1;
19523  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19524  __pyx_v_i = __pyx_t_3;
19525 
19526  /* "mprans/MeshSmoothing.pyx":1367
19527  * cdef double dot
19528  * for i in range(nElements):
19529  * for j in range(4): # <<<<<<<<<<<<<<
19530  * b_i = elementBoundariesArray[i, j]
19531  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19532  */
19533  for (__pyx_t_4 = 0; __pyx_t_4 < 4; __pyx_t_4+=1) {
19534  __pyx_v_j = __pyx_t_4;
19535 
19536  /* "mprans/MeshSmoothing.pyx":1368
19537  * for i in range(nElements):
19538  * for j in range(4):
19539  * b_i = elementBoundariesArray[i, j] # <<<<<<<<<<<<<<
19540  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19541  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19542  */
19543  __pyx_t_5 = __pyx_v_i;
19544  __pyx_t_6 = __pyx_v_j;
19545  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[0];
19546  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[1];
19547  __pyx_v_b_i = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[1]) )));
19548 
19549  /* "mprans/MeshSmoothing.pyx":1369
19550  * for j in range(4):
19551  * b_i = elementBoundariesArray[i, j]
19552  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]] # <<<<<<<<<<<<<<
19553  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19554  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19555  */
19556  __pyx_t_6 = __pyx_v_i;
19557  __pyx_t_5 = __pyx_v_j;
19558  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[0];
19559  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[1];
19560  __pyx_t_7 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[1]) )));
19561  __pyx_t_8 = 0;
19562  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNodesArray.shape[0];
19563  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNodesArray.shape[1];
19564  __pyx_t_9.data = __pyx_v_nodeArray.data;
19565  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
19566  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
19567  {
19568  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_7 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
19569  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
19570  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
19571  if (__pyx_tmp_idx < 0)
19572  __pyx_tmp_idx += __pyx_tmp_shape;
19573  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
19574 }
19575 
19576 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
19577 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
19578  __pyx_t_9.suboffsets[0] = -1;
19579 
19580 __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
19581  __pyx_v_node0 = __pyx_t_9;
19582  __pyx_t_9.memview = NULL;
19583  __pyx_t_9.data = NULL;
19584 
19585  /* "mprans/MeshSmoothing.pyx":1370
19586  * b_i = elementBoundariesArray[i, j]
19587  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19588  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]] # <<<<<<<<<<<<<<
19589  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19590  * U[0] = node1[0]-node0[0]
19591  */
19592  __pyx_t_5 = __pyx_v_i;
19593  __pyx_t_6 = __pyx_v_j;
19594  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[0];
19595  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[1];
19596  __pyx_t_8 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[1]) )));
19597  __pyx_t_7 = 1;
19598  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNodesArray.shape[0];
19599  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNodesArray.shape[1];
19600  __pyx_t_9.data = __pyx_v_nodeArray.data;
19601  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
19602  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
19603  {
19604  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_8 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
19605  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
19606  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
19607  if (__pyx_tmp_idx < 0)
19608  __pyx_tmp_idx += __pyx_tmp_shape;
19609  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
19610 }
19611 
19612 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
19613 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
19614  __pyx_t_9.suboffsets[0] = -1;
19615 
19616 __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
19617  __pyx_v_node1 = __pyx_t_9;
19618  __pyx_t_9.memview = NULL;
19619  __pyx_t_9.data = NULL;
19620 
19621  /* "mprans/MeshSmoothing.pyx":1371
19622  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
19623  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19624  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]] # <<<<<<<<<<<<<<
19625  * U[0] = node1[0]-node0[0]
19626  * U[1] = node1[1]-node0[1]
19627  */
19628  __pyx_t_6 = __pyx_v_i;
19629  __pyx_t_5 = __pyx_v_j;
19630  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[0];
19631  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[1];
19632  __pyx_t_7 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[1]) )));
19633  __pyx_t_8 = 2;
19634  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNodesArray.shape[0];
19635  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNodesArray.shape[1];
19636  __pyx_t_9.data = __pyx_v_nodeArray.data;
19637  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
19638  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
19639  {
19640  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_7 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
19641  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
19642  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
19643  if (__pyx_tmp_idx < 0)
19644  __pyx_tmp_idx += __pyx_tmp_shape;
19645  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
19646 }
19647 
19648 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
19649 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
19650  __pyx_t_9.suboffsets[0] = -1;
19651 
19652 __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
19653  __pyx_v_node2 = __pyx_t_9;
19654  __pyx_t_9.memview = NULL;
19655  __pyx_t_9.data = NULL;
19656 
19657  /* "mprans/MeshSmoothing.pyx":1372
19658  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
19659  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19660  * U[0] = node1[0]-node0[0] # <<<<<<<<<<<<<<
19661  * U[1] = node1[1]-node0[1]
19662  * U[2] = node1[2]-node0[2]
19663  */
19664  __pyx_t_5 = 0;
19665  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node1.shape[0];
19666  __pyx_t_6 = 0;
19667  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node0.shape[0];
19668  (__pyx_v_U[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_5 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_6 * __pyx_v_node0.strides[0]) ))));
19669 
19670  /* "mprans/MeshSmoothing.pyx":1373
19671  * node2 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],2]]
19672  * U[0] = node1[0]-node0[0]
19673  * U[1] = node1[1]-node0[1] # <<<<<<<<<<<<<<
19674  * U[2] = node1[2]-node0[2]
19675  * V[0] = node2[0]-node0[0]
19676  */
19677  __pyx_t_6 = 1;
19678  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node1.shape[0];
19679  __pyx_t_5 = 1;
19680  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
19681  (__pyx_v_U[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_6 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
19682 
19683  /* "mprans/MeshSmoothing.pyx":1374
19684  * U[0] = node1[0]-node0[0]
19685  * U[1] = node1[1]-node0[1]
19686  * U[2] = node1[2]-node0[2] # <<<<<<<<<<<<<<
19687  * V[0] = node2[0]-node0[0]
19688  * V[1] = node2[1]-node0[1]
19689  */
19690  __pyx_t_5 = 2;
19691  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node1.shape[0];
19692  __pyx_t_6 = 2;
19693  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node0.shape[0];
19694  (__pyx_v_U[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_5 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_6 * __pyx_v_node0.strides[0]) ))));
19695 
19696  /* "mprans/MeshSmoothing.pyx":1375
19697  * U[1] = node1[1]-node0[1]
19698  * U[2] = node1[2]-node0[2]
19699  * V[0] = node2[0]-node0[0] # <<<<<<<<<<<<<<
19700  * V[1] = node2[1]-node0[1]
19701  * V[2] = node2[2]-node0[2]
19702  */
19703  __pyx_t_6 = 0;
19704  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node2.shape[0];
19705  __pyx_t_5 = 0;
19706  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
19707  (__pyx_v_V[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_6 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
19708 
19709  /* "mprans/MeshSmoothing.pyx":1376
19710  * U[2] = node1[2]-node0[2]
19711  * V[0] = node2[0]-node0[0]
19712  * V[1] = node2[1]-node0[1] # <<<<<<<<<<<<<<
19713  * V[2] = node2[2]-node0[2]
19714  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19715  */
19716  __pyx_t_5 = 1;
19717  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node2.shape[0];
19718  __pyx_t_6 = 1;
19719  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node0.shape[0];
19720  (__pyx_v_V[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_5 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_6 * __pyx_v_node0.strides[0]) ))));
19721 
19722  /* "mprans/MeshSmoothing.pyx":1377
19723  * V[0] = node2[0]-node0[0]
19724  * V[1] = node2[1]-node0[1]
19725  * V[2] = node2[2]-node0[2] # <<<<<<<<<<<<<<
19726  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19727  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19728  */
19729  __pyx_t_6 = 2;
19730  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node2.shape[0];
19731  __pyx_t_5 = 2;
19732  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
19733  (__pyx_v_V[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_6 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
19734 
19735  /* "mprans/MeshSmoothing.pyx":1378
19736  * V[1] = node2[1]-node0[1]
19737  * V[2] = node2[2]-node0[2]
19738  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1] # <<<<<<<<<<<<<<
19739  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19740  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19741  */
19742  __pyx_t_5 = __pyx_v_i;
19743  __pyx_t_6 = __pyx_v_j;
19744  __pyx_t_8 = 0;
19745  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19746  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19747  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19748  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (((__pyx_v_U[1]) * (__pyx_v_V[2])) - ((__pyx_v_U[2]) * (__pyx_v_V[1])));
19749 
19750  /* "mprans/MeshSmoothing.pyx":1379
19751  * V[2] = node2[2]-node0[2]
19752  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19753  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2] # <<<<<<<<<<<<<<
19754  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19755  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19756  */
19757  __pyx_t_8 = __pyx_v_i;
19758  __pyx_t_6 = __pyx_v_j;
19759  __pyx_t_5 = 1;
19760  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19761  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19762  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19763  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (((__pyx_v_U[2]) * (__pyx_v_V[0])) - ((__pyx_v_U[0]) * (__pyx_v_V[2])));
19764 
19765  /* "mprans/MeshSmoothing.pyx":1380
19766  * elementBoundaryNormalsArray_[i,j,0] = U[1]*V[2]-U[2]*V[1]
19767  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19768  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0] # <<<<<<<<<<<<<<
19769  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19770  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19771  */
19772  __pyx_t_5 = __pyx_v_i;
19773  __pyx_t_6 = __pyx_v_j;
19774  __pyx_t_8 = 2;
19775  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19776  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19777  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19778  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (((__pyx_v_U[0]) * (__pyx_v_V[1])) - ((__pyx_v_U[1]) * (__pyx_v_V[0])));
19779 
19780  /* "mprans/MeshSmoothing.pyx":1381
19781  * elementBoundaryNormalsArray_[i,j,1] = U[2]*V[0]-U[0]*V[2]
19782  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19783  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2) # <<<<<<<<<<<<<<
19784  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19785  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
19786  */
19787  __pyx_t_8 = __pyx_v_i;
19788  __pyx_t_6 = __pyx_v_j;
19789  __pyx_t_5 = 0;
19790  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19791  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19792  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19793  __pyx_t_7 = __pyx_v_i;
19794  __pyx_t_10 = __pyx_v_j;
19795  __pyx_t_11 = 1;
19796  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19797  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19798  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19799  __pyx_t_12 = __pyx_v_i;
19800  __pyx_t_13 = __pyx_v_j;
19801  __pyx_t_14 = 2;
19802  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19803  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19804  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19805  __pyx_v_lenghtn = sqrt(((pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0) + pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0)) + pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_14 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0)));
19806 
19807  /* "mprans/MeshSmoothing.pyx":1382
19808  * elementBoundaryNormalsArray_[i,j,2] = U[0]*V[1]-U[1]*V[0]
19809  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19810  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn # <<<<<<<<<<<<<<
19811  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
19812  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
19813  */
19814  __pyx_t_14 = __pyx_v_i;
19815  __pyx_t_13 = __pyx_v_j;
19816  __pyx_t_12 = 0;
19817  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19818  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19819  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19820  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_14 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
19821 
19822  /* "mprans/MeshSmoothing.pyx":1383
19823  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2+elementBoundaryNormalsArray_[i,j,2]**2)
19824  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19825  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn # <<<<<<<<<<<<<<
19826  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
19827  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
19828  */
19829  __pyx_t_12 = __pyx_v_i;
19830  __pyx_t_13 = __pyx_v_j;
19831  __pyx_t_14 = 1;
19832  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19833  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19834  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19835  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_14 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
19836 
19837  /* "mprans/MeshSmoothing.pyx":1384
19838  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
19839  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
19840  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn # <<<<<<<<<<<<<<
19841  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
19842  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
19843  */
19844  __pyx_t_14 = __pyx_v_i;
19845  __pyx_t_13 = __pyx_v_j;
19846  __pyx_t_12 = 2;
19847  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19848  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19849  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19850  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_14 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
19851 
19852  /* "mprans/MeshSmoothing.pyx":1385
19853  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
19854  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
19855  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0] # <<<<<<<<<<<<<<
19856  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
19857  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
19858  */
19859  __pyx_t_12 = __pyx_v_b_i;
19860  __pyx_t_13 = 0;
19861  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
19862  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
19863  __pyx_t_14 = __pyx_v_i;
19864  __pyx_t_11 = 0;
19865  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBarycentersArray.shape[0];
19866  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBarycentersArray.shape[1];
19867  (__pyx_v_normal_check[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_12 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_14 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementBarycentersArray.strides[1]) ))));
19868 
19869  /* "mprans/MeshSmoothing.pyx":1386
19870  * elementBoundaryNormalsArray_[i,j,2] /= lenghtn
19871  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
19872  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1] # <<<<<<<<<<<<<<
19873  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
19874  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
19875  */
19876  __pyx_t_11 = __pyx_v_b_i;
19877  __pyx_t_14 = 1;
19878  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
19879  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
19880  __pyx_t_13 = __pyx_v_i;
19881  __pyx_t_12 = 1;
19882  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBarycentersArray.shape[0];
19883  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBarycentersArray.shape[1];
19884  (__pyx_v_normal_check[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_11 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_14 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_13 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_12 * __pyx_v_elementBarycentersArray.strides[1]) ))));
19885 
19886  /* "mprans/MeshSmoothing.pyx":1387
19887  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
19888  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
19889  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2] # <<<<<<<<<<<<<<
19890  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
19891  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
19892  */
19893  __pyx_t_12 = __pyx_v_b_i;
19894  __pyx_t_13 = 2;
19895  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
19896  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
19897  __pyx_t_14 = __pyx_v_i;
19898  __pyx_t_11 = 2;
19899  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBarycentersArray.shape[0];
19900  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBarycentersArray.shape[1];
19901  (__pyx_v_normal_check[2]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_12 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_13 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_14 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementBarycentersArray.strides[1]) ))));
19902 
19903  /* "mprans/MeshSmoothing.pyx":1388
19904  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
19905  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
19906  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\ # <<<<<<<<<<<<<<
19907  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
19908  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
19909  */
19910  __pyx_t_11 = __pyx_v_i;
19911  __pyx_t_14 = __pyx_v_j;
19912  __pyx_t_13 = 0;
19913  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19914  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19915  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19916 
19917  /* "mprans/MeshSmoothing.pyx":1389
19918  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
19919  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
19920  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\ # <<<<<<<<<<<<<<
19921  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
19922  * if dot < 0:
19923  */
19924  __pyx_t_12 = __pyx_v_i;
19925  __pyx_t_10 = __pyx_v_j;
19926  __pyx_t_7 = 1;
19927  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19928  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19929  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19930 
19931  /* "mprans/MeshSmoothing.pyx":1390
19932  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
19933  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
19934  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2] # <<<<<<<<<<<<<<
19935  * if dot < 0:
19936  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
19937  */
19938  __pyx_t_5 = __pyx_v_i;
19939  __pyx_t_6 = __pyx_v_j;
19940  __pyx_t_8 = 2;
19941  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19942  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19943  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19944 
19945  /* "mprans/MeshSmoothing.pyx":1389
19946  * normal_check[2] = elementBoundaryBarycentersArray[b_i, 2]-elementBarycentersArray[i, 2]
19947  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
19948  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\ # <<<<<<<<<<<<<<
19949  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
19950  * if dot < 0:
19951  */
19952  __pyx_v_dot = ((((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_14 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_13 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[0])) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[1]))) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[2])));
19953 
19954  /* "mprans/MeshSmoothing.pyx":1391
19955  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
19956  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
19957  * if dot < 0: # <<<<<<<<<<<<<<
19958  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
19959  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
19960  */
19961  __pyx_t_15 = ((__pyx_v_dot < 0.0) != 0);
19962  if (__pyx_t_15) {
19963 
19964  /* "mprans/MeshSmoothing.pyx":1392
19965  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
19966  * if dot < 0:
19967  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0] # <<<<<<<<<<<<<<
19968  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
19969  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
19970  */
19971  __pyx_t_8 = __pyx_v_i;
19972  __pyx_t_6 = __pyx_v_j;
19973  __pyx_t_5 = 0;
19974  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19975  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19976  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19977  __pyx_t_7 = __pyx_v_i;
19978  __pyx_t_10 = __pyx_v_j;
19979  __pyx_t_12 = 0;
19980  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19981  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19982  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19983  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
19984 
19985  /* "mprans/MeshSmoothing.pyx":1393
19986  * if dot < 0:
19987  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
19988  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1] # <<<<<<<<<<<<<<
19989  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
19990  *
19991  */
19992  __pyx_t_5 = __pyx_v_i;
19993  __pyx_t_6 = __pyx_v_j;
19994  __pyx_t_8 = 1;
19995  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
19996  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
19997  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
19998  __pyx_t_12 = __pyx_v_i;
19999  __pyx_t_10 = __pyx_v_j;
20000  __pyx_t_7 = 1;
20001  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20002  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20003  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20004  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20005 
20006  /* "mprans/MeshSmoothing.pyx":1394
20007  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20008  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20009  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2] # <<<<<<<<<<<<<<
20010  *
20011  * cdef void pyxUpdateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_,
20012  */
20013  __pyx_t_8 = __pyx_v_i;
20014  __pyx_t_6 = __pyx_v_j;
20015  __pyx_t_5 = 2;
20016  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20017  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20018  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20019  __pyx_t_7 = __pyx_v_i;
20020  __pyx_t_10 = __pyx_v_j;
20021  __pyx_t_12 = 2;
20022  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20023  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20024  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20025  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_12 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20026 
20027  /* "mprans/MeshSmoothing.pyx":1391
20028  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]+\
20029  * elementBoundaryNormalsArray_[i,j,2]*normal_check[2]
20030  * if dot < 0: # <<<<<<<<<<<<<<
20031  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20032  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20033  */
20034  }
20035  }
20036  }
20037 
20038  /* "mprans/MeshSmoothing.pyx":1349
20039  * return nearest_eN
20040  *
20041  * cdef void pyxUpdateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
20042  * double[:,:] nodeArray,
20043  * int[:,:] elementBoundariesArray,
20044  */
20045 
20046  /* function exit code */
20047  __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
20048  __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
20049  __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
20050  __Pyx_RefNannyFinishContext();
20051 }
20052 
20053 /* "mprans/MeshSmoothing.pyx":1396
20054  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
20055  *
20056  * cdef void pyxUpdateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
20057  * double[:,:] nodeArray,
20058  * int[:,:] elementBoundariesArray,
20059  */
20060 
20061 static void __pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle(__Pyx_memviewslice __pyx_v_elementBoundaryNormalsArray_, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_elementBoundariesArray, __Pyx_memviewslice __pyx_v_elementBoundaryNodesArray, __Pyx_memviewslice __pyx_v_elementBoundaryBarycentersArray, __Pyx_memviewslice __pyx_v_elementBarycentersArray, int __pyx_v_nElements) {
20062  double __pyx_v_normal_check[2];
20063  double __pyx_v_U[2];
20064  int __pyx_v_b_i;
20065  __Pyx_memviewslice __pyx_v_node0 = { 0, 0, { 0 }, { 0 }, { 0 } };
20066  __Pyx_memviewslice __pyx_v_node1 = { 0, 0, { 0 }, { 0 }, { 0 } };
20067  int __pyx_v_i;
20068  int __pyx_v_j;
20069  double __pyx_v_dot;
20070  double __pyx_v_lenghtn;
20071  __Pyx_RefNannyDeclarations
20072  int __pyx_t_1;
20073  int __pyx_t_2;
20074  int __pyx_t_3;
20075  int __pyx_t_4;
20076  Py_ssize_t __pyx_t_5;
20077  Py_ssize_t __pyx_t_6;
20078  Py_ssize_t __pyx_t_7;
20079  Py_ssize_t __pyx_t_8;
20080  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
20081  Py_ssize_t __pyx_t_10;
20082  Py_ssize_t __pyx_t_11;
20083  int __pyx_t_12;
20084  __Pyx_RefNannySetupContext("pyxUpdateElementBoundaryNormalsTriangle", 0);
20085 
20086  /* "mprans/MeshSmoothing.pyx":1411
20087  * cdef int j
20088  * cdef double dot
20089  * for i in range(nElements): # <<<<<<<<<<<<<<
20090  * for j in range(3):
20091  * b_i = elementBoundariesArray[i, j]
20092  */
20093  __pyx_t_1 = __pyx_v_nElements;
20094  __pyx_t_2 = __pyx_t_1;
20095  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20096  __pyx_v_i = __pyx_t_3;
20097 
20098  /* "mprans/MeshSmoothing.pyx":1412
20099  * cdef double dot
20100  * for i in range(nElements):
20101  * for j in range(3): # <<<<<<<<<<<<<<
20102  * b_i = elementBoundariesArray[i, j]
20103  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20104  */
20105  for (__pyx_t_4 = 0; __pyx_t_4 < 3; __pyx_t_4+=1) {
20106  __pyx_v_j = __pyx_t_4;
20107 
20108  /* "mprans/MeshSmoothing.pyx":1413
20109  * for i in range(nElements):
20110  * for j in range(3):
20111  * b_i = elementBoundariesArray[i, j] # <<<<<<<<<<<<<<
20112  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20113  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20114  */
20115  __pyx_t_5 = __pyx_v_i;
20116  __pyx_t_6 = __pyx_v_j;
20117  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[0];
20118  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[1];
20119  __pyx_v_b_i = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[1]) )));
20120 
20121  /* "mprans/MeshSmoothing.pyx":1414
20122  * for j in range(3):
20123  * b_i = elementBoundariesArray[i, j]
20124  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]] # <<<<<<<<<<<<<<
20125  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20126  * U[0] = node1[0]-node0[0]
20127  */
20128  __pyx_t_6 = __pyx_v_i;
20129  __pyx_t_5 = __pyx_v_j;
20130  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[0];
20131  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[1];
20132  __pyx_t_7 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[1]) )));
20133  __pyx_t_8 = 0;
20134  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNodesArray.shape[0];
20135  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNodesArray.shape[1];
20136  __pyx_t_9.data = __pyx_v_nodeArray.data;
20137  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
20138  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
20139  {
20140  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_7 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
20141  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20142  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20143  if (__pyx_tmp_idx < 0)
20144  __pyx_tmp_idx += __pyx_tmp_shape;
20145  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
20146 }
20147 
20148 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
20149 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
20150  __pyx_t_9.suboffsets[0] = -1;
20151 
20152 __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
20153  __pyx_v_node0 = __pyx_t_9;
20154  __pyx_t_9.memview = NULL;
20155  __pyx_t_9.data = NULL;
20156 
20157  /* "mprans/MeshSmoothing.pyx":1415
20158  * b_i = elementBoundariesArray[i, j]
20159  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20160  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]] # <<<<<<<<<<<<<<
20161  * U[0] = node1[0]-node0[0]
20162  * U[1] = node1[1]-node0[1]
20163  */
20164  __pyx_t_5 = __pyx_v_i;
20165  __pyx_t_6 = __pyx_v_j;
20166  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundariesArray.shape[0];
20167  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundariesArray.shape[1];
20168  __pyx_t_8 = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundariesArray.data + __pyx_t_5 * __pyx_v_elementBoundariesArray.strides[0]) ) + __pyx_t_6 * __pyx_v_elementBoundariesArray.strides[1]) )));
20169  __pyx_t_7 = 1;
20170  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNodesArray.shape[0];
20171  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNodesArray.shape[1];
20172  __pyx_t_9.data = __pyx_v_nodeArray.data;
20173  __pyx_t_9.memview = __pyx_v_nodeArray.memview;
20174  __PYX_INC_MEMVIEW(&__pyx_t_9, 0);
20175  {
20176  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNodesArray.data + __pyx_t_8 * __pyx_v_elementBoundaryNodesArray.strides[0]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNodesArray.strides[1]) )));
20177  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20178  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20179  if (__pyx_tmp_idx < 0)
20180  __pyx_tmp_idx += __pyx_tmp_shape;
20181  __pyx_t_9.data += __pyx_tmp_idx * __pyx_tmp_stride;
20182 }
20183 
20184 __pyx_t_9.shape[0] = __pyx_v_nodeArray.shape[1];
20185 __pyx_t_9.strides[0] = __pyx_v_nodeArray.strides[1];
20186  __pyx_t_9.suboffsets[0] = -1;
20187 
20188 __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
20189  __pyx_v_node1 = __pyx_t_9;
20190  __pyx_t_9.memview = NULL;
20191  __pyx_t_9.data = NULL;
20192 
20193  /* "mprans/MeshSmoothing.pyx":1416
20194  * node0 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],0]]
20195  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20196  * U[0] = node1[0]-node0[0] # <<<<<<<<<<<<<<
20197  * U[1] = node1[1]-node0[1]
20198  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20199  */
20200  __pyx_t_6 = 0;
20201  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node1.shape[0];
20202  __pyx_t_5 = 0;
20203  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
20204  (__pyx_v_U[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_6 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
20205 
20206  /* "mprans/MeshSmoothing.pyx":1417
20207  * node1 = nodeArray[elementBoundaryNodesArray[elementBoundariesArray[i, j],1]]
20208  * U[0] = node1[0]-node0[0]
20209  * U[1] = node1[1]-node0[1] # <<<<<<<<<<<<<<
20210  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20211  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20212  */
20213  __pyx_t_5 = 1;
20214  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node1.shape[0];
20215  __pyx_t_6 = 1;
20216  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_node0.shape[0];
20217  (__pyx_v_U[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_5 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_6 * __pyx_v_node0.strides[0]) ))));
20218 
20219  /* "mprans/MeshSmoothing.pyx":1418
20220  * U[0] = node1[0]-node0[0]
20221  * U[1] = node1[1]-node0[1]
20222  * elementBoundaryNormalsArray_[i,j,0] = -U[1] # <<<<<<<<<<<<<<
20223  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20224  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20225  */
20226  __pyx_t_6 = __pyx_v_i;
20227  __pyx_t_5 = __pyx_v_j;
20228  __pyx_t_7 = 0;
20229  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20230  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20231  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20232  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(__pyx_v_U[1]));
20233 
20234  /* "mprans/MeshSmoothing.pyx":1419
20235  * U[1] = node1[1]-node0[1]
20236  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20237  * elementBoundaryNormalsArray_[i,j,1] = U[0] # <<<<<<<<<<<<<<
20238  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20239  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20240  */
20241  __pyx_t_7 = __pyx_v_i;
20242  __pyx_t_5 = __pyx_v_j;
20243  __pyx_t_6 = 1;
20244  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20245  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20246  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20247  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (__pyx_v_U[0]);
20248 
20249  /* "mprans/MeshSmoothing.pyx":1420
20250  * elementBoundaryNormalsArray_[i,j,0] = -U[1]
20251  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20252  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2) # <<<<<<<<<<<<<<
20253  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20254  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20255  */
20256  __pyx_t_6 = __pyx_v_i;
20257  __pyx_t_5 = __pyx_v_j;
20258  __pyx_t_7 = 0;
20259  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20260  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20261  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20262  __pyx_t_8 = __pyx_v_i;
20263  __pyx_t_10 = __pyx_v_j;
20264  __pyx_t_11 = 1;
20265  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20266  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20267  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20268  __pyx_v_lenghtn = sqrt((pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0) + pow((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))), 2.0)));
20269 
20270  /* "mprans/MeshSmoothing.pyx":1421
20271  * elementBoundaryNormalsArray_[i,j,1] = U[0]
20272  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20273  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn # <<<<<<<<<<<<<<
20274  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20275  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20276  */
20277  __pyx_t_11 = __pyx_v_i;
20278  __pyx_t_10 = __pyx_v_j;
20279  __pyx_t_8 = 0;
20280  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20281  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20282  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20283  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
20284 
20285  /* "mprans/MeshSmoothing.pyx":1422
20286  * lenghtn = sqrt(elementBoundaryNormalsArray_[i,j,0]**2+elementBoundaryNormalsArray_[i,j,1]**2)
20287  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20288  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn # <<<<<<<<<<<<<<
20289  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20290  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20291  */
20292  __pyx_t_8 = __pyx_v_i;
20293  __pyx_t_10 = __pyx_v_j;
20294  __pyx_t_11 = 1;
20295  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20296  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20297  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20298  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) /= __pyx_v_lenghtn;
20299 
20300  /* "mprans/MeshSmoothing.pyx":1423
20301  * elementBoundaryNormalsArray_[i,j,0] /= lenghtn
20302  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20303  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0] # <<<<<<<<<<<<<<
20304  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20305  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20306  */
20307  __pyx_t_11 = __pyx_v_b_i;
20308  __pyx_t_10 = 0;
20309  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20310  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20311  __pyx_t_8 = __pyx_v_i;
20312  __pyx_t_7 = 0;
20313  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBarycentersArray.shape[0];
20314  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBarycentersArray.shape[1];
20315  (__pyx_v_normal_check[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_11 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_8 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_7 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20316 
20317  /* "mprans/MeshSmoothing.pyx":1424
20318  * elementBoundaryNormalsArray_[i,j,1] /= lenghtn
20319  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20320  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1] # <<<<<<<<<<<<<<
20321  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20322  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20323  */
20324  __pyx_t_7 = __pyx_v_b_i;
20325  __pyx_t_8 = 1;
20326  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryBarycentersArray.shape[0];
20327  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryBarycentersArray.shape[1];
20328  __pyx_t_10 = __pyx_v_i;
20329  __pyx_t_11 = 1;
20330  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray.shape[0];
20331  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBarycentersArray.shape[1];
20332  (__pyx_v_normal_check[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryBarycentersArray.data + __pyx_t_7 * __pyx_v_elementBoundaryBarycentersArray.strides[0]) ) + __pyx_t_8 * __pyx_v_elementBoundaryBarycentersArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray.data + __pyx_t_10 * __pyx_v_elementBarycentersArray.strides[0]) ) + __pyx_t_11 * __pyx_v_elementBarycentersArray.strides[1]) ))));
20333 
20334  /* "mprans/MeshSmoothing.pyx":1425
20335  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20336  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20337  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\ # <<<<<<<<<<<<<<
20338  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20339  * if dot < 0:
20340  */
20341  __pyx_t_11 = __pyx_v_i;
20342  __pyx_t_10 = __pyx_v_j;
20343  __pyx_t_8 = 0;
20344  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20345  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20346  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20347 
20348  /* "mprans/MeshSmoothing.pyx":1426
20349  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20350  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20351  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1] # <<<<<<<<<<<<<<
20352  * if dot < 0:
20353  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20354  */
20355  __pyx_t_7 = __pyx_v_i;
20356  __pyx_t_5 = __pyx_v_j;
20357  __pyx_t_6 = 1;
20358  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20359  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20360  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20361 
20362  /* "mprans/MeshSmoothing.pyx":1425
20363  * normal_check[0] = elementBoundaryBarycentersArray[b_i, 0]-elementBarycentersArray[i, 0]
20364  * normal_check[1] = elementBoundaryBarycentersArray[b_i, 1]-elementBarycentersArray[i, 1]
20365  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\ # <<<<<<<<<<<<<<
20366  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20367  * if dot < 0:
20368  */
20369  __pyx_v_dot = (((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[0])) + ((*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))) * (__pyx_v_normal_check[1])));
20370 
20371  /* "mprans/MeshSmoothing.pyx":1427
20372  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20373  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20374  * if dot < 0: # <<<<<<<<<<<<<<
20375  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20376  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20377  */
20378  __pyx_t_12 = ((__pyx_v_dot < 0.0) != 0);
20379  if (__pyx_t_12) {
20380 
20381  /* "mprans/MeshSmoothing.pyx":1428
20382  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20383  * if dot < 0:
20384  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0] # <<<<<<<<<<<<<<
20385  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20386  *
20387  */
20388  __pyx_t_6 = __pyx_v_i;
20389  __pyx_t_5 = __pyx_v_j;
20390  __pyx_t_7 = 0;
20391  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20392  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20393  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20394  __pyx_t_8 = __pyx_v_i;
20395  __pyx_t_10 = __pyx_v_j;
20396  __pyx_t_11 = 0;
20397  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20398  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20399  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20400  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20401 
20402  /* "mprans/MeshSmoothing.pyx":1429
20403  * if dot < 0:
20404  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20405  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1] # <<<<<<<<<<<<<<
20406  *
20407  * cdef void cyUpdateElementVolumesTriangle(double[:] elementVolumesArray_,
20408  */
20409  __pyx_t_7 = __pyx_v_i;
20410  __pyx_t_5 = __pyx_v_j;
20411  __pyx_t_6 = 1;
20412  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20413  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20414  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20415  __pyx_t_11 = __pyx_v_i;
20416  __pyx_t_10 = __pyx_v_j;
20417  __pyx_t_8 = 1;
20418  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_elementBoundaryNormalsArray_.shape[0];
20419  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBoundaryNormalsArray_.shape[1];
20420  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_elementBoundaryNormalsArray_.shape[2];
20421  *((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_11 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_8 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) )) = (-(*((double *) ( /* dim=2 */ (( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBoundaryNormalsArray_.data + __pyx_t_7 * __pyx_v_elementBoundaryNormalsArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBoundaryNormalsArray_.strides[1]) ) + __pyx_t_6 * __pyx_v_elementBoundaryNormalsArray_.strides[2]) ))));
20422 
20423  /* "mprans/MeshSmoothing.pyx":1427
20424  * dot = elementBoundaryNormalsArray_[i,j,0]*normal_check[0]+\
20425  * elementBoundaryNormalsArray_[i,j,1]*normal_check[1]
20426  * if dot < 0: # <<<<<<<<<<<<<<
20427  * elementBoundaryNormalsArray_[i,j,0] = -elementBoundaryNormalsArray_[i,j,0]
20428  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20429  */
20430  }
20431  }
20432  }
20433 
20434  /* "mprans/MeshSmoothing.pyx":1396
20435  * elementBoundaryNormalsArray_[i,j,2] = -elementBoundaryNormalsArray_[i,j,2]
20436  *
20437  * cdef void pyxUpdateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
20438  * double[:,:] nodeArray,
20439  * int[:,:] elementBoundariesArray,
20440  */
20441 
20442  /* function exit code */
20443  __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
20444  __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
20445  __Pyx_RefNannyFinishContext();
20446 }
20447 
20448 /* "mprans/MeshSmoothing.pyx":1431
20449  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20450  *
20451  * cdef void cyUpdateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
20452  * int[:,:] elementNodesArray,
20453  * double[:,:] nodeArray,
20454  */
20455 
20456 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle(__Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
20457  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
20458  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
20459  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
20460  double __pyx_v_base;
20461  double __pyx_v_height;
20462  int __pyx_v_eN;
20463  __Pyx_RefNannyDeclarations
20464  int __pyx_t_1;
20465  int __pyx_t_2;
20466  int __pyx_t_3;
20467  Py_ssize_t __pyx_t_4;
20468  Py_ssize_t __pyx_t_5;
20469  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
20470  Py_ssize_t __pyx_t_7;
20471  Py_ssize_t __pyx_t_8;
20472  Py_ssize_t __pyx_t_9;
20473  Py_ssize_t __pyx_t_10;
20474  Py_ssize_t __pyx_t_11;
20475  Py_ssize_t __pyx_t_12;
20476  Py_ssize_t __pyx_t_13;
20477  Py_ssize_t __pyx_t_14;
20478  __Pyx_RefNannySetupContext("cyUpdateElementVolumesTriangle", 0);
20479 
20480  /* "mprans/MeshSmoothing.pyx":1441
20481  * cdef double height
20482  * cdef int eN
20483  * for eN in range(nElements): # <<<<<<<<<<<<<<
20484  * nA = nodeArray[elementNodesArray[eN, 0]]
20485  * nB = nodeArray[elementNodesArray[eN, 1]]
20486  */
20487  __pyx_t_1 = __pyx_v_nElements;
20488  __pyx_t_2 = __pyx_t_1;
20489  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20490  __pyx_v_eN = __pyx_t_3;
20491 
20492  /* "mprans/MeshSmoothing.pyx":1442
20493  * cdef int eN
20494  * for eN in range(nElements):
20495  * nA = nodeArray[elementNodesArray[eN, 0]] # <<<<<<<<<<<<<<
20496  * nB = nodeArray[elementNodesArray[eN, 1]]
20497  * nC = nodeArray[elementNodesArray[eN, 2]]
20498  */
20499  __pyx_t_4 = __pyx_v_eN;
20500  __pyx_t_5 = 0;
20501  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[0];
20502  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[1];
20503  __pyx_t_6.data = __pyx_v_nodeArray.data;
20504  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20505  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20506  {
20507  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_4 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNodesArray.strides[1]) )));
20508  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20509  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20510  if (__pyx_tmp_idx < 0)
20511  __pyx_tmp_idx += __pyx_tmp_shape;
20512  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20513 }
20514 
20515 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20516 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20517  __pyx_t_6.suboffsets[0] = -1;
20518 
20519 __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
20520  __pyx_v_nA = __pyx_t_6;
20521  __pyx_t_6.memview = NULL;
20522  __pyx_t_6.data = NULL;
20523 
20524  /* "mprans/MeshSmoothing.pyx":1443
20525  * for eN in range(nElements):
20526  * nA = nodeArray[elementNodesArray[eN, 0]]
20527  * nB = nodeArray[elementNodesArray[eN, 1]] # <<<<<<<<<<<<<<
20528  * nC = nodeArray[elementNodesArray[eN, 2]]
20529  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20530  */
20531  __pyx_t_5 = __pyx_v_eN;
20532  __pyx_t_4 = 1;
20533  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[0];
20534  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[1];
20535  __pyx_t_6.data = __pyx_v_nodeArray.data;
20536  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20537  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20538  {
20539  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_5 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_4 * __pyx_v_elementNodesArray.strides[1]) )));
20540  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20541  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20542  if (__pyx_tmp_idx < 0)
20543  __pyx_tmp_idx += __pyx_tmp_shape;
20544  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20545 }
20546 
20547 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20548 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20549  __pyx_t_6.suboffsets[0] = -1;
20550 
20551 __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
20552  __pyx_v_nB = __pyx_t_6;
20553  __pyx_t_6.memview = NULL;
20554  __pyx_t_6.data = NULL;
20555 
20556  /* "mprans/MeshSmoothing.pyx":1444
20557  * nA = nodeArray[elementNodesArray[eN, 0]]
20558  * nB = nodeArray[elementNodesArray[eN, 1]]
20559  * nC = nodeArray[elementNodesArray[eN, 2]] # <<<<<<<<<<<<<<
20560  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20561  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20562  */
20563  __pyx_t_4 = __pyx_v_eN;
20564  __pyx_t_5 = 2;
20565  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[0];
20566  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[1];
20567  __pyx_t_6.data = __pyx_v_nodeArray.data;
20568  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20569  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20570  {
20571  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_4 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNodesArray.strides[1]) )));
20572  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20573  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20574  if (__pyx_tmp_idx < 0)
20575  __pyx_tmp_idx += __pyx_tmp_shape;
20576  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20577 }
20578 
20579 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20580 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20581  __pyx_t_6.suboffsets[0] = -1;
20582 
20583 __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
20584  __pyx_v_nC = __pyx_t_6;
20585  __pyx_t_6.memview = NULL;
20586  __pyx_t_6.data = NULL;
20587 
20588  /* "mprans/MeshSmoothing.pyx":1445
20589  * nB = nodeArray[elementNodesArray[eN, 1]]
20590  * nC = nodeArray[elementNodesArray[eN, 2]]
20591  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2) # <<<<<<<<<<<<<<
20592  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20593  * elementVolumesArray_[eN] = 0.5*base*height
20594  */
20595  __pyx_t_5 = 1;
20596  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nB.shape[0];
20597  __pyx_t_4 = 1;
20598  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nA.shape[0];
20599  __pyx_t_7 = 0;
20600  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nB.shape[0];
20601  __pyx_t_8 = 0;
20602  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nA.shape[0];
20603  __pyx_v_base = sqrt((pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_5 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_4 * __pyx_v_nA.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_7 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_8 * __pyx_v_nA.strides[0]) )))), 2.0)));
20604 
20605  /* "mprans/MeshSmoothing.pyx":1446
20606  * nC = nodeArray[elementNodesArray[eN, 2]]
20607  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20608  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base # <<<<<<<<<<<<<<
20609  * elementVolumesArray_[eN] = 0.5*base*height
20610  *
20611  */
20612  __pyx_t_8 = 1;
20613  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nB.shape[0];
20614  __pyx_t_7 = 1;
20615  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nA.shape[0];
20616  __pyx_t_4 = 0;
20617  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nC.shape[0];
20618  __pyx_t_5 = 0;
20619  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nB.shape[0];
20620  __pyx_t_9 = 0;
20621  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nA.shape[0];
20622  __pyx_t_10 = 1;
20623  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nC.shape[0];
20624  __pyx_t_11 = 0;
20625  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nB.shape[0];
20626  __pyx_t_12 = 1;
20627  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nA.shape[0];
20628  __pyx_t_13 = 1;
20629  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nB.shape[0];
20630  __pyx_t_14 = 0;
20631  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nA.shape[0];
20632  __pyx_v_height = (fabs(((((((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_8 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_7 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_4 * __pyx_v_nC.strides[0]) )))) - (((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_5 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_9 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_10 * __pyx_v_nC.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_11 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_12 * __pyx_v_nA.strides[0]) ))))) - ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_13 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_14 * __pyx_v_nA.strides[0]) )))))) / __pyx_v_base);
20633 
20634  /* "mprans/MeshSmoothing.pyx":1447
20635  * base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20636  * height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20637  * elementVolumesArray_[eN] = 0.5*base*height # <<<<<<<<<<<<<<
20638  *
20639  * cdef double cyGetElementVolumeTriangle(double[:] nA,
20640  */
20641  __pyx_t_14 = __pyx_v_eN;
20642  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementVolumesArray_.shape[0];
20643  *((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray_.data + __pyx_t_14 * __pyx_v_elementVolumesArray_.strides[0]) )) = ((0.5 * __pyx_v_base) * __pyx_v_height);
20644  }
20645 
20646  /* "mprans/MeshSmoothing.pyx":1431
20647  * elementBoundaryNormalsArray_[i,j,1] = -elementBoundaryNormalsArray_[i,j,1]
20648  *
20649  * cdef void cyUpdateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
20650  * int[:,:] elementNodesArray,
20651  * double[:,:] nodeArray,
20652  */
20653 
20654  /* function exit code */
20655  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
20656  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
20657  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
20658  __Pyx_RefNannyFinishContext();
20659 }
20660 
20661 /* "mprans/MeshSmoothing.pyx":1449
20662  * elementVolumesArray_[eN] = 0.5*base*height
20663  *
20664  * cdef double cyGetElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
20665  * double[:] nB,
20666  * double[:] nC):
20667  */
20668 
20669 static double __pyx_f_6mprans_13MeshSmoothing_cyGetElementVolumeTriangle(__Pyx_memviewslice __pyx_v_nA, __Pyx_memviewslice __pyx_v_nB, __Pyx_memviewslice __pyx_v_nC) {
20670  double __pyx_v_base;
20671  double __pyx_v_height;
20672  double __pyx_r;
20673  __Pyx_RefNannyDeclarations
20674  Py_ssize_t __pyx_t_1;
20675  Py_ssize_t __pyx_t_2;
20676  Py_ssize_t __pyx_t_3;
20677  Py_ssize_t __pyx_t_4;
20678  Py_ssize_t __pyx_t_5;
20679  Py_ssize_t __pyx_t_6;
20680  Py_ssize_t __pyx_t_7;
20681  Py_ssize_t __pyx_t_8;
20682  Py_ssize_t __pyx_t_9;
20683  Py_ssize_t __pyx_t_10;
20684  __Pyx_RefNannySetupContext("cyGetElementVolumeTriangle", 0);
20685 
20686  /* "mprans/MeshSmoothing.pyx":1452
20687  * double[:] nB,
20688  * double[:] nC):
20689  * cdef double base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2) # <<<<<<<<<<<<<<
20690  * cdef double height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20691  * return 0.5*base*height
20692  */
20693  __pyx_t_1 = 1;
20694  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nB.shape[0];
20695  __pyx_t_2 = 1;
20696  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_nA.shape[0];
20697  __pyx_t_3 = 0;
20698  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_nB.shape[0];
20699  __pyx_t_4 = 0;
20700  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nA.shape[0];
20701  __pyx_v_base = sqrt((pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_1 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_2 * __pyx_v_nA.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_3 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_4 * __pyx_v_nA.strides[0]) )))), 2.0)));
20702 
20703  /* "mprans/MeshSmoothing.pyx":1453
20704  * double[:] nC):
20705  * cdef double base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20706  * cdef double height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base # <<<<<<<<<<<<<<
20707  * return 0.5*base*height
20708  *
20709  */
20710  __pyx_t_4 = 1;
20711  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nB.shape[0];
20712  __pyx_t_3 = 1;
20713  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_nA.shape[0];
20714  __pyx_t_2 = 0;
20715  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_nC.shape[0];
20716  __pyx_t_1 = 0;
20717  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nB.shape[0];
20718  __pyx_t_5 = 0;
20719  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nA.shape[0];
20720  __pyx_t_6 = 1;
20721  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nC.shape[0];
20722  __pyx_t_7 = 0;
20723  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nB.shape[0];
20724  __pyx_t_8 = 1;
20725  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nA.shape[0];
20726  __pyx_t_9 = 1;
20727  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nB.shape[0];
20728  __pyx_t_10 = 0;
20729  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nA.shape[0];
20730  __pyx_v_height = (fabs(((((((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_4 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_3 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_2 * __pyx_v_nC.strides[0]) )))) - (((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_1 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_5 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_6 * __pyx_v_nC.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_7 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_8 * __pyx_v_nA.strides[0]) ))))) - ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_9 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_10 * __pyx_v_nA.strides[0]) )))))) / __pyx_v_base);
20731 
20732  /* "mprans/MeshSmoothing.pyx":1454
20733  * cdef double base = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20734  * cdef double height = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base
20735  * return 0.5*base*height # <<<<<<<<<<<<<<
20736  *
20737  * cdef void cyUpdateElementVolumesTetra(double[:] elementVolumesArray_,
20738  */
20739  __pyx_r = ((0.5 * __pyx_v_base) * __pyx_v_height);
20740  goto __pyx_L0;
20741 
20742  /* "mprans/MeshSmoothing.pyx":1449
20743  * elementVolumesArray_[eN] = 0.5*base*height
20744  *
20745  * cdef double cyGetElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
20746  * double[:] nB,
20747  * double[:] nC):
20748  */
20749 
20750  /* function exit code */
20751  __pyx_L0:;
20752  __Pyx_RefNannyFinishContext();
20753  return __pyx_r;
20754 }
20755 
20756 /* "mprans/MeshSmoothing.pyx":1456
20757  * return 0.5*base*height
20758  *
20759  * cdef void cyUpdateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
20760  * int[:,:] elementNodesArray,
20761  * double[:,:] nodeArray,
20762  */
20763 
20764 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra(__Pyx_memviewslice __pyx_v_elementVolumesArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
20765  __Pyx_memviewslice __pyx_v_nA = { 0, 0, { 0 }, { 0 }, { 0 } };
20766  __Pyx_memviewslice __pyx_v_nB = { 0, 0, { 0 }, { 0 }, { 0 } };
20767  __Pyx_memviewslice __pyx_v_nC = { 0, 0, { 0 }, { 0 }, { 0 } };
20768  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_nD = { 0, 0, { 0 }, { 0 }, { 0 } };
20769  double __pyx_v_base_tri;
20770  double __pyx_v_height_tri;
20771  double __pyx_v_area_tri;
20772  double __pyx_v_height_tetra;
20773  int __pyx_v_eN;
20774  __Pyx_RefNannyDeclarations
20775  int __pyx_t_1;
20776  int __pyx_t_2;
20777  int __pyx_t_3;
20778  Py_ssize_t __pyx_t_4;
20779  Py_ssize_t __pyx_t_5;
20780  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
20781  Py_ssize_t __pyx_t_7;
20782  Py_ssize_t __pyx_t_8;
20783  Py_ssize_t __pyx_t_9;
20784  Py_ssize_t __pyx_t_10;
20785  Py_ssize_t __pyx_t_11;
20786  Py_ssize_t __pyx_t_12;
20787  Py_ssize_t __pyx_t_13;
20788  Py_ssize_t __pyx_t_14;
20789  __Pyx_RefNannySetupContext("cyUpdateElementVolumesTetra", 0);
20790 
20791  /* "mprans/MeshSmoothing.pyx":1469
20792  * cdef double height_tetra
20793  * cdef int eN
20794  * for eN in range(nElements): # <<<<<<<<<<<<<<
20795  * nA = nodeArray[elementNodesArray[eN, 0]]
20796  * nB = nodeArray[elementNodesArray[eN, 1]]
20797  */
20798  __pyx_t_1 = __pyx_v_nElements;
20799  __pyx_t_2 = __pyx_t_1;
20800  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20801  __pyx_v_eN = __pyx_t_3;
20802 
20803  /* "mprans/MeshSmoothing.pyx":1470
20804  * cdef int eN
20805  * for eN in range(nElements):
20806  * nA = nodeArray[elementNodesArray[eN, 0]] # <<<<<<<<<<<<<<
20807  * nB = nodeArray[elementNodesArray[eN, 1]]
20808  * nC = nodeArray[elementNodesArray[eN, 2]]
20809  */
20810  __pyx_t_4 = __pyx_v_eN;
20811  __pyx_t_5 = 0;
20812  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[0];
20813  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[1];
20814  __pyx_t_6.data = __pyx_v_nodeArray.data;
20815  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20816  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20817  {
20818  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_4 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNodesArray.strides[1]) )));
20819  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20820  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20821  if (__pyx_tmp_idx < 0)
20822  __pyx_tmp_idx += __pyx_tmp_shape;
20823  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20824 }
20825 
20826 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20827 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20828  __pyx_t_6.suboffsets[0] = -1;
20829 
20830 __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
20831  __pyx_v_nA = __pyx_t_6;
20832  __pyx_t_6.memview = NULL;
20833  __pyx_t_6.data = NULL;
20834 
20835  /* "mprans/MeshSmoothing.pyx":1471
20836  * for eN in range(nElements):
20837  * nA = nodeArray[elementNodesArray[eN, 0]]
20838  * nB = nodeArray[elementNodesArray[eN, 1]] # <<<<<<<<<<<<<<
20839  * nC = nodeArray[elementNodesArray[eN, 2]]
20840  * nD = nodeArray[elementNodesArray[eN, 3]]
20841  */
20842  __pyx_t_5 = __pyx_v_eN;
20843  __pyx_t_4 = 1;
20844  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[0];
20845  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[1];
20846  __pyx_t_6.data = __pyx_v_nodeArray.data;
20847  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20848  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20849  {
20850  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_5 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_4 * __pyx_v_elementNodesArray.strides[1]) )));
20851  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20852  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20853  if (__pyx_tmp_idx < 0)
20854  __pyx_tmp_idx += __pyx_tmp_shape;
20855  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20856 }
20857 
20858 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20859 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20860  __pyx_t_6.suboffsets[0] = -1;
20861 
20862 __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
20863  __pyx_v_nB = __pyx_t_6;
20864  __pyx_t_6.memview = NULL;
20865  __pyx_t_6.data = NULL;
20866 
20867  /* "mprans/MeshSmoothing.pyx":1472
20868  * nA = nodeArray[elementNodesArray[eN, 0]]
20869  * nB = nodeArray[elementNodesArray[eN, 1]]
20870  * nC = nodeArray[elementNodesArray[eN, 2]] # <<<<<<<<<<<<<<
20871  * nD = nodeArray[elementNodesArray[eN, 3]]
20872  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20873  */
20874  __pyx_t_4 = __pyx_v_eN;
20875  __pyx_t_5 = 2;
20876  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[0];
20877  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[1];
20878  __pyx_t_6.data = __pyx_v_nodeArray.data;
20879  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20880  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20881  {
20882  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_4 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_5 * __pyx_v_elementNodesArray.strides[1]) )));
20883  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20884  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20885  if (__pyx_tmp_idx < 0)
20886  __pyx_tmp_idx += __pyx_tmp_shape;
20887  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20888 }
20889 
20890 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20891 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20892  __pyx_t_6.suboffsets[0] = -1;
20893 
20894 __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
20895  __pyx_v_nC = __pyx_t_6;
20896  __pyx_t_6.memview = NULL;
20897  __pyx_t_6.data = NULL;
20898 
20899  /* "mprans/MeshSmoothing.pyx":1473
20900  * nB = nodeArray[elementNodesArray[eN, 1]]
20901  * nC = nodeArray[elementNodesArray[eN, 2]]
20902  * nD = nodeArray[elementNodesArray[eN, 3]] # <<<<<<<<<<<<<<
20903  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20904  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
20905  */
20906  __pyx_t_5 = __pyx_v_eN;
20907  __pyx_t_4 = 3;
20908  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[0];
20909  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[1];
20910  __pyx_t_6.data = __pyx_v_nodeArray.data;
20911  __pyx_t_6.memview = __pyx_v_nodeArray.memview;
20912  __PYX_INC_MEMVIEW(&__pyx_t_6, 0);
20913  {
20914  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_5 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_4 * __pyx_v_elementNodesArray.strides[1]) )));
20915  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
20916  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
20917  if (__pyx_tmp_idx < 0)
20918  __pyx_tmp_idx += __pyx_tmp_shape;
20919  __pyx_t_6.data += __pyx_tmp_idx * __pyx_tmp_stride;
20920 }
20921 
20922 __pyx_t_6.shape[0] = __pyx_v_nodeArray.shape[1];
20923 __pyx_t_6.strides[0] = __pyx_v_nodeArray.strides[1];
20924  __pyx_t_6.suboffsets[0] = -1;
20925 
20926 __PYX_XDEC_MEMVIEW(&__pyx_v_nD, 1);
20927  __pyx_v_nD = __pyx_t_6;
20928  __pyx_t_6.memview = NULL;
20929  __pyx_t_6.data = NULL;
20930 
20931  /* "mprans/MeshSmoothing.pyx":1474
20932  * nC = nodeArray[elementNodesArray[eN, 2]]
20933  * nD = nodeArray[elementNodesArray[eN, 3]]
20934  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2) # <<<<<<<<<<<<<<
20935  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
20936  * area_tri = 0.5*base_tri*height_tri
20937  */
20938  __pyx_t_4 = 1;
20939  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nB.shape[0];
20940  __pyx_t_5 = 1;
20941  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nA.shape[0];
20942  __pyx_t_7 = 0;
20943  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nB.shape[0];
20944  __pyx_t_8 = 0;
20945  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nA.shape[0];
20946  __pyx_v_base_tri = sqrt((pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_4 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_5 * __pyx_v_nA.strides[0]) )))), 2.0) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_7 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_8 * __pyx_v_nA.strides[0]) )))), 2.0)));
20947 
20948  /* "mprans/MeshSmoothing.pyx":1475
20949  * nD = nodeArray[elementNodesArray[eN, 3]]
20950  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20951  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri # <<<<<<<<<<<<<<
20952  * area_tri = 0.5*base_tri*height_tri
20953  * height_tetra = 0.
20954  */
20955  __pyx_t_8 = 1;
20956  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nB.shape[0];
20957  __pyx_t_7 = 1;
20958  if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_v_nA.shape[0];
20959  __pyx_t_5 = 0;
20960  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nC.shape[0];
20961  __pyx_t_4 = 0;
20962  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nB.shape[0];
20963  __pyx_t_9 = 0;
20964  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nA.shape[0];
20965  __pyx_t_10 = 1;
20966  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nC.shape[0];
20967  __pyx_t_11 = 0;
20968  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_nB.shape[0];
20969  __pyx_t_12 = 1;
20970  if (__pyx_t_12 < 0) __pyx_t_12 += __pyx_v_nA.shape[0];
20971  __pyx_t_13 = 1;
20972  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nB.shape[0];
20973  __pyx_t_14 = 0;
20974  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nA.shape[0];
20975  __pyx_v_height_tri = (fabs(((((((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_8 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_7 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_5 * __pyx_v_nC.strides[0]) )))) - (((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_4 * __pyx_v_nB.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_9 * __pyx_v_nA.strides[0]) )))) * (*((double *) ( /* dim=0 */ (__pyx_v_nC.data + __pyx_t_10 * __pyx_v_nC.strides[0]) ))))) + ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_11 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_12 * __pyx_v_nA.strides[0]) ))))) - ((*((double *) ( /* dim=0 */ (__pyx_v_nB.data + __pyx_t_13 * __pyx_v_nB.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_nA.data + __pyx_t_14 * __pyx_v_nA.strides[0]) )))))) / __pyx_v_base_tri);
20976 
20977  /* "mprans/MeshSmoothing.pyx":1476
20978  * base_tri = sqrt((nB[1]-nA[1])**2+(nB[0]-nA[0])**2)
20979  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
20980  * area_tri = 0.5*base_tri*height_tri # <<<<<<<<<<<<<<
20981  * height_tetra = 0.
20982  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
20983  */
20984  __pyx_v_area_tri = ((0.5 * __pyx_v_base_tri) * __pyx_v_height_tri);
20985 
20986  /* "mprans/MeshSmoothing.pyx":1477
20987  * height_tri = abs((nB[1]-nA[1])*nC[0]-(nB[0]-nA[0])*nC[1]+nB[0]*nA[1]-nB[1]*nA[0])/base_tri
20988  * area_tri = 0.5*base_tri*height_tri
20989  * height_tetra = 0. # <<<<<<<<<<<<<<
20990  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
20991  *
20992  */
20993  __pyx_v_height_tetra = 0.;
20994 
20995  /* "mprans/MeshSmoothing.pyx":1478
20996  * area_tri = 0.5*base_tri*height_tri
20997  * height_tetra = 0.
20998  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra # <<<<<<<<<<<<<<
20999  *
21000  * cdef void cyUpdateElementBarycenters(double[:,:] elementBarycentersArray_,
21001  */
21002  __pyx_t_14 = __pyx_v_eN;
21003  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_elementVolumesArray_.shape[0];
21004  *((double *) ( /* dim=0 */ (__pyx_v_elementVolumesArray_.data + __pyx_t_14 * __pyx_v_elementVolumesArray_.strides[0]) )) = (((1. / 3.) * __pyx_v_area_tri) * __pyx_v_height_tetra);
21005  }
21006 
21007  /* "mprans/MeshSmoothing.pyx":1456
21008  * return 0.5*base*height
21009  *
21010  * cdef void cyUpdateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
21011  * int[:,:] elementNodesArray,
21012  * double[:,:] nodeArray,
21013  */
21014 
21015  /* function exit code */
21016  __PYX_XDEC_MEMVIEW(&__pyx_v_nA, 1);
21017  __PYX_XDEC_MEMVIEW(&__pyx_v_nB, 1);
21018  __PYX_XDEC_MEMVIEW(&__pyx_v_nC, 1);
21019  __PYX_XDEC_MEMVIEW(&__pyx_v_nD, 1);
21020  __Pyx_RefNannyFinishContext();
21021 }
21022 
21023 /* "mprans/MeshSmoothing.pyx":1480
21024  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
21025  *
21026  * cdef void cyUpdateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
21027  * int[:,:] elementNodesArray,
21028  * double[:,:] nodeArray,
21029  */
21030 
21031 static void __pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters(__Pyx_memviewslice __pyx_v_elementBarycentersArray_, __Pyx_memviewslice __pyx_v_elementNodesArray, __Pyx_memviewslice __pyx_v_nodeArray, int __pyx_v_nElements) {
21032  int __pyx_v_eN;
21033  int __pyx_v_iN;
21034  int __pyx_v_node;
21035  int __pyx_v_nNel;
21036  __Pyx_RefNannyDeclarations
21037  int __pyx_t_1;
21038  int __pyx_t_2;
21039  int __pyx_t_3;
21040  Py_ssize_t __pyx_t_4;
21041  Py_ssize_t __pyx_t_5;
21042  int __pyx_t_6;
21043  int __pyx_t_7;
21044  int __pyx_t_8;
21045  Py_ssize_t __pyx_t_9;
21046  Py_ssize_t __pyx_t_10;
21047  __Pyx_RefNannySetupContext("cyUpdateElementBarycenters", 0);
21048 
21049  /* "mprans/MeshSmoothing.pyx":1487
21050  * cdef int iN
21051  * cdef int node
21052  * cdef int nNel = elementNodesArray.shape[1] # <<<<<<<<<<<<<<
21053  * for eN in range(nElements):
21054  * elementBarycentersArray_[eN, 0] = 0.
21055  */
21056  __pyx_v_nNel = (__pyx_v_elementNodesArray.shape[1]);
21057 
21058  /* "mprans/MeshSmoothing.pyx":1488
21059  * cdef int node
21060  * cdef int nNel = elementNodesArray.shape[1]
21061  * for eN in range(nElements): # <<<<<<<<<<<<<<
21062  * elementBarycentersArray_[eN, 0] = 0.
21063  * elementBarycentersArray_[eN, 1] = 0.
21064  */
21065  __pyx_t_1 = __pyx_v_nElements;
21066  __pyx_t_2 = __pyx_t_1;
21067  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
21068  __pyx_v_eN = __pyx_t_3;
21069 
21070  /* "mprans/MeshSmoothing.pyx":1489
21071  * cdef int nNel = elementNodesArray.shape[1]
21072  * for eN in range(nElements):
21073  * elementBarycentersArray_[eN, 0] = 0. # <<<<<<<<<<<<<<
21074  * elementBarycentersArray_[eN, 1] = 0.
21075  * elementBarycentersArray_[eN, 2] = 0.
21076  */
21077  __pyx_t_4 = __pyx_v_eN;
21078  __pyx_t_5 = 0;
21079  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[0];
21080  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[1];
21081  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[1]) )) = 0.;
21082 
21083  /* "mprans/MeshSmoothing.pyx":1490
21084  * for eN in range(nElements):
21085  * elementBarycentersArray_[eN, 0] = 0.
21086  * elementBarycentersArray_[eN, 1] = 0. # <<<<<<<<<<<<<<
21087  * elementBarycentersArray_[eN, 2] = 0.
21088  * for iN in range(nNel):
21089  */
21090  __pyx_t_5 = __pyx_v_eN;
21091  __pyx_t_4 = 1;
21092  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[0];
21093  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[1];
21094  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[1]) )) = 0.;
21095 
21096  /* "mprans/MeshSmoothing.pyx":1491
21097  * elementBarycentersArray_[eN, 0] = 0.
21098  * elementBarycentersArray_[eN, 1] = 0.
21099  * elementBarycentersArray_[eN, 2] = 0. # <<<<<<<<<<<<<<
21100  * for iN in range(nNel):
21101  * node = elementNodesArray[eN, iN]
21102  */
21103  __pyx_t_4 = __pyx_v_eN;
21104  __pyx_t_5 = 2;
21105  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[0];
21106  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[1];
21107  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[1]) )) = 0.;
21108 
21109  /* "mprans/MeshSmoothing.pyx":1492
21110  * elementBarycentersArray_[eN, 1] = 0.
21111  * elementBarycentersArray_[eN, 2] = 0.
21112  * for iN in range(nNel): # <<<<<<<<<<<<<<
21113  * node = elementNodesArray[eN, iN]
21114  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21115  */
21116  __pyx_t_6 = __pyx_v_nNel;
21117  __pyx_t_7 = __pyx_t_6;
21118  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
21119  __pyx_v_iN = __pyx_t_8;
21120 
21121  /* "mprans/MeshSmoothing.pyx":1493
21122  * elementBarycentersArray_[eN, 2] = 0.
21123  * for iN in range(nNel):
21124  * node = elementNodesArray[eN, iN] # <<<<<<<<<<<<<<
21125  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21126  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21127  */
21128  __pyx_t_5 = __pyx_v_eN;
21129  __pyx_t_4 = __pyx_v_iN;
21130  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementNodesArray.shape[0];
21131  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementNodesArray.shape[1];
21132  __pyx_v_node = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementNodesArray.data + __pyx_t_5 * __pyx_v_elementNodesArray.strides[0]) ) + __pyx_t_4 * __pyx_v_elementNodesArray.strides[1]) )));
21133 
21134  /* "mprans/MeshSmoothing.pyx":1494
21135  * for iN in range(nNel):
21136  * node = elementNodesArray[eN, iN]
21137  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0] # <<<<<<<<<<<<<<
21138  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21139  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21140  */
21141  __pyx_t_4 = __pyx_v_node;
21142  __pyx_t_5 = 0;
21143  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nodeArray.shape[0];
21144  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeArray.shape[1];
21145  __pyx_t_9 = __pyx_v_eN;
21146  __pyx_t_10 = 0;
21147  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[0];
21148  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray_.shape[1];
21149  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBarycentersArray_.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_4 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_5 * __pyx_v_nodeArray.strides[1]) )));
21150 
21151  /* "mprans/MeshSmoothing.pyx":1495
21152  * node = elementNodesArray[eN, iN]
21153  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21154  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1] # <<<<<<<<<<<<<<
21155  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21156  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21157  */
21158  __pyx_t_5 = __pyx_v_node;
21159  __pyx_t_4 = 1;
21160  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeArray.shape[0];
21161  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nodeArray.shape[1];
21162  __pyx_t_10 = __pyx_v_eN;
21163  __pyx_t_9 = 1;
21164  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray_.shape[0];
21165  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[1];
21166  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_10 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_5 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_4 * __pyx_v_nodeArray.strides[1]) )));
21167 
21168  /* "mprans/MeshSmoothing.pyx":1496
21169  * elementBarycentersArray_[eN, 0] += nodeArray[node, 0]
21170  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21171  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2] # <<<<<<<<<<<<<<
21172  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21173  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1)
21174  */
21175  __pyx_t_4 = __pyx_v_node;
21176  __pyx_t_5 = 2;
21177  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_nodeArray.shape[0];
21178  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeArray.shape[1];
21179  __pyx_t_9 = __pyx_v_eN;
21180  __pyx_t_10 = 2;
21181  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[0];
21182  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray_.shape[1];
21183  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBarycentersArray_.strides[1]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_4 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_5 * __pyx_v_nodeArray.strides[1]) )));
21184  }
21185 
21186  /* "mprans/MeshSmoothing.pyx":1497
21187  * elementBarycentersArray_[eN, 1] += nodeArray[node, 1]
21188  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21189  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1) # <<<<<<<<<<<<<<
21190  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1)
21191  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21192  */
21193  __pyx_t_5 = __pyx_v_eN;
21194  __pyx_t_4 = 0;
21195  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[0];
21196  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[1];
21197  __pyx_t_10 = __pyx_v_eN;
21198  __pyx_t_9 = 0;
21199  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray_.shape[0];
21200  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[1];
21201  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_10 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[1]) ))) / (__pyx_v_iN + 1));
21202 
21203  /* "mprans/MeshSmoothing.pyx":1498
21204  * elementBarycentersArray_[eN, 2] += nodeArray[node, 2]
21205  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21206  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1) # <<<<<<<<<<<<<<
21207  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21208  *
21209  */
21210  __pyx_t_4 = __pyx_v_eN;
21211  __pyx_t_5 = 1;
21212  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[0];
21213  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[1];
21214  __pyx_t_9 = __pyx_v_eN;
21215  __pyx_t_10 = 1;
21216  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[0];
21217  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray_.shape[1];
21218  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_10 * __pyx_v_elementBarycentersArray_.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[1]) ))) / (__pyx_v_iN + 1));
21219 
21220  /* "mprans/MeshSmoothing.pyx":1499
21221  * elementBarycentersArray_[eN, 0] = elementBarycentersArray_[eN, 0]/(iN+1)
21222  * elementBarycentersArray_[eN, 1] = elementBarycentersArray_[eN, 1]/(iN+1)
21223  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1) # <<<<<<<<<<<<<<
21224  *
21225  * cdef np.ndarray cyGetCornerNodesTriangle(double[:,:] nodeArray,
21226  */
21227  __pyx_t_5 = __pyx_v_eN;
21228  __pyx_t_4 = 2;
21229  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_elementBarycentersArray_.shape[0];
21230  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_elementBarycentersArray_.shape[1];
21231  __pyx_t_10 = __pyx_v_eN;
21232  __pyx_t_9 = 2;
21233  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_elementBarycentersArray_.shape[0];
21234  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_elementBarycentersArray_.shape[1];
21235  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_10 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_9 * __pyx_v_elementBarycentersArray_.strides[1]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_elementBarycentersArray_.data + __pyx_t_5 * __pyx_v_elementBarycentersArray_.strides[0]) ) + __pyx_t_4 * __pyx_v_elementBarycentersArray_.strides[1]) ))) / (__pyx_v_iN + 1));
21236  }
21237 
21238  /* "mprans/MeshSmoothing.pyx":1480
21239  * elementVolumesArray_[eN] = 1./3.*area_tri*height_tetra
21240  *
21241  * cdef void cyUpdateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
21242  * int[:,:] elementNodesArray,
21243  * double[:,:] nodeArray,
21244  */
21245 
21246  /* function exit code */
21247  __Pyx_RefNannyFinishContext();
21248 }
21249 
21250 /* "mprans/MeshSmoothing.pyx":1501
21251  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21252  *
21253  * cdef np.ndarray cyGetCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
21254  * int[:] nodeStarArray,
21255  * int[:] nodeStarOffsets,
21256  */
21257 
21258 static PyArrayObject *__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle(__Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeMaterialTypes, int __pyx_v_nNodes) {
21259  PyArrayObject *__pyx_v_cornerNodesArray = 0;
21260  double __pyx_v_vec[3];
21261  double __pyx_v_vec2[3];
21262  double __pyx_v_vec_dist;
21263  double __pyx_v_dot;
21264  int __pyx_v_node;
21265  int __pyx_v_nOffset;
21266  PyArrayObject *__pyx_r = NULL;
21267  __Pyx_RefNannyDeclarations
21268  PyObject *__pyx_t_1 = NULL;
21269  PyObject *__pyx_t_2 = NULL;
21270  PyObject *__pyx_t_3 = NULL;
21271  PyObject *__pyx_t_4 = NULL;
21272  PyObject *__pyx_t_5 = NULL;
21273  int __pyx_t_6;
21274  int __pyx_t_7;
21275  int __pyx_t_8;
21276  Py_ssize_t __pyx_t_9;
21277  int __pyx_t_10;
21278  int __pyx_t_11;
21279  int __pyx_t_12;
21280  int __pyx_t_13;
21281  Py_ssize_t __pyx_t_14;
21282  Py_ssize_t __pyx_t_15;
21283  int __pyx_t_16;
21284  Py_ssize_t __pyx_t_17;
21285  Py_ssize_t __pyx_t_18;
21286  Py_ssize_t __pyx_t_19;
21287  int __pyx_t_20;
21288  int __pyx_lineno = 0;
21289  const char *__pyx_filename = NULL;
21290  int __pyx_clineno = 0;
21291  __Pyx_RefNannySetupContext("cyGetCornerNodesTriangle", 0);
21292 
21293  /* "mprans/MeshSmoothing.pyx":1506
21294  * int[:] nodeMaterialTypes,
21295  * int nNodes):
21296  * cdef np.ndarray cornerNodesArray = np.array([], dtype=np.int32) # <<<<<<<<<<<<<<
21297  * cdef double[3] vec
21298  * cdef double[3] vec2
21299  */
21300  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
21301  __Pyx_GOTREF(__pyx_t_1);
21302  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L1_error)
21303  __Pyx_GOTREF(__pyx_t_2);
21304  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21305  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
21306  __Pyx_GOTREF(__pyx_t_1);
21307  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
21308  __Pyx_GOTREF(__pyx_t_3);
21309  __Pyx_GIVEREF(__pyx_t_1);
21310  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
21311  __pyx_t_1 = 0;
21312  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
21313  __Pyx_GOTREF(__pyx_t_1);
21314  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1506, __pyx_L1_error)
21315  __Pyx_GOTREF(__pyx_t_4);
21316  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1506, __pyx_L1_error)
21317  __Pyx_GOTREF(__pyx_t_5);
21318  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21319  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 1506, __pyx_L1_error)
21320  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
21321  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1506, __pyx_L1_error)
21322  __Pyx_GOTREF(__pyx_t_5);
21323  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21324  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21325  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21326  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1506, __pyx_L1_error)
21327  __pyx_v_cornerNodesArray = ((PyArrayObject *)__pyx_t_5);
21328  __pyx_t_5 = 0;
21329 
21330  /* "mprans/MeshSmoothing.pyx":1513
21331  * cdef int node
21332  * cdef int nOffset
21333  * for node in range(nNodes): # <<<<<<<<<<<<<<
21334  * if nodeMaterialTypes[node] != 0:
21335  * vec[0] = 0.
21336  */
21337  __pyx_t_6 = __pyx_v_nNodes;
21338  __pyx_t_7 = __pyx_t_6;
21339  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
21340  __pyx_v_node = __pyx_t_8;
21341 
21342  /* "mprans/MeshSmoothing.pyx":1514
21343  * cdef int nOffset
21344  * for node in range(nNodes):
21345  * if nodeMaterialTypes[node] != 0: # <<<<<<<<<<<<<<
21346  * vec[0] = 0.
21347  * vec[1] = 0.
21348  */
21349  __pyx_t_9 = __pyx_v_node;
21350  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeMaterialTypes.shape[0];
21351  __pyx_t_10 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_9 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
21352  if (__pyx_t_10) {
21353 
21354  /* "mprans/MeshSmoothing.pyx":1515
21355  * for node in range(nNodes):
21356  * if nodeMaterialTypes[node] != 0:
21357  * vec[0] = 0. # <<<<<<<<<<<<<<
21358  * vec[1] = 0.
21359  * vec[2] = 0.
21360  */
21361  (__pyx_v_vec[0]) = 0.;
21362 
21363  /* "mprans/MeshSmoothing.pyx":1516
21364  * if nodeMaterialTypes[node] != 0:
21365  * vec[0] = 0.
21366  * vec[1] = 0. # <<<<<<<<<<<<<<
21367  * vec[2] = 0.
21368  * for nOffset in range(nodeStarOffsets[node],
21369  */
21370  (__pyx_v_vec[1]) = 0.;
21371 
21372  /* "mprans/MeshSmoothing.pyx":1517
21373  * vec[0] = 0.
21374  * vec[1] = 0.
21375  * vec[2] = 0. # <<<<<<<<<<<<<<
21376  * for nOffset in range(nodeStarOffsets[node],
21377  * nodeStarOffsets[node+1]):
21378  */
21379  (__pyx_v_vec[2]) = 0.;
21380 
21381  /* "mprans/MeshSmoothing.pyx":1519
21382  * vec[2] = 0.
21383  * for nOffset in range(nodeStarOffsets[node],
21384  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
21385  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21386  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21387  */
21388  __pyx_t_9 = (__pyx_v_node + 1);
21389  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeStarOffsets.shape[0];
21390  __pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_9 * __pyx_v_nodeStarOffsets.strides[0]) )));
21391 
21392  /* "mprans/MeshSmoothing.pyx":1518
21393  * vec[1] = 0.
21394  * vec[2] = 0.
21395  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
21396  * nodeStarOffsets[node+1]):
21397  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21398  */
21399  __pyx_t_9 = __pyx_v_node;
21400  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeStarOffsets.shape[0];
21401 
21402  /* "mprans/MeshSmoothing.pyx":1519
21403  * vec[2] = 0.
21404  * for nOffset in range(nodeStarOffsets[node],
21405  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
21406  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21407  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21408  */
21409  __pyx_t_12 = __pyx_t_11;
21410  for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_9 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
21411 
21412  /* "mprans/MeshSmoothing.pyx":1518
21413  * vec[1] = 0.
21414  * vec[2] = 0.
21415  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
21416  * nodeStarOffsets[node+1]):
21417  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21418  */
21419  __pyx_v_nOffset = __pyx_t_13;
21420 
21421  /* "mprans/MeshSmoothing.pyx":1520
21422  * for nOffset in range(nodeStarOffsets[node],
21423  * nodeStarOffsets[node+1]):
21424  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
21425  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21426  * # initialize first vector
21427  */
21428  __pyx_t_14 = __pyx_v_nOffset;
21429  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeStarArray.shape[0];
21430  __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_14 * __pyx_v_nodeStarArray.strides[0]) )));
21431  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeMaterialTypes.shape[0];
21432  __pyx_t_10 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_15 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
21433  if (__pyx_t_10) {
21434 
21435  /* "mprans/MeshSmoothing.pyx":1521
21436  * nodeStarOffsets[node+1]):
21437  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21438  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.: # <<<<<<<<<<<<<<
21439  * # initialize first vector
21440  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21441  */
21442  __pyx_t_16 = (((__pyx_v_vec[0]) == 0.) != 0);
21443  if (__pyx_t_16) {
21444  } else {
21445  __pyx_t_10 = __pyx_t_16;
21446  goto __pyx_L10_bool_binop_done;
21447  }
21448  __pyx_t_16 = (((__pyx_v_vec[1]) == 0.) != 0);
21449  if (__pyx_t_16) {
21450  } else {
21451  __pyx_t_10 = __pyx_t_16;
21452  goto __pyx_L10_bool_binop_done;
21453  }
21454  __pyx_t_16 = (((__pyx_v_vec[2]) == 0.) != 0);
21455  __pyx_t_10 = __pyx_t_16;
21456  __pyx_L10_bool_binop_done:;
21457  if (__pyx_t_10) {
21458 
21459  /* "mprans/MeshSmoothing.pyx":1523
21460  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21461  * # initialize first vector
21462  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
21463  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21464  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21465  */
21466  __pyx_t_14 = __pyx_v_node;
21467  __pyx_t_15 = 0;
21468  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray.shape[0];
21469  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[1];
21470  __pyx_t_17 = __pyx_v_nOffset;
21471  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeStarArray.shape[0];
21472  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_17 * __pyx_v_nodeStarArray.strides[0]) )));
21473  __pyx_t_19 = 0;
21474  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray.shape[0];
21475  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[1];
21476  (__pyx_v_vec[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_14 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_15 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_18 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_19 * __pyx_v_nodeArray.strides[1]) ))));
21477 
21478  /* "mprans/MeshSmoothing.pyx":1524
21479  * # initialize first vector
21480  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21481  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
21482  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21483  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21484  */
21485  __pyx_t_17 = __pyx_v_node;
21486  __pyx_t_19 = 1;
21487  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray.shape[0];
21488  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[1];
21489  __pyx_t_18 = __pyx_v_nOffset;
21490  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeStarArray.shape[0];
21491  __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_18 * __pyx_v_nodeStarArray.strides[0]) )));
21492  __pyx_t_14 = 1;
21493  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[0];
21494  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray.shape[1];
21495  (__pyx_v_vec[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_17 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_19 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_15 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArray.strides[1]) ))));
21496 
21497  /* "mprans/MeshSmoothing.pyx":1525
21498  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21499  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21500  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
21501  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21502  * vec[0] = vec[0]/vec_dist
21503  */
21504  __pyx_t_18 = __pyx_v_node;
21505  __pyx_t_14 = 2;
21506  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray.shape[0];
21507  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray.shape[1];
21508  __pyx_t_15 = __pyx_v_nOffset;
21509  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeStarArray.shape[0];
21510  __pyx_t_19 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_15 * __pyx_v_nodeStarArray.strides[0]) )));
21511  __pyx_t_17 = 2;
21512  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[0];
21513  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray.shape[1];
21514  (__pyx_v_vec[2]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_18 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_14 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_19 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray.strides[1]) ))));
21515 
21516  /* "mprans/MeshSmoothing.pyx":1526
21517  * vec[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21518  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21519  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2) # <<<<<<<<<<<<<<
21520  * vec[0] = vec[0]/vec_dist
21521  * vec[1] = vec[1]/vec_dist
21522  */
21523  __pyx_v_vec_dist = sqrt(((pow((__pyx_v_vec[0]), 2.0) + pow((__pyx_v_vec[1]), 2.0)) + pow((__pyx_v_vec[2]), 2.0)));
21524 
21525  /* "mprans/MeshSmoothing.pyx":1527
21526  * vec[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21527  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21528  * vec[0] = vec[0]/vec_dist # <<<<<<<<<<<<<<
21529  * vec[1] = vec[1]/vec_dist
21530  * vec[2] = vec[2]/vec_dist
21531  */
21532  (__pyx_v_vec[0]) = ((__pyx_v_vec[0]) / __pyx_v_vec_dist);
21533 
21534  /* "mprans/MeshSmoothing.pyx":1528
21535  * vec_dist = sqrt(vec[0]**2+vec[1]**2+vec[2]**2)
21536  * vec[0] = vec[0]/vec_dist
21537  * vec[1] = vec[1]/vec_dist # <<<<<<<<<<<<<<
21538  * vec[2] = vec[2]/vec_dist
21539  * else:
21540  */
21541  (__pyx_v_vec[1]) = ((__pyx_v_vec[1]) / __pyx_v_vec_dist);
21542 
21543  /* "mprans/MeshSmoothing.pyx":1529
21544  * vec[0] = vec[0]/vec_dist
21545  * vec[1] = vec[1]/vec_dist
21546  * vec[2] = vec[2]/vec_dist # <<<<<<<<<<<<<<
21547  * else:
21548  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21549  */
21550  (__pyx_v_vec[2]) = ((__pyx_v_vec[2]) / __pyx_v_vec_dist);
21551 
21552  /* "mprans/MeshSmoothing.pyx":1521
21553  * nodeStarOffsets[node+1]):
21554  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
21555  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.: # <<<<<<<<<<<<<<
21556  * # initialize first vector
21557  * vec[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21558  */
21559  goto __pyx_L9;
21560  }
21561 
21562  /* "mprans/MeshSmoothing.pyx":1531
21563  * vec[2] = vec[2]/vec_dist
21564  * else:
21565  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
21566  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21567  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21568  */
21569  /*else*/ {
21570  __pyx_t_15 = __pyx_v_node;
21571  __pyx_t_17 = 0;
21572  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[0];
21573  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray.shape[1];
21574  __pyx_t_19 = __pyx_v_nOffset;
21575  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeStarArray.shape[0];
21576  __pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_19 * __pyx_v_nodeStarArray.strides[0]) )));
21577  __pyx_t_18 = 0;
21578  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray.shape[0];
21579  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray.shape[1];
21580  (__pyx_v_vec2[0]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_15 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_17 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_14 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray.strides[1]) ))));
21581 
21582  /* "mprans/MeshSmoothing.pyx":1532
21583  * else:
21584  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21585  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
21586  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21587  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21588  */
21589  __pyx_t_19 = __pyx_v_node;
21590  __pyx_t_18 = 1;
21591  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[0];
21592  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray.shape[1];
21593  __pyx_t_14 = __pyx_v_nOffset;
21594  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeStarArray.shape[0];
21595  __pyx_t_17 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_14 * __pyx_v_nodeStarArray.strides[0]) )));
21596  __pyx_t_15 = 1;
21597  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeArray.shape[0];
21598  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[1];
21599  (__pyx_v_vec2[1]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_19 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_18 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_17 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_15 * __pyx_v_nodeArray.strides[1]) ))));
21600 
21601  /* "mprans/MeshSmoothing.pyx":1533
21602  * vec2[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
21603  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21604  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
21605  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21606  * vec2[0] = vec2[0]/vec_dist
21607  */
21608  __pyx_t_14 = __pyx_v_node;
21609  __pyx_t_15 = 2;
21610  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeArray.shape[0];
21611  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeArray.shape[1];
21612  __pyx_t_17 = __pyx_v_nOffset;
21613  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_nodeStarArray.shape[0];
21614  __pyx_t_18 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_17 * __pyx_v_nodeStarArray.strides[0]) )));
21615  __pyx_t_19 = 2;
21616  if (__pyx_t_18 < 0) __pyx_t_18 += __pyx_v_nodeArray.shape[0];
21617  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_nodeArray.shape[1];
21618  (__pyx_v_vec2[2]) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_14 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_15 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_18 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_19 * __pyx_v_nodeArray.strides[1]) ))));
21619 
21620  /* "mprans/MeshSmoothing.pyx":1534
21621  * vec2[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
21622  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21623  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2) # <<<<<<<<<<<<<<
21624  * vec2[0] = vec2[0]/vec_dist
21625  * vec2[1] = vec2[1]/vec_dist
21626  */
21627  __pyx_v_vec_dist = sqrt(((pow((__pyx_v_vec2[0]), 2.0) + pow((__pyx_v_vec2[1]), 2.0)) + pow((__pyx_v_vec2[2]), 2.0)));
21628 
21629  /* "mprans/MeshSmoothing.pyx":1535
21630  * vec2[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
21631  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21632  * vec2[0] = vec2[0]/vec_dist # <<<<<<<<<<<<<<
21633  * vec2[1] = vec2[1]/vec_dist
21634  * vec2[2] = vec2[2]/vec_dist
21635  */
21636  (__pyx_v_vec2[0]) = ((__pyx_v_vec2[0]) / __pyx_v_vec_dist);
21637 
21638  /* "mprans/MeshSmoothing.pyx":1536
21639  * vec_dist = sqrt(vec2[0]**2+vec2[1]**2+vec2[2]**2)
21640  * vec2[0] = vec2[0]/vec_dist
21641  * vec2[1] = vec2[1]/vec_dist # <<<<<<<<<<<<<<
21642  * vec2[2] = vec2[2]/vec_dist
21643  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21644  */
21645  (__pyx_v_vec2[1]) = ((__pyx_v_vec2[1]) / __pyx_v_vec_dist);
21646 
21647  /* "mprans/MeshSmoothing.pyx":1537
21648  * vec2[0] = vec2[0]/vec_dist
21649  * vec2[1] = vec2[1]/vec_dist
21650  * vec2[2] = vec2[2]/vec_dist # <<<<<<<<<<<<<<
21651  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21652  * if dot == 1. or dot == -1.:
21653  */
21654  (__pyx_v_vec2[2]) = ((__pyx_v_vec2[2]) / __pyx_v_vec_dist);
21655 
21656  /* "mprans/MeshSmoothing.pyx":1538
21657  * vec2[1] = vec2[1]/vec_dist
21658  * vec2[2] = vec2[2]/vec_dist
21659  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2] # <<<<<<<<<<<<<<
21660  * if dot == 1. or dot == -1.:
21661  * dot = 1
21662  */
21663  __pyx_v_dot = ((((__pyx_v_vec[0]) * (__pyx_v_vec2[0])) + ((__pyx_v_vec[1]) * (__pyx_v_vec2[1]))) + ((__pyx_v_vec[2]) * (__pyx_v_vec2[2])));
21664 
21665  /* "mprans/MeshSmoothing.pyx":1539
21666  * vec2[2] = vec2[2]/vec_dist
21667  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21668  * if dot == 1. or dot == -1.: # <<<<<<<<<<<<<<
21669  * dot = 1
21670  * else:
21671  */
21672  __pyx_t_16 = ((__pyx_v_dot == 1.) != 0);
21673  if (!__pyx_t_16) {
21674  } else {
21675  __pyx_t_10 = __pyx_t_16;
21676  goto __pyx_L14_bool_binop_done;
21677  }
21678  __pyx_t_16 = ((__pyx_v_dot == -1.) != 0);
21679  __pyx_t_10 = __pyx_t_16;
21680  __pyx_L14_bool_binop_done:;
21681  if (__pyx_t_10) {
21682 
21683  /* "mprans/MeshSmoothing.pyx":1540
21684  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21685  * if dot == 1. or dot == -1.:
21686  * dot = 1 # <<<<<<<<<<<<<<
21687  * else:
21688  * cornerNodesArray = np.append(cornerNodesArray, node)
21689  */
21690  __pyx_v_dot = 1.0;
21691 
21692  /* "mprans/MeshSmoothing.pyx":1539
21693  * vec2[2] = vec2[2]/vec_dist
21694  * dot = vec[0]*vec2[0]+vec[1]*vec2[1]+vec[2]*vec2[2]
21695  * if dot == 1. or dot == -1.: # <<<<<<<<<<<<<<
21696  * dot = 1
21697  * else:
21698  */
21699  goto __pyx_L13;
21700  }
21701 
21702  /* "mprans/MeshSmoothing.pyx":1542
21703  * dot = 1
21704  * else:
21705  * cornerNodesArray = np.append(cornerNodesArray, node) # <<<<<<<<<<<<<<
21706  * return cornerNodesArray
21707  *
21708  */
21709  /*else*/ {
21710  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
21711  __Pyx_GOTREF(__pyx_t_1);
21712  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_append); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1542, __pyx_L1_error)
21713  __Pyx_GOTREF(__pyx_t_3);
21714  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21715  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_node); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1542, __pyx_L1_error)
21716  __Pyx_GOTREF(__pyx_t_1);
21717  __pyx_t_2 = NULL;
21718  __pyx_t_20 = 0;
21719  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
21720  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
21721  if (likely(__pyx_t_2)) {
21722  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
21723  __Pyx_INCREF(__pyx_t_2);
21724  __Pyx_INCREF(function);
21725  __Pyx_DECREF_SET(__pyx_t_3, function);
21726  __pyx_t_20 = 1;
21727  }
21728  }
21729  #if CYTHON_FAST_PYCALL
21730  if (PyFunction_Check(__pyx_t_3)) {
21731  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_cornerNodesArray), __pyx_t_1};
21732  __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1542, __pyx_L1_error)
21733  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21734  __Pyx_GOTREF(__pyx_t_5);
21735  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21736  } else
21737  #endif
21738  #if CYTHON_FAST_PYCCALL
21739  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
21740  PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_cornerNodesArray), __pyx_t_1};
21741  __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 2+__pyx_t_20); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1542, __pyx_L1_error)
21742  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21743  __Pyx_GOTREF(__pyx_t_5);
21744  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21745  } else
21746  #endif
21747  {
21748  __pyx_t_4 = PyTuple_New(2+__pyx_t_20); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1542, __pyx_L1_error)
21749  __Pyx_GOTREF(__pyx_t_4);
21750  if (__pyx_t_2) {
21751  __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
21752  }
21753  __Pyx_INCREF(((PyObject *)__pyx_v_cornerNodesArray));
21754  __Pyx_GIVEREF(((PyObject *)__pyx_v_cornerNodesArray));
21755  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_20, ((PyObject *)__pyx_v_cornerNodesArray));
21756  __Pyx_GIVEREF(__pyx_t_1);
21757  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_20, __pyx_t_1);
21758  __pyx_t_1 = 0;
21759  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1542, __pyx_L1_error)
21760  __Pyx_GOTREF(__pyx_t_5);
21761  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
21762  }
21763  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21764  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1542, __pyx_L1_error)
21765  __Pyx_DECREF_SET(__pyx_v_cornerNodesArray, ((PyArrayObject *)__pyx_t_5));
21766  __pyx_t_5 = 0;
21767  }
21768  __pyx_L13:;
21769  }
21770  __pyx_L9:;
21771 
21772  /* "mprans/MeshSmoothing.pyx":1520
21773  * for nOffset in range(nodeStarOffsets[node],
21774  * nodeStarOffsets[node+1]):
21775  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
21776  * if vec[0] == 0. and vec[1] == 0. and vec[2] == 0.:
21777  * # initialize first vector
21778  */
21779  }
21780  }
21781 
21782  /* "mprans/MeshSmoothing.pyx":1514
21783  * cdef int nOffset
21784  * for node in range(nNodes):
21785  * if nodeMaterialTypes[node] != 0: # <<<<<<<<<<<<<<
21786  * vec[0] = 0.
21787  * vec[1] = 0.
21788  */
21789  }
21790  }
21791 
21792  /* "mprans/MeshSmoothing.pyx":1543
21793  * else:
21794  * cornerNodesArray = np.append(cornerNodesArray, node)
21795  * return cornerNodesArray # <<<<<<<<<<<<<<
21796  *
21797  * cdef int[:] cyCheckOwnedVariable(int variable_nb_local,
21798  */
21799  __Pyx_XDECREF(((PyObject *)__pyx_r));
21800  __Pyx_INCREF(((PyObject *)__pyx_v_cornerNodesArray));
21801  __pyx_r = __pyx_v_cornerNodesArray;
21802  goto __pyx_L0;
21803 
21804  /* "mprans/MeshSmoothing.pyx":1501
21805  * elementBarycentersArray_[eN, 2] = elementBarycentersArray_[eN, 2]/(iN+1)
21806  *
21807  * cdef np.ndarray cyGetCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
21808  * int[:] nodeStarArray,
21809  * int[:] nodeStarOffsets,
21810  */
21811 
21812  /* function exit code */
21813  __pyx_L1_error:;
21814  __Pyx_XDECREF(__pyx_t_1);
21815  __Pyx_XDECREF(__pyx_t_2);
21816  __Pyx_XDECREF(__pyx_t_3);
21817  __Pyx_XDECREF(__pyx_t_4);
21818  __Pyx_XDECREF(__pyx_t_5);
21819  __Pyx_AddTraceback("mprans.MeshSmoothing.cyGetCornerNodesTriangle", __pyx_clineno, __pyx_lineno, __pyx_filename);
21820  __pyx_r = 0;
21821  __pyx_L0:;
21822  __Pyx_XDECREF((PyObject *)__pyx_v_cornerNodesArray);
21823  __Pyx_XGIVEREF((PyObject *)__pyx_r);
21824  __Pyx_RefNannyFinishContext();
21825  return __pyx_r;
21826 }
21827 
21828 /* "mprans/MeshSmoothing.pyx":1545
21829  * return cornerNodesArray
21830  *
21831  * cdef int[:] cyCheckOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
21832  * int rank,
21833  * int nVariables_owned,
21834  */
21835 
21836 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable(int __pyx_v_variable_nb_local, int __pyx_v_rank, int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
21837  int __pyx_v_nSubdomains;
21838  int __pyx_v_variable_nb_global;
21839  int __pyx_v_new_variable_nb_local;
21840  int __pyx_v_new_rank;
21841  int __pyx_v_i;
21842  int __pyx_v_result[2];
21843  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
21844  __Pyx_RefNannyDeclarations
21845  int __pyx_t_1[2];
21846  int __pyx_t_2;
21847  Py_ssize_t __pyx_t_3;
21848  Py_ssize_t __pyx_t_4;
21849  int __pyx_t_5;
21850  long __pyx_t_6;
21851  long __pyx_t_7;
21852  int __pyx_t_8;
21853  struct __pyx_array_obj *__pyx_t_9 = NULL;
21854  PyObject *__pyx_t_10 = NULL;
21855  PyObject *__pyx_t_11 = NULL;
21856  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
21857  int __pyx_lineno = 0;
21858  const char *__pyx_filename = NULL;
21859  int __pyx_clineno = 0;
21860  __Pyx_RefNannySetupContext("cyCheckOwnedVariable", 0);
21861 
21862  /* "mprans/MeshSmoothing.pyx":1550
21863  * int[:] variableNumbering_subdomain2global,
21864  * int[:] variableOffsets_subdomain_owned):
21865  * cdef int nSubdomains = variableOffsets_subdomain_owned.shape[0]-1 # <<<<<<<<<<<<<<
21866  * cdef int variable_nb_global
21867  * cdef int new_variable_nb_local
21868  */
21869  __pyx_v_nSubdomains = ((__pyx_v_variableOffsets_subdomain_owned.shape[0]) - 1);
21870 
21871  /* "mprans/MeshSmoothing.pyx":1553
21872  * cdef int variable_nb_global
21873  * cdef int new_variable_nb_local
21874  * cdef int new_rank = -2 # initialised as fake rank # <<<<<<<<<<<<<<
21875  * cdef int i
21876  * cdef int[2] result = [-1000, -1000]
21877  */
21878  __pyx_v_new_rank = -2;
21879 
21880  /* "mprans/MeshSmoothing.pyx":1555
21881  * cdef int new_rank = -2 # initialised as fake rank
21882  * cdef int i
21883  * cdef int[2] result = [-1000, -1000] # <<<<<<<<<<<<<<
21884  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
21885  * result[0] = variable_nb_local
21886  */
21887  __pyx_t_1[0] = -1000;
21888  __pyx_t_1[1] = -1000;
21889  memcpy(&(__pyx_v_result[0]), __pyx_t_1, sizeof(__pyx_v_result[0]) * (2));
21890 
21891  /* "mprans/MeshSmoothing.pyx":1557
21892  * cdef int[2] result = [-1000, -1000]
21893  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
21894  * result[0] = variable_nb_local # <<<<<<<<<<<<<<
21895  * result[1] = new_rank
21896  * if variable_nb_local >= nVariables_owned:
21897  */
21898  (__pyx_v_result[0]) = __pyx_v_variable_nb_local;
21899 
21900  /* "mprans/MeshSmoothing.pyx":1558
21901  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
21902  * result[0] = variable_nb_local
21903  * result[1] = new_rank # <<<<<<<<<<<<<<
21904  * if variable_nb_local >= nVariables_owned:
21905  * # change rank ownership
21906  */
21907  (__pyx_v_result[1]) = __pyx_v_new_rank;
21908 
21909  /* "mprans/MeshSmoothing.pyx":1559
21910  * result[0] = variable_nb_local
21911  * result[1] = new_rank
21912  * if variable_nb_local >= nVariables_owned: # <<<<<<<<<<<<<<
21913  * # change rank ownership
21914  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
21915  */
21916  __pyx_t_2 = ((__pyx_v_variable_nb_local >= __pyx_v_nVariables_owned) != 0);
21917  if (__pyx_t_2) {
21918 
21919  /* "mprans/MeshSmoothing.pyx":1561
21920  * if variable_nb_local >= nVariables_owned:
21921  * # change rank ownership
21922  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local] # <<<<<<<<<<<<<<
21923  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
21924  * for i in range(nSubdomains+1):
21925  */
21926  __pyx_t_3 = __pyx_v_variable_nb_local;
21927  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableNumbering_subdomain2global.shape[0];
21928  __pyx_v_variable_nb_global = (*((int *) ( /* dim=0 */ (__pyx_v_variableNumbering_subdomain2global.data + __pyx_t_3 * __pyx_v_variableNumbering_subdomain2global.strides[0]) )));
21929 
21930  /* "mprans/MeshSmoothing.pyx":1562
21931  * # change rank ownership
21932  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
21933  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
21934  * for i in range(nSubdomains+1):
21935  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
21936  */
21937  __pyx_t_3 = __pyx_v_rank;
21938  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
21939  __pyx_t_2 = ((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_3 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) <= __pyx_v_variable_nb_global);
21940  if (__pyx_t_2) {
21941  __pyx_t_4 = (__pyx_v_rank + 1);
21942  if (__pyx_t_4 < 0) __pyx_t_4 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
21943  __pyx_t_2 = (__pyx_v_variable_nb_global < (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_4 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
21944  }
21945  __pyx_t_5 = ((!(__pyx_t_2 != 0)) != 0);
21946  if (__pyx_t_5) {
21947 
21948  /* "mprans/MeshSmoothing.pyx":1563
21949  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
21950  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
21951  * for i in range(nSubdomains+1): # <<<<<<<<<<<<<<
21952  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
21953  * # changing processor
21954  */
21955  __pyx_t_6 = (__pyx_v_nSubdomains + 1);
21956  __pyx_t_7 = __pyx_t_6;
21957  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
21958  __pyx_v_i = __pyx_t_8;
21959 
21960  /* "mprans/MeshSmoothing.pyx":1564
21961  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
21962  * for i in range(nSubdomains+1):
21963  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
21964  * # changing processor
21965  * if new_rank == -2:
21966  */
21967  __pyx_t_3 = __pyx_v_i;
21968  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
21969  __pyx_t_5 = (((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_3 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) > __pyx_v_variable_nb_global) != 0);
21970  if (__pyx_t_5) {
21971 
21972  /* "mprans/MeshSmoothing.pyx":1566
21973  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
21974  * # changing processor
21975  * if new_rank == -2: # <<<<<<<<<<<<<<
21976  * new_rank = i-1
21977  * # getting nearest variable number on new rank
21978  */
21979  __pyx_t_5 = ((__pyx_v_new_rank == -2L) != 0);
21980  if (__pyx_t_5) {
21981 
21982  /* "mprans/MeshSmoothing.pyx":1567
21983  * # changing processor
21984  * if new_rank == -2:
21985  * new_rank = i-1 # <<<<<<<<<<<<<<
21986  * # getting nearest variable number on new rank
21987  * if new_rank >= 0:
21988  */
21989  __pyx_v_new_rank = (__pyx_v_i - 1);
21990 
21991  /* "mprans/MeshSmoothing.pyx":1566
21992  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
21993  * # changing processor
21994  * if new_rank == -2: # <<<<<<<<<<<<<<
21995  * new_rank = i-1
21996  * # getting nearest variable number on new rank
21997  */
21998  }
21999 
22000  /* "mprans/MeshSmoothing.pyx":1564
22001  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
22002  * for i in range(nSubdomains+1):
22003  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
22004  * # changing processor
22005  * if new_rank == -2:
22006  */
22007  }
22008  }
22009 
22010  /* "mprans/MeshSmoothing.pyx":1562
22011  * # change rank ownership
22012  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22013  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
22014  * for i in range(nSubdomains+1):
22015  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22016  */
22017  }
22018 
22019  /* "mprans/MeshSmoothing.pyx":1559
22020  * result[0] = variable_nb_local
22021  * result[1] = new_rank
22022  * if variable_nb_local >= nVariables_owned: # <<<<<<<<<<<<<<
22023  * # change rank ownership
22024  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22025  */
22026  }
22027 
22028  /* "mprans/MeshSmoothing.pyx":1569
22029  * new_rank = i-1
22030  * # getting nearest variable number on new rank
22031  * if new_rank >= 0: # <<<<<<<<<<<<<<
22032  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank]
22033  * else:
22034  */
22035  __pyx_t_5 = ((__pyx_v_new_rank >= 0) != 0);
22036  if (__pyx_t_5) {
22037 
22038  /* "mprans/MeshSmoothing.pyx":1570
22039  * # getting nearest variable number on new rank
22040  * if new_rank >= 0:
22041  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank] # <<<<<<<<<<<<<<
22042  * else:
22043  * new_rank = rank
22044  */
22045  __pyx_t_3 = __pyx_v_new_rank;
22046  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
22047  __pyx_v_new_variable_nb_local = (__pyx_v_variable_nb_global - (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_3 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
22048 
22049  /* "mprans/MeshSmoothing.pyx":1569
22050  * new_rank = i-1
22051  * # getting nearest variable number on new rank
22052  * if new_rank >= 0: # <<<<<<<<<<<<<<
22053  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank]
22054  * else:
22055  */
22056  goto __pyx_L9;
22057  }
22058 
22059  /* "mprans/MeshSmoothing.pyx":1572
22060  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[new_rank]
22061  * else:
22062  * new_rank = rank # <<<<<<<<<<<<<<
22063  * new_variable_nb_local = variable_nb_local
22064  * result[0] = new_variable_nb_local
22065  */
22066  /*else*/ {
22067  __pyx_v_new_rank = __pyx_v_rank;
22068 
22069  /* "mprans/MeshSmoothing.pyx":1573
22070  * else:
22071  * new_rank = rank
22072  * new_variable_nb_local = variable_nb_local # <<<<<<<<<<<<<<
22073  * result[0] = new_variable_nb_local
22074  * result[1] = new_rank
22075  */
22076  __pyx_v_new_variable_nb_local = __pyx_v_variable_nb_local;
22077  }
22078  __pyx_L9:;
22079 
22080  /* "mprans/MeshSmoothing.pyx":1574
22081  * new_rank = rank
22082  * new_variable_nb_local = variable_nb_local
22083  * result[0] = new_variable_nb_local # <<<<<<<<<<<<<<
22084  * result[1] = new_rank
22085  * return result
22086  */
22087  (__pyx_v_result[0]) = __pyx_v_new_variable_nb_local;
22088 
22089  /* "mprans/MeshSmoothing.pyx":1575
22090  * new_variable_nb_local = variable_nb_local
22091  * result[0] = new_variable_nb_local
22092  * result[1] = new_rank # <<<<<<<<<<<<<<
22093  * return result
22094  *
22095  */
22096  (__pyx_v_result[1]) = __pyx_v_new_rank;
22097 
22098  /* "mprans/MeshSmoothing.pyx":1576
22099  * result[0] = new_variable_nb_local
22100  * result[1] = new_rank
22101  * return result # <<<<<<<<<<<<<<
22102  *
22103  * cdef void cyFindBoundaryDirectionTriangle(
22104  */
22105  __pyx_t_11 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1576, __pyx_L1_error)
22106  __Pyx_GOTREF(__pyx_t_11);
22107  __pyx_t_10 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)2)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1576, __pyx_L1_error)
22108  __Pyx_GOTREF(__pyx_t_10);
22109  __pyx_t_9 = __pyx_array_new(__pyx_t_10, sizeof(int), PyBytes_AS_STRING(__pyx_t_11), (char *) "fortran", (char *) __pyx_v_result);
22110  if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1576, __pyx_L1_error)
22111  __Pyx_GOTREF(__pyx_t_9);
22112  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
22113  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
22114  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_t_9), PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 1576, __pyx_L1_error)
22115  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
22116  __pyx_r = __pyx_t_12;
22117  __pyx_t_12.memview = NULL;
22118  __pyx_t_12.data = NULL;
22119  goto __pyx_L0;
22120 
22121  /* "mprans/MeshSmoothing.pyx":1545
22122  * return cornerNodesArray
22123  *
22124  * cdef int[:] cyCheckOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
22125  * int rank,
22126  * int nVariables_owned,
22127  */
22128 
22129  /* function exit code */
22130  __pyx_L1_error:;
22131  __Pyx_XDECREF(((PyObject *)__pyx_t_9));
22132  __Pyx_XDECREF(__pyx_t_10);
22133  __Pyx_XDECREF(__pyx_t_11);
22134  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
22135  __pyx_r.data = NULL;
22136  __pyx_r.memview = NULL;
22137  __Pyx_AddTraceback("mprans.MeshSmoothing.cyCheckOwnedVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
22138  goto __pyx_L2;
22139  __pyx_L0:;
22140  if (unlikely(!__pyx_r.memview)) {
22141  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
22142  }
22143  __pyx_L2:;
22144  __Pyx_RefNannyFinishContext();
22145  return __pyx_r;
22146 }
22147 
22148 /* "mprans/MeshSmoothing.pyx":1578
22149  * return result
22150  *
22151  * cdef void cyFindBoundaryDirectionTriangle( # <<<<<<<<<<<<<<
22152  * double[:] dir_,
22153  * int node,
22154  */
22155 
22156 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle(__Pyx_memviewslice __pyx_v_dir_, int __pyx_v_node, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes) {
22157  double __pyx_v_dir_dist;
22158  int __pyx_v_nOffset;
22159  __Pyx_RefNannyDeclarations
22160  Py_ssize_t __pyx_t_1;
22161  int __pyx_t_2;
22162  int __pyx_t_3;
22163  int __pyx_t_4;
22164  Py_ssize_t __pyx_t_5;
22165  Py_ssize_t __pyx_t_6;
22166  int __pyx_t_7;
22167  Py_ssize_t __pyx_t_8;
22168  Py_ssize_t __pyx_t_9;
22169  Py_ssize_t __pyx_t_10;
22170  Py_ssize_t __pyx_t_11;
22171  __Pyx_RefNannySetupContext("cyFindBoundaryDirectionTriangle", 0);
22172 
22173  /* "mprans/MeshSmoothing.pyx":1589
22174  * cdef int nOffset
22175  * for nOffset in range(nodeStarOffsets[node],
22176  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22177  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22178  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22179  */
22180  __pyx_t_1 = (__pyx_v_node + 1);
22181  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeStarOffsets.shape[0];
22182  __pyx_t_2 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_1 * __pyx_v_nodeStarOffsets.strides[0]) )));
22183 
22184  /* "mprans/MeshSmoothing.pyx":1588
22185  * cdef double dir_dist
22186  * cdef int nOffset
22187  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22188  * nodeStarOffsets[node+1]):
22189  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22190  */
22191  __pyx_t_1 = __pyx_v_node;
22192  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeStarOffsets.shape[0];
22193 
22194  /* "mprans/MeshSmoothing.pyx":1589
22195  * cdef int nOffset
22196  * for nOffset in range(nodeStarOffsets[node],
22197  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22198  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22199  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22200  */
22201  __pyx_t_3 = __pyx_t_2;
22202  for (__pyx_t_4 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_1 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
22203 
22204  /* "mprans/MeshSmoothing.pyx":1588
22205  * cdef double dir_dist
22206  * cdef int nOffset
22207  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22208  * nodeStarOffsets[node+1]):
22209  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22210  */
22211  __pyx_v_nOffset = __pyx_t_4;
22212 
22213  /* "mprans/MeshSmoothing.pyx":1590
22214  * for nOffset in range(nodeStarOffsets[node],
22215  * nodeStarOffsets[node+1]):
22216  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22217  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22218  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22219  */
22220  __pyx_t_5 = __pyx_v_nOffset;
22221  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeStarArray.shape[0];
22222  __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_5 * __pyx_v_nodeStarArray.strides[0]) )));
22223  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeMaterialTypes.shape[0];
22224  __pyx_t_7 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_6 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
22225  if (__pyx_t_7) {
22226 
22227  /* "mprans/MeshSmoothing.pyx":1591
22228  * nodeStarOffsets[node+1]):
22229  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22230  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0] # <<<<<<<<<<<<<<
22231  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22232  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22233  */
22234  __pyx_t_5 = __pyx_v_node;
22235  __pyx_t_6 = 0;
22236  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeArray.shape[0];
22237  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeArray.shape[1];
22238  __pyx_t_8 = __pyx_v_nOffset;
22239  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nodeStarArray.shape[0];
22240  __pyx_t_9 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_8 * __pyx_v_nodeStarArray.strides[0]) )));
22241  __pyx_t_10 = 0;
22242  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeArray.shape[0];
22243  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArray.shape[1];
22244  __pyx_t_11 = 0;
22245  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dir_.shape[0];
22246  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_11 * __pyx_v_dir_.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_5 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_6 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_9 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_10 * __pyx_v_nodeArray.strides[1]) ))));
22247 
22248  /* "mprans/MeshSmoothing.pyx":1592
22249  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22250  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22251  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1] # <<<<<<<<<<<<<<
22252  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22253  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22254  */
22255  __pyx_t_8 = __pyx_v_node;
22256  __pyx_t_10 = 1;
22257  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nodeArray.shape[0];
22258  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArray.shape[1];
22259  __pyx_t_9 = __pyx_v_nOffset;
22260  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeStarArray.shape[0];
22261  __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_9 * __pyx_v_nodeStarArray.strides[0]) )));
22262  __pyx_t_5 = 1;
22263  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeArray.shape[0];
22264  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeArray.shape[1];
22265  __pyx_t_11 = 1;
22266  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dir_.shape[0];
22267  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_11 * __pyx_v_dir_.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_8 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_10 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_6 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_5 * __pyx_v_nodeArray.strides[1]) ))));
22268 
22269  /* "mprans/MeshSmoothing.pyx":1593
22270  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22271  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22272  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2] # <<<<<<<<<<<<<<
22273  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22274  * dir_[0] = abs(dir_[0])/dir_dist
22275  */
22276  __pyx_t_9 = __pyx_v_node;
22277  __pyx_t_5 = 2;
22278  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeArray.shape[0];
22279  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeArray.shape[1];
22280  __pyx_t_6 = __pyx_v_nOffset;
22281  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeStarArray.shape[0];
22282  __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_6 * __pyx_v_nodeStarArray.strides[0]) )));
22283  __pyx_t_8 = 2;
22284  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeArray.shape[0];
22285  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_nodeArray.shape[1];
22286  __pyx_t_11 = 2;
22287  if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_v_dir_.shape[0];
22288  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_11 * __pyx_v_dir_.strides[0]) )) = ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_9 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_5 * __pyx_v_nodeArray.strides[1]) ))) - (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_nodeArray.data + __pyx_t_10 * __pyx_v_nodeArray.strides[0]) ) + __pyx_t_8 * __pyx_v_nodeArray.strides[1]) ))));
22289 
22290  /* "mprans/MeshSmoothing.pyx":1594
22291  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22292  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22293  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2) # <<<<<<<<<<<<<<
22294  * dir_[0] = abs(dir_[0])/dir_dist
22295  * dir_[1] = abs(dir_[1])/dir_dist
22296  */
22297  __pyx_t_6 = 0;
22298  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22299  __pyx_t_8 = 1;
22300  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dir_.shape[0];
22301  __pyx_t_10 = 2;
22302  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dir_.shape[0];
22303  __pyx_v_dir_dist = sqrt(((pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) ))), 2.0) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_8 * __pyx_v_dir_.strides[0]) ))), 2.0)) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_10 * __pyx_v_dir_.strides[0]) ))), 2.0)));
22304 
22305  /* "mprans/MeshSmoothing.pyx":1595
22306  * dir_[2] = nodeArray[node, 2]-nodeArray[nodeStarArray[nOffset], 2]
22307  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22308  * dir_[0] = abs(dir_[0])/dir_dist # <<<<<<<<<<<<<<
22309  * dir_[1] = abs(dir_[1])/dir_dist
22310  * dir_[2] = abs(dir_[2])/dir_dist
22311  */
22312  __pyx_t_10 = 0;
22313  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dir_.shape[0];
22314  __pyx_t_8 = 0;
22315  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dir_.shape[0];
22316  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_8 * __pyx_v_dir_.strides[0]) )) = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_10 * __pyx_v_dir_.strides[0]) )))) / __pyx_v_dir_dist);
22317 
22318  /* "mprans/MeshSmoothing.pyx":1596
22319  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22320  * dir_[0] = abs(dir_[0])/dir_dist
22321  * dir_[1] = abs(dir_[1])/dir_dist # <<<<<<<<<<<<<<
22322  * dir_[2] = abs(dir_[2])/dir_dist
22323  *
22324  */
22325  __pyx_t_10 = 1;
22326  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dir_.shape[0];
22327  __pyx_t_8 = 1;
22328  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dir_.shape[0];
22329  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_8 * __pyx_v_dir_.strides[0]) )) = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_10 * __pyx_v_dir_.strides[0]) )))) / __pyx_v_dir_dist);
22330 
22331  /* "mprans/MeshSmoothing.pyx":1597
22332  * dir_[0] = abs(dir_[0])/dir_dist
22333  * dir_[1] = abs(dir_[1])/dir_dist
22334  * dir_[2] = abs(dir_[2])/dir_dist # <<<<<<<<<<<<<<
22335  *
22336  * cdef void cyFindBoundaryDirectionTetra(
22337  */
22338  __pyx_t_10 = 2;
22339  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_dir_.shape[0];
22340  __pyx_t_8 = 2;
22341  if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_v_dir_.shape[0];
22342  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_8 * __pyx_v_dir_.strides[0]) )) = (fabs((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_10 * __pyx_v_dir_.strides[0]) )))) / __pyx_v_dir_dist);
22343 
22344  /* "mprans/MeshSmoothing.pyx":1590
22345  * for nOffset in range(nodeStarOffsets[node],
22346  * nodeStarOffsets[node+1]):
22347  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22348  * dir_[0] = nodeArray[node, 0]-nodeArray[nodeStarArray[nOffset], 0]
22349  * dir_[1] = nodeArray[node, 1]-nodeArray[nodeStarArray[nOffset], 1]
22350  */
22351  }
22352  }
22353 
22354  /* "mprans/MeshSmoothing.pyx":1578
22355  * return result
22356  *
22357  * cdef void cyFindBoundaryDirectionTriangle( # <<<<<<<<<<<<<<
22358  * double[:] dir_,
22359  * int node,
22360  */
22361 
22362  /* function exit code */
22363  __Pyx_RefNannyFinishContext();
22364 }
22365 
22366 /* "mprans/MeshSmoothing.pyx":1599
22367  * dir_[2] = abs(dir_[2])/dir_dist
22368  *
22369  * cdef void cyFindBoundaryDirectionTetra( # <<<<<<<<<<<<<<
22370  * double[:] dir_,
22371  * int node,
22372  */
22373 
22374 static void __pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra(__Pyx_memviewslice __pyx_v_dir_, int __pyx_v_node, __Pyx_memviewslice __pyx_v_nodeArray, __Pyx_memviewslice __pyx_v_nodeStarOffsets, __Pyx_memviewslice __pyx_v_nodeStarArray, __Pyx_memviewslice __pyx_v_nodeMaterialTypes) {
22375  double __pyx_v_U[3];
22376  double __pyx_v_V[3];
22377  double __pyx_v_dir_dist;
22378  __Pyx_memviewslice __pyx_v_node0 = { 0, 0, { 0 }, { 0 }, { 0 } };
22379  __Pyx_memviewslice __pyx_v_node1 = { 0, 0, { 0 }, { 0 }, { 0 } };
22380  __Pyx_memviewslice __pyx_v_node2 = { 0, 0, { 0 }, { 0 }, { 0 } };
22381  double __pyx_v_nNode;
22382  int __pyx_v_nOffset;
22383  __Pyx_RefNannyDeclarations
22384  Py_ssize_t __pyx_t_1;
22385  int __pyx_t_2;
22386  int __pyx_t_3;
22387  int __pyx_t_4;
22388  Py_ssize_t __pyx_t_5;
22389  Py_ssize_t __pyx_t_6;
22390  int __pyx_t_7;
22391  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
22392  int __pyx_lineno = 0;
22393  const char *__pyx_filename = NULL;
22394  int __pyx_clineno = 0;
22395  __Pyx_RefNannySetupContext("cyFindBoundaryDirectionTetra", 0);
22396 
22397  /* "mprans/MeshSmoothing.pyx":1614
22398  * cdef double[:] node1
22399  * cdef double[:] node2
22400  * cdef double nNode = 0 # <<<<<<<<<<<<<<
22401  * cdef int nOffset
22402  * # get normal
22403  */
22404  __pyx_v_nNode = 0.0;
22405 
22406  /* "mprans/MeshSmoothing.pyx":1618
22407  * # get normal
22408  * for nOffset in range(nodeStarOffsets[node],
22409  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22410  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22411  * nNode += 1
22412  */
22413  __pyx_t_1 = (__pyx_v_node + 1);
22414  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeStarOffsets.shape[0];
22415  __pyx_t_2 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_1 * __pyx_v_nodeStarOffsets.strides[0]) )));
22416 
22417  /* "mprans/MeshSmoothing.pyx":1617
22418  * cdef int nOffset
22419  * # get normal
22420  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22421  * nodeStarOffsets[node+1]):
22422  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22423  */
22424  __pyx_t_1 = __pyx_v_node;
22425  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_nodeStarOffsets.shape[0];
22426 
22427  /* "mprans/MeshSmoothing.pyx":1618
22428  * # get normal
22429  * for nOffset in range(nodeStarOffsets[node],
22430  * nodeStarOffsets[node+1]): # <<<<<<<<<<<<<<
22431  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22432  * nNode += 1
22433  */
22434  __pyx_t_3 = __pyx_t_2;
22435  for (__pyx_t_4 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarOffsets.data + __pyx_t_1 * __pyx_v_nodeStarOffsets.strides[0]) ))); __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
22436 
22437  /* "mprans/MeshSmoothing.pyx":1617
22438  * cdef int nOffset
22439  * # get normal
22440  * for nOffset in range(nodeStarOffsets[node], # <<<<<<<<<<<<<<
22441  * nodeStarOffsets[node+1]):
22442  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22443  */
22444  __pyx_v_nOffset = __pyx_t_4;
22445 
22446  /* "mprans/MeshSmoothing.pyx":1619
22447  * for nOffset in range(nodeStarOffsets[node],
22448  * nodeStarOffsets[node+1]):
22449  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22450  * nNode += 1
22451  * if nNode == 1:
22452  */
22453  __pyx_t_5 = __pyx_v_nOffset;
22454  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeStarArray.shape[0];
22455  __pyx_t_6 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_5 * __pyx_v_nodeStarArray.strides[0]) )));
22456  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_nodeMaterialTypes.shape[0];
22457  __pyx_t_7 = (((*((int *) ( /* dim=0 */ (__pyx_v_nodeMaterialTypes.data + __pyx_t_6 * __pyx_v_nodeMaterialTypes.strides[0]) ))) != 0) != 0);
22458  if (__pyx_t_7) {
22459 
22460  /* "mprans/MeshSmoothing.pyx":1620
22461  * nodeStarOffsets[node+1]):
22462  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22463  * nNode += 1 # <<<<<<<<<<<<<<
22464  * if nNode == 1:
22465  * node0 = nodeArray[nodeStarArray[nOffset]]
22466  */
22467  __pyx_v_nNode = (__pyx_v_nNode + 1.0);
22468 
22469  /* "mprans/MeshSmoothing.pyx":1621
22470  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22471  * nNode += 1
22472  * if nNode == 1: # <<<<<<<<<<<<<<
22473  * node0 = nodeArray[nodeStarArray[nOffset]]
22474  * elif nNode == 2:
22475  */
22476  __pyx_t_7 = ((__pyx_v_nNode == 1.0) != 0);
22477  if (__pyx_t_7) {
22478 
22479  /* "mprans/MeshSmoothing.pyx":1622
22480  * nNode += 1
22481  * if nNode == 1:
22482  * node0 = nodeArray[nodeStarArray[nOffset]] # <<<<<<<<<<<<<<
22483  * elif nNode == 2:
22484  * node1 = nodeArray[nodeStarArray[nOffset]]
22485  */
22486  __pyx_t_5 = __pyx_v_nOffset;
22487  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeStarArray.shape[0];
22488  __pyx_t_8.data = __pyx_v_nodeArray.data;
22489  __pyx_t_8.memview = __pyx_v_nodeArray.memview;
22490  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
22491  {
22492  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_5 * __pyx_v_nodeStarArray.strides[0]) )));
22493  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
22494  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
22495  if (__pyx_tmp_idx < 0)
22496  __pyx_tmp_idx += __pyx_tmp_shape;
22497  __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
22498 }
22499 
22500 __pyx_t_8.shape[0] = __pyx_v_nodeArray.shape[1];
22501 __pyx_t_8.strides[0] = __pyx_v_nodeArray.strides[1];
22502  __pyx_t_8.suboffsets[0] = -1;
22503 
22504 __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
22505  __pyx_v_node0 = __pyx_t_8;
22506  __pyx_t_8.memview = NULL;
22507  __pyx_t_8.data = NULL;
22508 
22509  /* "mprans/MeshSmoothing.pyx":1621
22510  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0:
22511  * nNode += 1
22512  * if nNode == 1: # <<<<<<<<<<<<<<
22513  * node0 = nodeArray[nodeStarArray[nOffset]]
22514  * elif nNode == 2:
22515  */
22516  goto __pyx_L6;
22517  }
22518 
22519  /* "mprans/MeshSmoothing.pyx":1623
22520  * if nNode == 1:
22521  * node0 = nodeArray[nodeStarArray[nOffset]]
22522  * elif nNode == 2: # <<<<<<<<<<<<<<
22523  * node1 = nodeArray[nodeStarArray[nOffset]]
22524  * elif nNode == 3:
22525  */
22526  __pyx_t_7 = ((__pyx_v_nNode == 2.0) != 0);
22527  if (__pyx_t_7) {
22528 
22529  /* "mprans/MeshSmoothing.pyx":1624
22530  * node0 = nodeArray[nodeStarArray[nOffset]]
22531  * elif nNode == 2:
22532  * node1 = nodeArray[nodeStarArray[nOffset]] # <<<<<<<<<<<<<<
22533  * elif nNode == 3:
22534  * node2 = nodeArray[nodeStarArray[nOffset]]
22535  */
22536  __pyx_t_5 = __pyx_v_nOffset;
22537  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeStarArray.shape[0];
22538  __pyx_t_8.data = __pyx_v_nodeArray.data;
22539  __pyx_t_8.memview = __pyx_v_nodeArray.memview;
22540  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
22541  {
22542  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_5 * __pyx_v_nodeStarArray.strides[0]) )));
22543  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
22544  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
22545  if (__pyx_tmp_idx < 0)
22546  __pyx_tmp_idx += __pyx_tmp_shape;
22547  __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
22548 }
22549 
22550 __pyx_t_8.shape[0] = __pyx_v_nodeArray.shape[1];
22551 __pyx_t_8.strides[0] = __pyx_v_nodeArray.strides[1];
22552  __pyx_t_8.suboffsets[0] = -1;
22553 
22554 __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
22555  __pyx_v_node1 = __pyx_t_8;
22556  __pyx_t_8.memview = NULL;
22557  __pyx_t_8.data = NULL;
22558 
22559  /* "mprans/MeshSmoothing.pyx":1623
22560  * if nNode == 1:
22561  * node0 = nodeArray[nodeStarArray[nOffset]]
22562  * elif nNode == 2: # <<<<<<<<<<<<<<
22563  * node1 = nodeArray[nodeStarArray[nOffset]]
22564  * elif nNode == 3:
22565  */
22566  goto __pyx_L6;
22567  }
22568 
22569  /* "mprans/MeshSmoothing.pyx":1625
22570  * elif nNode == 2:
22571  * node1 = nodeArray[nodeStarArray[nOffset]]
22572  * elif nNode == 3: # <<<<<<<<<<<<<<
22573  * node2 = nodeArray[nodeStarArray[nOffset]]
22574  * assert nNode > 3, 'error looking for dir_'
22575  */
22576  __pyx_t_7 = ((__pyx_v_nNode == 3.0) != 0);
22577  if (__pyx_t_7) {
22578 
22579  /* "mprans/MeshSmoothing.pyx":1626
22580  * node1 = nodeArray[nodeStarArray[nOffset]]
22581  * elif nNode == 3:
22582  * node2 = nodeArray[nodeStarArray[nOffset]] # <<<<<<<<<<<<<<
22583  * assert nNode > 3, 'error looking for dir_'
22584  * U[0] = node1[0]-node0[0]
22585  */
22586  __pyx_t_5 = __pyx_v_nOffset;
22587  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_nodeStarArray.shape[0];
22588  __pyx_t_8.data = __pyx_v_nodeArray.data;
22589  __pyx_t_8.memview = __pyx_v_nodeArray.memview;
22590  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
22591  {
22592  Py_ssize_t __pyx_tmp_idx = (*((int *) ( /* dim=0 */ (__pyx_v_nodeStarArray.data + __pyx_t_5 * __pyx_v_nodeStarArray.strides[0]) )));
22593  Py_ssize_t __pyx_tmp_shape = __pyx_v_nodeArray.shape[0];
22594  Py_ssize_t __pyx_tmp_stride = __pyx_v_nodeArray.strides[0];
22595  if (__pyx_tmp_idx < 0)
22596  __pyx_tmp_idx += __pyx_tmp_shape;
22597  __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
22598 }
22599 
22600 __pyx_t_8.shape[0] = __pyx_v_nodeArray.shape[1];
22601 __pyx_t_8.strides[0] = __pyx_v_nodeArray.strides[1];
22602  __pyx_t_8.suboffsets[0] = -1;
22603 
22604 __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
22605  __pyx_v_node2 = __pyx_t_8;
22606  __pyx_t_8.memview = NULL;
22607  __pyx_t_8.data = NULL;
22608 
22609  /* "mprans/MeshSmoothing.pyx":1625
22610  * elif nNode == 2:
22611  * node1 = nodeArray[nodeStarArray[nOffset]]
22612  * elif nNode == 3: # <<<<<<<<<<<<<<
22613  * node2 = nodeArray[nodeStarArray[nOffset]]
22614  * assert nNode > 3, 'error looking for dir_'
22615  */
22616  }
22617  __pyx_L6:;
22618 
22619  /* "mprans/MeshSmoothing.pyx":1619
22620  * for nOffset in range(nodeStarOffsets[node],
22621  * nodeStarOffsets[node+1]):
22622  * if nodeMaterialTypes[nodeStarArray[nOffset]] != 0: # <<<<<<<<<<<<<<
22623  * nNode += 1
22624  * if nNode == 1:
22625  */
22626  }
22627  }
22628 
22629  /* "mprans/MeshSmoothing.pyx":1627
22630  * elif nNode == 3:
22631  * node2 = nodeArray[nodeStarArray[nOffset]]
22632  * assert nNode > 3, 'error looking for dir_' # <<<<<<<<<<<<<<
22633  * U[0] = node1[0]-node0[0]
22634  * U[1] = node1[1]-node0[1]
22635  */
22636  #ifndef CYTHON_WITHOUT_ASSERTIONS
22637  if (unlikely(!Py_OptimizeFlag)) {
22638  if (unlikely(!((__pyx_v_nNode > 3.0) != 0))) {
22639  PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_error_looking_for_dir);
22640  __PYX_ERR(0, 1627, __pyx_L1_error)
22641  }
22642  }
22643  #endif
22644 
22645  /* "mprans/MeshSmoothing.pyx":1628
22646  * node2 = nodeArray[nodeStarArray[nOffset]]
22647  * assert nNode > 3, 'error looking for dir_'
22648  * U[0] = node1[0]-node0[0] # <<<<<<<<<<<<<<
22649  * U[1] = node1[1]-node0[1]
22650  * U[2] = node1[2]-node0[2]
22651  */
22652  __pyx_t_1 = 0;
22653  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_node1.shape[0];
22654  __pyx_t_5 = 0;
22655  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
22656  (__pyx_v_U[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_1 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
22657 
22658  /* "mprans/MeshSmoothing.pyx":1629
22659  * assert nNode > 3, 'error looking for dir_'
22660  * U[0] = node1[0]-node0[0]
22661  * U[1] = node1[1]-node0[1] # <<<<<<<<<<<<<<
22662  * U[2] = node1[2]-node0[2]
22663  * V[0] = node2[0]-node0[0]
22664  */
22665  __pyx_t_5 = 1;
22666  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node1.shape[0];
22667  __pyx_t_1 = 1;
22668  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_node0.shape[0];
22669  (__pyx_v_U[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_5 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_1 * __pyx_v_node0.strides[0]) ))));
22670 
22671  /* "mprans/MeshSmoothing.pyx":1630
22672  * U[0] = node1[0]-node0[0]
22673  * U[1] = node1[1]-node0[1]
22674  * U[2] = node1[2]-node0[2] # <<<<<<<<<<<<<<
22675  * V[0] = node2[0]-node0[0]
22676  * V[1] = node2[1]-node0[1]
22677  */
22678  __pyx_t_1 = 2;
22679  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_node1.shape[0];
22680  __pyx_t_5 = 2;
22681  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
22682  (__pyx_v_U[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node1.data + __pyx_t_1 * __pyx_v_node1.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
22683 
22684  /* "mprans/MeshSmoothing.pyx":1631
22685  * U[1] = node1[1]-node0[1]
22686  * U[2] = node1[2]-node0[2]
22687  * V[0] = node2[0]-node0[0] # <<<<<<<<<<<<<<
22688  * V[1] = node2[1]-node0[1]
22689  * V[2] = node2[2]-node0[2]
22690  */
22691  __pyx_t_5 = 0;
22692  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node2.shape[0];
22693  __pyx_t_1 = 0;
22694  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_node0.shape[0];
22695  (__pyx_v_V[0]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_5 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_1 * __pyx_v_node0.strides[0]) ))));
22696 
22697  /* "mprans/MeshSmoothing.pyx":1632
22698  * U[2] = node1[2]-node0[2]
22699  * V[0] = node2[0]-node0[0]
22700  * V[1] = node2[1]-node0[1] # <<<<<<<<<<<<<<
22701  * V[2] = node2[2]-node0[2]
22702  * dir_[0] = U[1]*V[2]-U[2]*V[1]
22703  */
22704  __pyx_t_1 = 1;
22705  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_node2.shape[0];
22706  __pyx_t_5 = 1;
22707  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node0.shape[0];
22708  (__pyx_v_V[1]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_1 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_5 * __pyx_v_node0.strides[0]) ))));
22709 
22710  /* "mprans/MeshSmoothing.pyx":1633
22711  * V[0] = node2[0]-node0[0]
22712  * V[1] = node2[1]-node0[1]
22713  * V[2] = node2[2]-node0[2] # <<<<<<<<<<<<<<
22714  * dir_[0] = U[1]*V[2]-U[2]*V[1]
22715  * dir_[1] = U[2]*V[0]-U[0]*V[2]
22716  */
22717  __pyx_t_5 = 2;
22718  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_node2.shape[0];
22719  __pyx_t_1 = 2;
22720  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_node0.shape[0];
22721  (__pyx_v_V[2]) = ((*((double *) ( /* dim=0 */ (__pyx_v_node2.data + __pyx_t_5 * __pyx_v_node2.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_node0.data + __pyx_t_1 * __pyx_v_node0.strides[0]) ))));
22722 
22723  /* "mprans/MeshSmoothing.pyx":1634
22724  * V[1] = node2[1]-node0[1]
22725  * V[2] = node2[2]-node0[2]
22726  * dir_[0] = U[1]*V[2]-U[2]*V[1] # <<<<<<<<<<<<<<
22727  * dir_[1] = U[2]*V[0]-U[0]*V[2]
22728  * dir_[2] = U[0]*V[1]-U[1]*V[0]
22729  */
22730  __pyx_t_1 = 0;
22731  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_dir_.shape[0];
22732  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_1 * __pyx_v_dir_.strides[0]) )) = (((__pyx_v_U[1]) * (__pyx_v_V[2])) - ((__pyx_v_U[2]) * (__pyx_v_V[1])));
22733 
22734  /* "mprans/MeshSmoothing.pyx":1635
22735  * V[2] = node2[2]-node0[2]
22736  * dir_[0] = U[1]*V[2]-U[2]*V[1]
22737  * dir_[1] = U[2]*V[0]-U[0]*V[2] # <<<<<<<<<<<<<<
22738  * dir_[2] = U[0]*V[1]-U[1]*V[0]
22739  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22740  */
22741  __pyx_t_1 = 1;
22742  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_dir_.shape[0];
22743  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_1 * __pyx_v_dir_.strides[0]) )) = (((__pyx_v_U[2]) * (__pyx_v_V[0])) - ((__pyx_v_U[0]) * (__pyx_v_V[2])));
22744 
22745  /* "mprans/MeshSmoothing.pyx":1636
22746  * dir_[0] = U[1]*V[2]-U[2]*V[1]
22747  * dir_[1] = U[2]*V[0]-U[0]*V[2]
22748  * dir_[2] = U[0]*V[1]-U[1]*V[0] # <<<<<<<<<<<<<<
22749  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22750  * dir_[0] /= dir_dist
22751  */
22752  __pyx_t_1 = 2;
22753  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_dir_.shape[0];
22754  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_1 * __pyx_v_dir_.strides[0]) )) = (((__pyx_v_U[0]) * (__pyx_v_V[1])) - ((__pyx_v_U[1]) * (__pyx_v_V[0])));
22755 
22756  /* "mprans/MeshSmoothing.pyx":1637
22757  * dir_[1] = U[2]*V[0]-U[0]*V[2]
22758  * dir_[2] = U[0]*V[1]-U[1]*V[0]
22759  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2) # <<<<<<<<<<<<<<
22760  * dir_[0] /= dir_dist
22761  * dir_[1] /= dir_dist
22762  */
22763  __pyx_t_1 = 0;
22764  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_dir_.shape[0];
22765  __pyx_t_5 = 1;
22766  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dir_.shape[0];
22767  __pyx_t_6 = 2;
22768  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22769  __pyx_v_dir_dist = sqrt(((pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_1 * __pyx_v_dir_.strides[0]) ))), 2.0) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_5 * __pyx_v_dir_.strides[0]) ))), 2.0)) + pow((*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) ))), 2.0)));
22770 
22771  /* "mprans/MeshSmoothing.pyx":1638
22772  * dir_[2] = U[0]*V[1]-U[1]*V[0]
22773  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22774  * dir_[0] /= dir_dist # <<<<<<<<<<<<<<
22775  * dir_[1] /= dir_dist
22776  * dir_[2] /= dir_dist
22777  */
22778  __pyx_t_6 = 0;
22779  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22780  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) )) /= __pyx_v_dir_dist;
22781 
22782  /* "mprans/MeshSmoothing.pyx":1639
22783  * dir_dist = sqrt(dir_[0]**2+dir_[1]**2+dir_[2]**2)
22784  * dir_[0] /= dir_dist
22785  * dir_[1] /= dir_dist # <<<<<<<<<<<<<<
22786  * dir_[2] /= dir_dist
22787  * dir_[0] = abs(1-dir_[0])
22788  */
22789  __pyx_t_6 = 1;
22790  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22791  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) )) /= __pyx_v_dir_dist;
22792 
22793  /* "mprans/MeshSmoothing.pyx":1640
22794  * dir_[0] /= dir_dist
22795  * dir_[1] /= dir_dist
22796  * dir_[2] /= dir_dist # <<<<<<<<<<<<<<
22797  * dir_[0] = abs(1-dir_[0])
22798  * dir_[1] = abs(1-dir_[1])
22799  */
22800  __pyx_t_6 = 2;
22801  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22802  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) )) /= __pyx_v_dir_dist;
22803 
22804  /* "mprans/MeshSmoothing.pyx":1641
22805  * dir_[1] /= dir_dist
22806  * dir_[2] /= dir_dist
22807  * dir_[0] = abs(1-dir_[0]) # <<<<<<<<<<<<<<
22808  * dir_[1] = abs(1-dir_[1])
22809  * dir_[2] = abs(1-dir_[2])
22810  */
22811  __pyx_t_6 = 0;
22812  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22813  __pyx_t_5 = 0;
22814  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dir_.shape[0];
22815  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_5 * __pyx_v_dir_.strides[0]) )) = fabs((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) )))));
22816 
22817  /* "mprans/MeshSmoothing.pyx":1642
22818  * dir_[2] /= dir_dist
22819  * dir_[0] = abs(1-dir_[0])
22820  * dir_[1] = abs(1-dir_[1]) # <<<<<<<<<<<<<<
22821  * dir_[2] = abs(1-dir_[2])
22822  *
22823  */
22824  __pyx_t_6 = 1;
22825  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22826  __pyx_t_5 = 1;
22827  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dir_.shape[0];
22828  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_5 * __pyx_v_dir_.strides[0]) )) = fabs((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) )))));
22829 
22830  /* "mprans/MeshSmoothing.pyx":1643
22831  * dir_[0] = abs(1-dir_[0])
22832  * dir_[1] = abs(1-dir_[1])
22833  * dir_[2] = abs(1-dir_[2]) # <<<<<<<<<<<<<<
22834  *
22835  * cdef int[:] cyGetGlobalVariable(int variable_nb_local,
22836  */
22837  __pyx_t_6 = 2;
22838  if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_v_dir_.shape[0];
22839  __pyx_t_5 = 2;
22840  if (__pyx_t_5 < 0) __pyx_t_5 += __pyx_v_dir_.shape[0];
22841  *((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_5 * __pyx_v_dir_.strides[0]) )) = fabs((1.0 - (*((double *) ( /* dim=0 */ (__pyx_v_dir_.data + __pyx_t_6 * __pyx_v_dir_.strides[0]) )))));
22842 
22843  /* "mprans/MeshSmoothing.pyx":1599
22844  * dir_[2] = abs(dir_[2])/dir_dist
22845  *
22846  * cdef void cyFindBoundaryDirectionTetra( # <<<<<<<<<<<<<<
22847  * double[:] dir_,
22848  * int node,
22849  */
22850 
22851  /* function exit code */
22852  goto __pyx_L0;
22853  __pyx_L1_error:;
22854  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
22855  __Pyx_WriteUnraisable("mprans.MeshSmoothing.cyFindBoundaryDirectionTetra", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
22856  __pyx_L0:;
22857  __PYX_XDEC_MEMVIEW(&__pyx_v_node0, 1);
22858  __PYX_XDEC_MEMVIEW(&__pyx_v_node1, 1);
22859  __PYX_XDEC_MEMVIEW(&__pyx_v_node2, 1);
22860  __Pyx_RefNannyFinishContext();
22861 }
22862 
22863 /* "mprans/MeshSmoothing.pyx":1645
22864  * dir_[2] = abs(1-dir_[2])
22865  *
22866  * cdef int[:] cyGetGlobalVariable(int variable_nb_local, # <<<<<<<<<<<<<<
22867  * int nVariables_owned,
22868  * int[:] variableNumbering_subdomain2global,
22869  */
22870 
22871 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyGetGlobalVariable(int __pyx_v_variable_nb_local, CYTHON_UNUSED int __pyx_v_nVariables_owned, __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
22872  int __pyx_v_nSubdomains;
22873  int __pyx_v_variable_nb_global;
22874  int __pyx_v_new_rank;
22875  int __pyx_v_i;
22876  int __pyx_v_result[2];
22877  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
22878  __Pyx_RefNannyDeclarations
22879  size_t __pyx_t_1;
22880  Py_ssize_t __pyx_t_2;
22881  long __pyx_t_3;
22882  long __pyx_t_4;
22883  int __pyx_t_5;
22884  int __pyx_t_6;
22885  struct __pyx_array_obj *__pyx_t_7 = NULL;
22886  PyObject *__pyx_t_8 = NULL;
22887  PyObject *__pyx_t_9 = NULL;
22888  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
22889  int __pyx_lineno = 0;
22890  const char *__pyx_filename = NULL;
22891  int __pyx_clineno = 0;
22892  __Pyx_RefNannySetupContext("cyGetGlobalVariable", 0);
22893 
22894  /* "mprans/MeshSmoothing.pyx":1649
22895  * int[:] variableNumbering_subdomain2global,
22896  * int[:] variableOffsets_subdomain_owned):
22897  * cdef int nSubdomains = len(variableOffsets_subdomain_owned)-1 # <<<<<<<<<<<<<<
22898  * cdef int variable_nb_global
22899  * cdef int new_rank = -2 # initialised as fake rank
22900  */
22901  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_variableOffsets_subdomain_owned);
22902  __pyx_v_nSubdomains = (__pyx_t_1 - 1);
22903 
22904  /* "mprans/MeshSmoothing.pyx":1651
22905  * cdef int nSubdomains = len(variableOffsets_subdomain_owned)-1
22906  * cdef int variable_nb_global
22907  * cdef int new_rank = -2 # initialised as fake rank # <<<<<<<<<<<<<<
22908  * # change rank ownership
22909  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22910  */
22911  __pyx_v_new_rank = -2;
22912 
22913  /* "mprans/MeshSmoothing.pyx":1653
22914  * cdef int new_rank = -2 # initialised as fake rank
22915  * # change rank ownership
22916  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local] # <<<<<<<<<<<<<<
22917  * cdef int i
22918  * cdef int[2] result
22919  */
22920  __pyx_t_2 = __pyx_v_variable_nb_local;
22921  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_variableNumbering_subdomain2global.shape[0];
22922  __pyx_v_variable_nb_global = (*((int *) ( /* dim=0 */ (__pyx_v_variableNumbering_subdomain2global.data + __pyx_t_2 * __pyx_v_variableNumbering_subdomain2global.strides[0]) )));
22923 
22924  /* "mprans/MeshSmoothing.pyx":1657
22925  * cdef int[2] result
22926  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
22927  * result[0] = variable_nb_global # <<<<<<<<<<<<<<
22928  * result[1] = new_rank
22929  * for i in range(nSubdomains+1):
22930  */
22931  (__pyx_v_result[0]) = __pyx_v_variable_nb_global;
22932 
22933  /* "mprans/MeshSmoothing.pyx":1658
22934  * # cdef int[:] result = np.zeros(2, dtype=np.int32)
22935  * result[0] = variable_nb_global
22936  * result[1] = new_rank # <<<<<<<<<<<<<<
22937  * for i in range(nSubdomains+1):
22938  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22939  */
22940  (__pyx_v_result[1]) = __pyx_v_new_rank;
22941 
22942  /* "mprans/MeshSmoothing.pyx":1659
22943  * result[0] = variable_nb_global
22944  * result[1] = new_rank
22945  * for i in range(nSubdomains+1): # <<<<<<<<<<<<<<
22946  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22947  * # changing processor
22948  */
22949  __pyx_t_3 = (__pyx_v_nSubdomains + 1);
22950  __pyx_t_4 = __pyx_t_3;
22951  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
22952  __pyx_v_i = __pyx_t_5;
22953 
22954  /* "mprans/MeshSmoothing.pyx":1660
22955  * result[1] = new_rank
22956  * for i in range(nSubdomains+1):
22957  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
22958  * # changing processor
22959  * if new_rank == -2:
22960  */
22961  __pyx_t_2 = __pyx_v_i;
22962  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
22963  __pyx_t_6 = (((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_2 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) > __pyx_v_variable_nb_global) != 0);
22964  if (__pyx_t_6) {
22965 
22966  /* "mprans/MeshSmoothing.pyx":1662
22967  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22968  * # changing processor
22969  * if new_rank == -2: # <<<<<<<<<<<<<<
22970  * new_rank = i-1
22971  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22972  */
22973  __pyx_t_6 = ((__pyx_v_new_rank == -2L) != 0);
22974  if (__pyx_t_6) {
22975 
22976  /* "mprans/MeshSmoothing.pyx":1663
22977  * # changing processor
22978  * if new_rank == -2:
22979  * new_rank = i-1 # <<<<<<<<<<<<<<
22980  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22981  * result[0] = variable_nb_global
22982  */
22983  __pyx_v_new_rank = (__pyx_v_i - 1);
22984 
22985  /* "mprans/MeshSmoothing.pyx":1662
22986  * if variableOffsets_subdomain_owned[i] > variable_nb_global:
22987  * # changing processor
22988  * if new_rank == -2: # <<<<<<<<<<<<<<
22989  * new_rank = i-1
22990  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
22991  */
22992  }
22993 
22994  /* "mprans/MeshSmoothing.pyx":1660
22995  * result[1] = new_rank
22996  * for i in range(nSubdomains+1):
22997  * if variableOffsets_subdomain_owned[i] > variable_nb_global: # <<<<<<<<<<<<<<
22998  * # changing processor
22999  * if new_rank == -2:
23000  */
23001  }
23002  }
23003 
23004  /* "mprans/MeshSmoothing.pyx":1664
23005  * if new_rank == -2:
23006  * new_rank = i-1
23007  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local] # <<<<<<<<<<<<<<
23008  * result[0] = variable_nb_global
23009  * result[1] = new_rank
23010  */
23011  __pyx_t_2 = __pyx_v_variable_nb_local;
23012  if (__pyx_t_2 < 0) __pyx_t_2 += __pyx_v_variableNumbering_subdomain2global.shape[0];
23013  __pyx_v_variable_nb_global = (*((int *) ( /* dim=0 */ (__pyx_v_variableNumbering_subdomain2global.data + __pyx_t_2 * __pyx_v_variableNumbering_subdomain2global.strides[0]) )));
23014 
23015  /* "mprans/MeshSmoothing.pyx":1665
23016  * new_rank = i-1
23017  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23018  * result[0] = variable_nb_global # <<<<<<<<<<<<<<
23019  * result[1] = new_rank
23020  * return result
23021  */
23022  (__pyx_v_result[0]) = __pyx_v_variable_nb_global;
23023 
23024  /* "mprans/MeshSmoothing.pyx":1666
23025  * variable_nb_global = variableNumbering_subdomain2global[variable_nb_local]
23026  * result[0] = variable_nb_global
23027  * result[1] = new_rank # <<<<<<<<<<<<<<
23028  * return result
23029  *
23030  */
23031  (__pyx_v_result[1]) = __pyx_v_new_rank;
23032 
23033  /* "mprans/MeshSmoothing.pyx":1667
23034  * result[0] = variable_nb_global
23035  * result[1] = new_rank
23036  * return result # <<<<<<<<<<<<<<
23037  *
23038  * cdef int cyGetLocalVariable(int variable_nb_global,
23039  */
23040  __pyx_t_9 = __pyx_format_from_typeinfo(&__Pyx_TypeInfo_int); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1667, __pyx_L1_error)
23041  __Pyx_GOTREF(__pyx_t_9);
23042  __pyx_t_8 = Py_BuildValue((char*) "(" __PYX_BUILD_PY_SSIZE_T ")", ((Py_ssize_t)2)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1667, __pyx_L1_error)
23043  __Pyx_GOTREF(__pyx_t_8);
23044  __pyx_t_7 = __pyx_array_new(__pyx_t_8, sizeof(int), PyBytes_AS_STRING(__pyx_t_9), (char *) "fortran", (char *) __pyx_v_result);
23045  if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1667, __pyx_L1_error)
23046  __Pyx_GOTREF(__pyx_t_7);
23047  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
23048  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
23049  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(((PyObject *)__pyx_t_7), PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1667, __pyx_L1_error)
23050  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
23051  __pyx_r = __pyx_t_10;
23052  __pyx_t_10.memview = NULL;
23053  __pyx_t_10.data = NULL;
23054  goto __pyx_L0;
23055 
23056  /* "mprans/MeshSmoothing.pyx":1645
23057  * dir_[2] = abs(1-dir_[2])
23058  *
23059  * cdef int[:] cyGetGlobalVariable(int variable_nb_local, # <<<<<<<<<<<<<<
23060  * int nVariables_owned,
23061  * int[:] variableNumbering_subdomain2global,
23062  */
23063 
23064  /* function exit code */
23065  __pyx_L1_error:;
23066  __Pyx_XDECREF(((PyObject *)__pyx_t_7));
23067  __Pyx_XDECREF(__pyx_t_8);
23068  __Pyx_XDECREF(__pyx_t_9);
23069  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
23070  __pyx_r.data = NULL;
23071  __pyx_r.memview = NULL;
23072  __Pyx_AddTraceback("mprans.MeshSmoothing.cyGetGlobalVariable", __pyx_clineno, __pyx_lineno, __pyx_filename);
23073  goto __pyx_L2;
23074  __pyx_L0:;
23075  if (unlikely(!__pyx_r.memview)) {
23076  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
23077  }
23078  __pyx_L2:;
23079  __Pyx_RefNannyFinishContext();
23080  return __pyx_r;
23081 }
23082 
23083 /* "mprans/MeshSmoothing.pyx":1669
23084  * return result
23085  *
23086  * cdef int cyGetLocalVariable(int variable_nb_global, # <<<<<<<<<<<<<<
23087  * int rank,
23088  * int nVariables_owned,
23089  */
23090 
23091 static int __pyx_f_6mprans_13MeshSmoothing_cyGetLocalVariable(int __pyx_v_variable_nb_global, int __pyx_v_rank, int __pyx_v_nVariables_owned, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_variableNumbering_subdomain2global, __Pyx_memviewslice __pyx_v_variableOffsets_subdomain_owned) {
23092  int __pyx_v_new_variable_nb_local;
23093  int __pyx_r;
23094  __Pyx_RefNannyDeclarations
23095  Py_ssize_t __pyx_t_1;
23096  int __pyx_t_2;
23097  Py_ssize_t __pyx_t_3;
23098  int __pyx_t_4;
23099  __Pyx_RefNannySetupContext("cyGetLocalVariable", 0);
23100 
23101  /* "mprans/MeshSmoothing.pyx":1675
23102  * int[:] variableOffsets_subdomain_owned):
23103  * cdef int new_variable_nb_local
23104  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
23105  * if variable_nb_global < nVariables_owned:
23106  * new_variable_nb_local = variable_nb_global
23107  */
23108  __pyx_t_1 = __pyx_v_rank;
23109  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23110  __pyx_t_2 = ((*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_1 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))) <= __pyx_v_variable_nb_global);
23111  if (__pyx_t_2) {
23112  __pyx_t_3 = (__pyx_v_rank + 1);
23113  if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23114  __pyx_t_2 = (__pyx_v_variable_nb_global < (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_3 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
23115  }
23116  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
23117  if (__pyx_t_4) {
23118 
23119  /* "mprans/MeshSmoothing.pyx":1676
23120  * cdef int new_variable_nb_local
23121  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
23122  * if variable_nb_global < nVariables_owned: # <<<<<<<<<<<<<<
23123  * new_variable_nb_local = variable_nb_global
23124  * else:
23125  */
23126  __pyx_t_4 = ((__pyx_v_variable_nb_global < __pyx_v_nVariables_owned) != 0);
23127  if (__pyx_t_4) {
23128 
23129  /* "mprans/MeshSmoothing.pyx":1677
23130  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
23131  * if variable_nb_global < nVariables_owned:
23132  * new_variable_nb_local = variable_nb_global # <<<<<<<<<<<<<<
23133  * else:
23134  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[rank]
23135  */
23136  __pyx_v_new_variable_nb_local = __pyx_v_variable_nb_global;
23137 
23138  /* "mprans/MeshSmoothing.pyx":1676
23139  * cdef int new_variable_nb_local
23140  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]:
23141  * if variable_nb_global < nVariables_owned: # <<<<<<<<<<<<<<
23142  * new_variable_nb_local = variable_nb_global
23143  * else:
23144  */
23145  }
23146 
23147  /* "mprans/MeshSmoothing.pyx":1675
23148  * int[:] variableOffsets_subdomain_owned):
23149  * cdef int new_variable_nb_local
23150  * if not variableOffsets_subdomain_owned[rank] <= variable_nb_global < variableOffsets_subdomain_owned[rank+1]: # <<<<<<<<<<<<<<
23151  * if variable_nb_global < nVariables_owned:
23152  * new_variable_nb_local = variable_nb_global
23153  */
23154  goto __pyx_L3;
23155  }
23156 
23157  /* "mprans/MeshSmoothing.pyx":1679
23158  * new_variable_nb_local = variable_nb_global
23159  * else:
23160  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[rank] # <<<<<<<<<<<<<<
23161  * return new_variable_nb_local
23162  *
23163  */
23164  /*else*/ {
23165  __pyx_t_1 = __pyx_v_rank;
23166  if (__pyx_t_1 < 0) __pyx_t_1 += __pyx_v_variableOffsets_subdomain_owned.shape[0];
23167  __pyx_v_new_variable_nb_local = (__pyx_v_variable_nb_global - (*((int *) ( /* dim=0 */ (__pyx_v_variableOffsets_subdomain_owned.data + __pyx_t_1 * __pyx_v_variableOffsets_subdomain_owned.strides[0]) ))));
23168  }
23169  __pyx_L3:;
23170 
23171  /* "mprans/MeshSmoothing.pyx":1680
23172  * else:
23173  * new_variable_nb_local = variable_nb_global-variableOffsets_subdomain_owned[rank]
23174  * return new_variable_nb_local # <<<<<<<<<<<<<<
23175  *
23176  * cdef double[:] cyScalarRecoveryAtNodes(double[:] scalars,
23177  */
23178  __pyx_r = __pyx_v_new_variable_nb_local;
23179  goto __pyx_L0;
23180 
23181  /* "mprans/MeshSmoothing.pyx":1669
23182  * return result
23183  *
23184  * cdef int cyGetLocalVariable(int variable_nb_global, # <<<<<<<<<<<<<<
23185  * int rank,
23186  * int nVariables_owned,
23187  */
23188 
23189  /* function exit code */
23190  __pyx_L0:;
23191  __Pyx_RefNannyFinishContext();
23192  return __pyx_r;
23193 }
23194 
23195 /* "mprans/MeshSmoothing.pyx":1682
23196  * return new_variable_nb_local
23197  *
23198  * cdef double[:] cyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
23199  * int[:] nodeElementsArray,
23200  * int[:] nodeElementOffsets):
23201  */
23202 
23203 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes(__Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets) {
23204  __Pyx_memviewslice __pyx_v_recovered_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
23205  int __pyx_v_nb_el;
23206  double __pyx_v_var_sum;
23207  int __pyx_v_node;
23208  int __pyx_v_eOffset;
23209  int __pyx_v_nNodes;
23210  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
23211  __Pyx_RefNannyDeclarations
23212  PyObject *__pyx_t_1 = NULL;
23213  PyObject *__pyx_t_2 = NULL;
23214  PyObject *__pyx_t_3 = NULL;
23215  size_t __pyx_t_4;
23216  PyObject *__pyx_t_5 = NULL;
23217  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
23218  int __pyx_t_7;
23219  int __pyx_t_8;
23220  int __pyx_t_9;
23221  Py_ssize_t __pyx_t_10;
23222  int __pyx_t_11;
23223  int __pyx_t_12;
23224  int __pyx_t_13;
23225  Py_ssize_t __pyx_t_14;
23226  Py_ssize_t __pyx_t_15;
23227  int __pyx_lineno = 0;
23228  const char *__pyx_filename = NULL;
23229  int __pyx_clineno = 0;
23230  __Pyx_RefNannySetupContext("cyScalarRecoveryAtNodes", 0);
23231 
23232  /* "mprans/MeshSmoothing.pyx":1685
23233  * int[:] nodeElementsArray,
23234  * int[:] nodeElementOffsets):
23235  * cdef double[:] recovered_scalars = np.zeros(len(nodeElementOffsets)-1) # <<<<<<<<<<<<<<
23236  * cdef int nb_el
23237  * cdef double var_sum
23238  */
23239  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error)
23240  __Pyx_GOTREF(__pyx_t_2);
23241  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1685, __pyx_L1_error)
23242  __Pyx_GOTREF(__pyx_t_3);
23243  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23244  __pyx_t_4 = __Pyx_MemoryView_Len(__pyx_v_nodeElementOffsets);
23245  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1685, __pyx_L1_error)
23246  __Pyx_GOTREF(__pyx_t_2);
23247  __pyx_t_5 = NULL;
23248  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23249  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
23250  if (likely(__pyx_t_5)) {
23251  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23252  __Pyx_INCREF(__pyx_t_5);
23253  __Pyx_INCREF(function);
23254  __Pyx_DECREF_SET(__pyx_t_3, function);
23255  }
23256  }
23257  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
23258  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
23259  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23260  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1685, __pyx_L1_error)
23261  __Pyx_GOTREF(__pyx_t_1);
23262  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23263  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1685, __pyx_L1_error)
23264  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23265  __pyx_v_recovered_scalars = __pyx_t_6;
23266  __pyx_t_6.memview = NULL;
23267  __pyx_t_6.data = NULL;
23268 
23269  /* "mprans/MeshSmoothing.pyx":1690
23270  * cdef int node
23271  * cdef int eOffset
23272  * cdef int nNodes = nodeElementOffsets.shape[0]-1 # <<<<<<<<<<<<<<
23273  * for node in range(nNodes):
23274  * nb_el = 0
23275  */
23276  __pyx_v_nNodes = ((__pyx_v_nodeElementOffsets.shape[0]) - 1);
23277 
23278  /* "mprans/MeshSmoothing.pyx":1691
23279  * cdef int eOffset
23280  * cdef int nNodes = nodeElementOffsets.shape[0]-1
23281  * for node in range(nNodes): # <<<<<<<<<<<<<<
23282  * nb_el = 0
23283  * var_sum = 0
23284  */
23285  __pyx_t_7 = __pyx_v_nNodes;
23286  __pyx_t_8 = __pyx_t_7;
23287  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
23288  __pyx_v_node = __pyx_t_9;
23289 
23290  /* "mprans/MeshSmoothing.pyx":1692
23291  * cdef int nNodes = nodeElementOffsets.shape[0]-1
23292  * for node in range(nNodes):
23293  * nb_el = 0 # <<<<<<<<<<<<<<
23294  * var_sum = 0
23295  * for eOffset in range(nodeElementOffsets[node],
23296  */
23297  __pyx_v_nb_el = 0;
23298 
23299  /* "mprans/MeshSmoothing.pyx":1693
23300  * for node in range(nNodes):
23301  * nb_el = 0
23302  * var_sum = 0 # <<<<<<<<<<<<<<
23303  * for eOffset in range(nodeElementOffsets[node],
23304  * nodeElementOffsets[node+1]):
23305  */
23306  __pyx_v_var_sum = 0.0;
23307 
23308  /* "mprans/MeshSmoothing.pyx":1695
23309  * var_sum = 0
23310  * for eOffset in range(nodeElementOffsets[node],
23311  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23312  * nb_el += 1
23313  * var_sum += scalars[nodeElementsArray[eOffset]]
23314  */
23315  __pyx_t_10 = (__pyx_v_node + 1);
23316  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeElementOffsets.shape[0];
23317  __pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_10 * __pyx_v_nodeElementOffsets.strides[0]) )));
23318 
23319  /* "mprans/MeshSmoothing.pyx":1694
23320  * nb_el = 0
23321  * var_sum = 0
23322  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23323  * nodeElementOffsets[node+1]):
23324  * nb_el += 1
23325  */
23326  __pyx_t_10 = __pyx_v_node;
23327  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_nodeElementOffsets.shape[0];
23328 
23329  /* "mprans/MeshSmoothing.pyx":1695
23330  * var_sum = 0
23331  * for eOffset in range(nodeElementOffsets[node],
23332  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23333  * nb_el += 1
23334  * var_sum += scalars[nodeElementsArray[eOffset]]
23335  */
23336  __pyx_t_12 = __pyx_t_11;
23337  for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_10 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
23338 
23339  /* "mprans/MeshSmoothing.pyx":1694
23340  * nb_el = 0
23341  * var_sum = 0
23342  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23343  * nodeElementOffsets[node+1]):
23344  * nb_el += 1
23345  */
23346  __pyx_v_eOffset = __pyx_t_13;
23347 
23348  /* "mprans/MeshSmoothing.pyx":1696
23349  * for eOffset in range(nodeElementOffsets[node],
23350  * nodeElementOffsets[node+1]):
23351  * nb_el += 1 # <<<<<<<<<<<<<<
23352  * var_sum += scalars[nodeElementsArray[eOffset]]
23353  * recovered_scalars[node] = var_sum/nb_el
23354  */
23355  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
23356 
23357  /* "mprans/MeshSmoothing.pyx":1697
23358  * nodeElementOffsets[node+1]):
23359  * nb_el += 1
23360  * var_sum += scalars[nodeElementsArray[eOffset]] # <<<<<<<<<<<<<<
23361  * recovered_scalars[node] = var_sum/nb_el
23362  * return recovered_scalars
23363  */
23364  __pyx_t_14 = __pyx_v_eOffset;
23365  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeElementsArray.shape[0];
23366  __pyx_t_15 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_14 * __pyx_v_nodeElementsArray.strides[0]) )));
23367  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_scalars.shape[0];
23368  __pyx_v_var_sum = (__pyx_v_var_sum + (*((double *) ( /* dim=0 */ (__pyx_v_scalars.data + __pyx_t_15 * __pyx_v_scalars.strides[0]) ))));
23369  }
23370 
23371  /* "mprans/MeshSmoothing.pyx":1698
23372  * nb_el += 1
23373  * var_sum += scalars[nodeElementsArray[eOffset]]
23374  * recovered_scalars[node] = var_sum/nb_el # <<<<<<<<<<<<<<
23375  * return recovered_scalars
23376  *
23377  */
23378  __pyx_t_10 = __pyx_v_node;
23379  if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_v_recovered_scalars.shape[0];
23380  *((double *) ( /* dim=0 */ (__pyx_v_recovered_scalars.data + __pyx_t_10 * __pyx_v_recovered_scalars.strides[0]) )) = (__pyx_v_var_sum / __pyx_v_nb_el);
23381  }
23382 
23383  /* "mprans/MeshSmoothing.pyx":1699
23384  * var_sum += scalars[nodeElementsArray[eOffset]]
23385  * recovered_scalars[node] = var_sum/nb_el
23386  * return recovered_scalars # <<<<<<<<<<<<<<
23387  *
23388  * cdef double[:] cyScalarRecoveryAtNodesWeighted(double[:] scalars,
23389  */
23390  __PYX_INC_MEMVIEW(&__pyx_v_recovered_scalars, 0);
23391  __pyx_r = __pyx_v_recovered_scalars;
23392  goto __pyx_L0;
23393 
23394  /* "mprans/MeshSmoothing.pyx":1682
23395  * return new_variable_nb_local
23396  *
23397  * cdef double[:] cyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
23398  * int[:] nodeElementsArray,
23399  * int[:] nodeElementOffsets):
23400  */
23401 
23402  /* function exit code */
23403  __pyx_L1_error:;
23404  __Pyx_XDECREF(__pyx_t_1);
23405  __Pyx_XDECREF(__pyx_t_2);
23406  __Pyx_XDECREF(__pyx_t_3);
23407  __Pyx_XDECREF(__pyx_t_5);
23408  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
23409  __pyx_r.data = NULL;
23410  __pyx_r.memview = NULL;
23411  __Pyx_AddTraceback("mprans.MeshSmoothing.cyScalarRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
23412  goto __pyx_L2;
23413  __pyx_L0:;
23414  if (unlikely(!__pyx_r.memview)) {
23415  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
23416  }
23417  __pyx_L2:;
23418  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_scalars, 1);
23419  __Pyx_RefNannyFinishContext();
23420  return __pyx_r;
23421 }
23422 
23423 /* "mprans/MeshSmoothing.pyx":1701
23424  * return recovered_scalars
23425  *
23426  * cdef double[:] cyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
23427  * int[:] nodeElementsArray,
23428  * int[:] nodeElementOffsets,
23429  */
23430 
23431 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted(__Pyx_memviewslice __pyx_v_scalars, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nNodes) {
23432  __Pyx_memviewslice __pyx_v_recovered_scalars = { 0, 0, { 0 }, { 0 }, { 0 } };
23433  double __pyx_v_detJ_patch;
23434  double __pyx_v_scalar_sum;
23435  int __pyx_v_nb_el;
23436  int __pyx_v_node;
23437  int __pyx_v_eOffset;
23438  int __pyx_v_eN;
23439  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
23440  __Pyx_RefNannyDeclarations
23441  PyObject *__pyx_t_1 = NULL;
23442  PyObject *__pyx_t_2 = NULL;
23443  PyObject *__pyx_t_3 = NULL;
23444  PyObject *__pyx_t_4 = NULL;
23445  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
23446  int __pyx_t_6;
23447  int __pyx_t_7;
23448  int __pyx_t_8;
23449  Py_ssize_t __pyx_t_9;
23450  int __pyx_t_10;
23451  int __pyx_t_11;
23452  int __pyx_t_12;
23453  Py_ssize_t __pyx_t_13;
23454  Py_ssize_t __pyx_t_14;
23455  int __pyx_lineno = 0;
23456  const char *__pyx_filename = NULL;
23457  int __pyx_clineno = 0;
23458  __Pyx_RefNannySetupContext("cyScalarRecoveryAtNodesWeighted", 0);
23459 
23460  /* "mprans/MeshSmoothing.pyx":1706
23461  * double[:] detJ_array,
23462  * int nNodes):
23463  * cdef double[:] recovered_scalars = np.zeros(nNodes) # <<<<<<<<<<<<<<
23464  * cdef double detJ_patch = 0.
23465  * cdef double scalar_sum = 0.
23466  */
23467  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error)
23468  __Pyx_GOTREF(__pyx_t_2);
23469  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1706, __pyx_L1_error)
23470  __Pyx_GOTREF(__pyx_t_3);
23471  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23472  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nNodes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1706, __pyx_L1_error)
23473  __Pyx_GOTREF(__pyx_t_2);
23474  __pyx_t_4 = NULL;
23475  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23476  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
23477  if (likely(__pyx_t_4)) {
23478  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23479  __Pyx_INCREF(__pyx_t_4);
23480  __Pyx_INCREF(function);
23481  __Pyx_DECREF_SET(__pyx_t_3, function);
23482  }
23483  }
23484  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_2) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2);
23485  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23486  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23487  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1706, __pyx_L1_error)
23488  __Pyx_GOTREF(__pyx_t_1);
23489  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23490  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 1706, __pyx_L1_error)
23491  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23492  __pyx_v_recovered_scalars = __pyx_t_5;
23493  __pyx_t_5.memview = NULL;
23494  __pyx_t_5.data = NULL;
23495 
23496  /* "mprans/MeshSmoothing.pyx":1707
23497  * int nNodes):
23498  * cdef double[:] recovered_scalars = np.zeros(nNodes)
23499  * cdef double detJ_patch = 0. # <<<<<<<<<<<<<<
23500  * cdef double scalar_sum = 0.
23501  * cdef int nb_el
23502  */
23503  __pyx_v_detJ_patch = 0.;
23504 
23505  /* "mprans/MeshSmoothing.pyx":1708
23506  * cdef double[:] recovered_scalars = np.zeros(nNodes)
23507  * cdef double detJ_patch = 0.
23508  * cdef double scalar_sum = 0. # <<<<<<<<<<<<<<
23509  * cdef int nb_el
23510  * cdef int node
23511  */
23512  __pyx_v_scalar_sum = 0.;
23513 
23514  /* "mprans/MeshSmoothing.pyx":1713
23515  * cdef int eOffset
23516  * cdef int eN
23517  * for node in range(nNodes): # <<<<<<<<<<<<<<
23518  * nb_el = 0
23519  * detJ_patch = 0.
23520  */
23521  __pyx_t_6 = __pyx_v_nNodes;
23522  __pyx_t_7 = __pyx_t_6;
23523  for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) {
23524  __pyx_v_node = __pyx_t_8;
23525 
23526  /* "mprans/MeshSmoothing.pyx":1714
23527  * cdef int eN
23528  * for node in range(nNodes):
23529  * nb_el = 0 # <<<<<<<<<<<<<<
23530  * detJ_patch = 0.
23531  * scalar_sum = 0.
23532  */
23533  __pyx_v_nb_el = 0;
23534 
23535  /* "mprans/MeshSmoothing.pyx":1715
23536  * for node in range(nNodes):
23537  * nb_el = 0
23538  * detJ_patch = 0. # <<<<<<<<<<<<<<
23539  * scalar_sum = 0.
23540  * for eOffset in range(nodeElementOffsets[node],
23541  */
23542  __pyx_v_detJ_patch = 0.;
23543 
23544  /* "mprans/MeshSmoothing.pyx":1716
23545  * nb_el = 0
23546  * detJ_patch = 0.
23547  * scalar_sum = 0. # <<<<<<<<<<<<<<
23548  * for eOffset in range(nodeElementOffsets[node],
23549  * nodeElementOffsets[node+1]):
23550  */
23551  __pyx_v_scalar_sum = 0.;
23552 
23553  /* "mprans/MeshSmoothing.pyx":1718
23554  * scalar_sum = 0.
23555  * for eOffset in range(nodeElementOffsets[node],
23556  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23557  * nb_el += 1
23558  * eN = nodeElementsArray[eOffset]
23559  */
23560  __pyx_t_9 = (__pyx_v_node + 1);
23561  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeElementOffsets.shape[0];
23562  __pyx_t_10 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_9 * __pyx_v_nodeElementOffsets.strides[0]) )));
23563 
23564  /* "mprans/MeshSmoothing.pyx":1717
23565  * detJ_patch = 0.
23566  * scalar_sum = 0.
23567  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23568  * nodeElementOffsets[node+1]):
23569  * nb_el += 1
23570  */
23571  __pyx_t_9 = __pyx_v_node;
23572  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_nodeElementOffsets.shape[0];
23573 
23574  /* "mprans/MeshSmoothing.pyx":1718
23575  * scalar_sum = 0.
23576  * for eOffset in range(nodeElementOffsets[node],
23577  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23578  * nb_el += 1
23579  * eN = nodeElementsArray[eOffset]
23580  */
23581  __pyx_t_11 = __pyx_t_10;
23582  for (__pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_9 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
23583 
23584  /* "mprans/MeshSmoothing.pyx":1717
23585  * detJ_patch = 0.
23586  * scalar_sum = 0.
23587  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23588  * nodeElementOffsets[node+1]):
23589  * nb_el += 1
23590  */
23591  __pyx_v_eOffset = __pyx_t_12;
23592 
23593  /* "mprans/MeshSmoothing.pyx":1719
23594  * for eOffset in range(nodeElementOffsets[node],
23595  * nodeElementOffsets[node+1]):
23596  * nb_el += 1 # <<<<<<<<<<<<<<
23597  * eN = nodeElementsArray[eOffset]
23598  * # for k in range(n_quad):
23599  */
23600  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
23601 
23602  /* "mprans/MeshSmoothing.pyx":1720
23603  * nodeElementOffsets[node+1]):
23604  * nb_el += 1
23605  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
23606  * # for k in range(n_quad):
23607  * # scalar_k = gradrads[eN, k]
23608  */
23609  __pyx_t_13 = __pyx_v_eOffset;
23610  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_nodeElementsArray.shape[0];
23611  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_13 * __pyx_v_nodeElementsArray.strides[0]) )));
23612 
23613  /* "mprans/MeshSmoothing.pyx":1725
23614  * # scalar_eN_av += gradrad_k
23615  * # scalar_eN_av /= n_quad
23616  * detJ_patch += detJ_array[eN] # <<<<<<<<<<<<<<
23617  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points
23618  * recovered_scalars[node] = scalar_sum/detJ_patch
23619  */
23620  __pyx_t_13 = __pyx_v_eN;
23621  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_detJ_array.shape[0];
23622  __pyx_v_detJ_patch = (__pyx_v_detJ_patch + (*((double *) ( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_13 * __pyx_v_detJ_array.strides[0]) ))));
23623 
23624  /* "mprans/MeshSmoothing.pyx":1726
23625  * # scalar_eN_av /= n_quad
23626  * detJ_patch += detJ_array[eN]
23627  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points # <<<<<<<<<<<<<<
23628  * recovered_scalars[node] = scalar_sum/detJ_patch
23629  * return recovered_scalars
23630  */
23631  __pyx_t_13 = __pyx_v_eN;
23632  if (__pyx_t_13 < 0) __pyx_t_13 += __pyx_v_detJ_array.shape[0];
23633  __pyx_t_14 = __pyx_v_eN;
23634  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_scalars.shape[0];
23635  __pyx_v_scalar_sum = (__pyx_v_scalar_sum + ((*((double *) ( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_13 * __pyx_v_detJ_array.strides[0]) ))) * (*((double *) ( /* dim=0 */ (__pyx_v_scalars.data + __pyx_t_14 * __pyx_v_scalars.strides[0]) )))));
23636  }
23637 
23638  /* "mprans/MeshSmoothing.pyx":1727
23639  * detJ_patch += detJ_array[eN]
23640  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points
23641  * recovered_scalars[node] = scalar_sum/detJ_patch # <<<<<<<<<<<<<<
23642  * return recovered_scalars
23643  *
23644  */
23645  __pyx_t_9 = __pyx_v_node;
23646  if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_v_recovered_scalars.shape[0];
23647  *((double *) ( /* dim=0 */ (__pyx_v_recovered_scalars.data + __pyx_t_9 * __pyx_v_recovered_scalars.strides[0]) )) = (__pyx_v_scalar_sum / __pyx_v_detJ_patch);
23648  }
23649 
23650  /* "mprans/MeshSmoothing.pyx":1728
23651  * scalar_sum += detJ_array[eN]*scalars[eN] # same value at all quad points
23652  * recovered_scalars[node] = scalar_sum/detJ_patch
23653  * return recovered_scalars # <<<<<<<<<<<<<<
23654  *
23655  * cdef double[:,:] cyVectorRecoveryAtNodes(double[:,:] vectors,
23656  */
23657  __PYX_INC_MEMVIEW(&__pyx_v_recovered_scalars, 0);
23658  __pyx_r = __pyx_v_recovered_scalars;
23659  goto __pyx_L0;
23660 
23661  /* "mprans/MeshSmoothing.pyx":1701
23662  * return recovered_scalars
23663  *
23664  * cdef double[:] cyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
23665  * int[:] nodeElementsArray,
23666  * int[:] nodeElementOffsets,
23667  */
23668 
23669  /* function exit code */
23670  __pyx_L1_error:;
23671  __Pyx_XDECREF(__pyx_t_1);
23672  __Pyx_XDECREF(__pyx_t_2);
23673  __Pyx_XDECREF(__pyx_t_3);
23674  __Pyx_XDECREF(__pyx_t_4);
23675  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
23676  __pyx_r.data = NULL;
23677  __pyx_r.memview = NULL;
23678  __Pyx_AddTraceback("mprans.MeshSmoothing.cyScalarRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
23679  goto __pyx_L2;
23680  __pyx_L0:;
23681  if (unlikely(!__pyx_r.memview)) {
23682  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
23683  }
23684  __pyx_L2:;
23685  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_scalars, 1);
23686  __Pyx_RefNannyFinishContext();
23687  return __pyx_r;
23688 }
23689 
23690 /* "mprans/MeshSmoothing.pyx":1730
23691  * return recovered_scalars
23692  *
23693  * cdef double[:,:] cyVectorRecoveryAtNodes(double[:,:] vectors, # <<<<<<<<<<<<<<
23694  * int[:] nodeElementsArray,
23695  * int[:] nodeElementOffsets,
23696  */
23697 
23698 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes(__Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, int __pyx_v_nd) {
23699  __Pyx_memviewslice __pyx_v_recovered_vectors = { 0, 0, { 0 }, { 0 }, { 0 } };
23700  __Pyx_memviewslice __pyx_v_vector_sum = { 0, 0, { 0 }, { 0 }, { 0 } };
23701  int __pyx_v_nNodes;
23702  int __pyx_v_nb_el;
23703  int __pyx_v_eOffset;
23704  int __pyx_v_eN;
23705  int __pyx_v_ndi;
23706  int __pyx_v_node;
23707  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
23708  __Pyx_RefNannyDeclarations
23709  PyObject *__pyx_t_1 = NULL;
23710  PyObject *__pyx_t_2 = NULL;
23711  PyObject *__pyx_t_3 = NULL;
23712  PyObject *__pyx_t_4 = NULL;
23713  PyObject *__pyx_t_5 = NULL;
23714  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
23715  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
23716  int __pyx_t_8;
23717  int __pyx_t_9;
23718  int __pyx_t_10;
23719  int __pyx_t_11;
23720  int __pyx_t_12;
23721  int __pyx_t_13;
23722  Py_ssize_t __pyx_t_14;
23723  Py_ssize_t __pyx_t_15;
23724  int __pyx_t_16;
23725  int __pyx_t_17;
23726  int __pyx_t_18;
23727  Py_ssize_t __pyx_t_19;
23728  Py_ssize_t __pyx_t_20;
23729  int __pyx_lineno = 0;
23730  const char *__pyx_filename = NULL;
23731  int __pyx_clineno = 0;
23732  __Pyx_RefNannySetupContext("cyVectorRecoveryAtNodes", 0);
23733 
23734  /* "mprans/MeshSmoothing.pyx":1734
23735  * int[:] nodeElementOffsets,
23736  * int nd):
23737  * cdef double[:, :] recovered_vectors = np.zeros((nodeElementOffsets.shape[0]-1, nd)) # <<<<<<<<<<<<<<
23738  * cdef double[:] vector_sum = np.zeros(nd)
23739  * cdef int nNodes = nodeElementOffsets.shape[0]-1
23740  */
23741  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1734, __pyx_L1_error)
23742  __Pyx_GOTREF(__pyx_t_2);
23743  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1734, __pyx_L1_error)
23744  __Pyx_GOTREF(__pyx_t_3);
23745  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23746  __pyx_t_2 = PyInt_FromSsize_t(((__pyx_v_nodeElementOffsets.shape[0]) - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1734, __pyx_L1_error)
23747  __Pyx_GOTREF(__pyx_t_2);
23748  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1734, __pyx_L1_error)
23749  __Pyx_GOTREF(__pyx_t_4);
23750  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1734, __pyx_L1_error)
23751  __Pyx_GOTREF(__pyx_t_5);
23752  __Pyx_GIVEREF(__pyx_t_2);
23753  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
23754  __Pyx_GIVEREF(__pyx_t_4);
23755  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
23756  __pyx_t_2 = 0;
23757  __pyx_t_4 = 0;
23758  __pyx_t_4 = NULL;
23759  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
23760  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
23761  if (likely(__pyx_t_4)) {
23762  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
23763  __Pyx_INCREF(__pyx_t_4);
23764  __Pyx_INCREF(function);
23765  __Pyx_DECREF_SET(__pyx_t_3, function);
23766  }
23767  }
23768  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5);
23769  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23770  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23771  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1734, __pyx_L1_error)
23772  __Pyx_GOTREF(__pyx_t_1);
23773  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23774  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 1734, __pyx_L1_error)
23775  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23776  __pyx_v_recovered_vectors = __pyx_t_6;
23777  __pyx_t_6.memview = NULL;
23778  __pyx_t_6.data = NULL;
23779 
23780  /* "mprans/MeshSmoothing.pyx":1735
23781  * int nd):
23782  * cdef double[:, :] recovered_vectors = np.zeros((nodeElementOffsets.shape[0]-1, nd))
23783  * cdef double[:] vector_sum = np.zeros(nd) # <<<<<<<<<<<<<<
23784  * cdef int nNodes = nodeElementOffsets.shape[0]-1
23785  * cdef int nb_el
23786  */
23787  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1735, __pyx_L1_error)
23788  __Pyx_GOTREF(__pyx_t_3);
23789  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1735, __pyx_L1_error)
23790  __Pyx_GOTREF(__pyx_t_5);
23791  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23792  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1735, __pyx_L1_error)
23793  __Pyx_GOTREF(__pyx_t_3);
23794  __pyx_t_4 = NULL;
23795  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
23796  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
23797  if (likely(__pyx_t_4)) {
23798  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
23799  __Pyx_INCREF(__pyx_t_4);
23800  __Pyx_INCREF(function);
23801  __Pyx_DECREF_SET(__pyx_t_5, function);
23802  }
23803  }
23804  __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3);
23805  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
23806  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23807  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1735, __pyx_L1_error)
23808  __Pyx_GOTREF(__pyx_t_1);
23809  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23810  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1735, __pyx_L1_error)
23811  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23812  __pyx_v_vector_sum = __pyx_t_7;
23813  __pyx_t_7.memview = NULL;
23814  __pyx_t_7.data = NULL;
23815 
23816  /* "mprans/MeshSmoothing.pyx":1736
23817  * cdef double[:, :] recovered_vectors = np.zeros((nodeElementOffsets.shape[0]-1, nd))
23818  * cdef double[:] vector_sum = np.zeros(nd)
23819  * cdef int nNodes = nodeElementOffsets.shape[0]-1 # <<<<<<<<<<<<<<
23820  * cdef int nb_el
23821  * cdef int eOffset
23822  */
23823  __pyx_v_nNodes = ((__pyx_v_nodeElementOffsets.shape[0]) - 1);
23824 
23825  /* "mprans/MeshSmoothing.pyx":1742
23826  * cdef int ndi
23827  * cdef int node
23828  * for node in range(nNodes): # <<<<<<<<<<<<<<
23829  * nb_el = 0
23830  * for ndi in range(nd):
23831  */
23832  __pyx_t_8 = __pyx_v_nNodes;
23833  __pyx_t_9 = __pyx_t_8;
23834  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
23835  __pyx_v_node = __pyx_t_10;
23836 
23837  /* "mprans/MeshSmoothing.pyx":1743
23838  * cdef int node
23839  * for node in range(nNodes):
23840  * nb_el = 0 # <<<<<<<<<<<<<<
23841  * for ndi in range(nd):
23842  * vector_sum[ndi] = 0.
23843  */
23844  __pyx_v_nb_el = 0;
23845 
23846  /* "mprans/MeshSmoothing.pyx":1744
23847  * for node in range(nNodes):
23848  * nb_el = 0
23849  * for ndi in range(nd): # <<<<<<<<<<<<<<
23850  * vector_sum[ndi] = 0.
23851  * for eOffset in range(nodeElementOffsets[node],
23852  */
23853  __pyx_t_11 = __pyx_v_nd;
23854  __pyx_t_12 = __pyx_t_11;
23855  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
23856  __pyx_v_ndi = __pyx_t_13;
23857 
23858  /* "mprans/MeshSmoothing.pyx":1745
23859  * nb_el = 0
23860  * for ndi in range(nd):
23861  * vector_sum[ndi] = 0. # <<<<<<<<<<<<<<
23862  * for eOffset in range(nodeElementOffsets[node],
23863  * nodeElementOffsets[node+1]):
23864  */
23865  __pyx_t_14 = __pyx_v_ndi;
23866  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vector_sum.shape[0];
23867  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_14 * __pyx_v_vector_sum.strides[0]) )) = 0.;
23868  }
23869 
23870  /* "mprans/MeshSmoothing.pyx":1747
23871  * vector_sum[ndi] = 0.
23872  * for eOffset in range(nodeElementOffsets[node],
23873  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23874  * nb_el += 1
23875  * eN = nodeElementsArray[eOffset]
23876  */
23877  __pyx_t_14 = (__pyx_v_node + 1);
23878  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeElementOffsets.shape[0];
23879  __pyx_t_11 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_14 * __pyx_v_nodeElementOffsets.strides[0]) )));
23880 
23881  /* "mprans/MeshSmoothing.pyx":1746
23882  * for ndi in range(nd):
23883  * vector_sum[ndi] = 0.
23884  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23885  * nodeElementOffsets[node+1]):
23886  * nb_el += 1
23887  */
23888  __pyx_t_14 = __pyx_v_node;
23889  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_nodeElementOffsets.shape[0];
23890 
23891  /* "mprans/MeshSmoothing.pyx":1747
23892  * vector_sum[ndi] = 0.
23893  * for eOffset in range(nodeElementOffsets[node],
23894  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
23895  * nb_el += 1
23896  * eN = nodeElementsArray[eOffset]
23897  */
23898  __pyx_t_12 = __pyx_t_11;
23899  for (__pyx_t_13 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_14 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
23900 
23901  /* "mprans/MeshSmoothing.pyx":1746
23902  * for ndi in range(nd):
23903  * vector_sum[ndi] = 0.
23904  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
23905  * nodeElementOffsets[node+1]):
23906  * nb_el += 1
23907  */
23908  __pyx_v_eOffset = __pyx_t_13;
23909 
23910  /* "mprans/MeshSmoothing.pyx":1748
23911  * for eOffset in range(nodeElementOffsets[node],
23912  * nodeElementOffsets[node+1]):
23913  * nb_el += 1 # <<<<<<<<<<<<<<
23914  * eN = nodeElementsArray[eOffset]
23915  * # for k in range(n_quad):
23916  */
23917  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
23918 
23919  /* "mprans/MeshSmoothing.pyx":1749
23920  * nodeElementOffsets[node+1]):
23921  * nb_el += 1
23922  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
23923  * # for k in range(n_quad):
23924  * # vector_k = vectors[eN, k]
23925  */
23926  __pyx_t_15 = __pyx_v_eOffset;
23927  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeElementsArray.shape[0];
23928  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_15 * __pyx_v_nodeElementsArray.strides[0]) )));
23929 
23930  /* "mprans/MeshSmoothing.pyx":1754
23931  * # vector_eN_av += vector_k
23932  * # vector_eN_av /= n_quad
23933  * for ndi in range(nd): # <<<<<<<<<<<<<<
23934  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points
23935  * for ndi in range(nd):
23936  */
23937  __pyx_t_16 = __pyx_v_nd;
23938  __pyx_t_17 = __pyx_t_16;
23939  for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
23940  __pyx_v_ndi = __pyx_t_18;
23941 
23942  /* "mprans/MeshSmoothing.pyx":1755
23943  * # vector_eN_av /= n_quad
23944  * for ndi in range(nd):
23945  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points # <<<<<<<<<<<<<<
23946  * for ndi in range(nd):
23947  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el
23948  */
23949  __pyx_t_15 = __pyx_v_eN;
23950  __pyx_t_19 = __pyx_v_ndi;
23951  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vectors.shape[0];
23952  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_vectors.shape[1];
23953  __pyx_t_20 = __pyx_v_ndi;
23954  if (__pyx_t_20 < 0) __pyx_t_20 += __pyx_v_vector_sum.shape[0];
23955  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_20 * __pyx_v_vector_sum.strides[0]) )) += (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vectors.data + __pyx_t_15 * __pyx_v_vectors.strides[0]) ) + __pyx_t_19 * __pyx_v_vectors.strides[1]) )));
23956  }
23957  }
23958 
23959  /* "mprans/MeshSmoothing.pyx":1756
23960  * for ndi in range(nd):
23961  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points
23962  * for ndi in range(nd): # <<<<<<<<<<<<<<
23963  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el
23964  * return recovered_vectors
23965  */
23966  __pyx_t_11 = __pyx_v_nd;
23967  __pyx_t_12 = __pyx_t_11;
23968  for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
23969  __pyx_v_ndi = __pyx_t_13;
23970 
23971  /* "mprans/MeshSmoothing.pyx":1757
23972  * vector_sum[ndi] += vectors[eN, ndi] # same value at all quad points
23973  * for ndi in range(nd):
23974  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el # <<<<<<<<<<<<<<
23975  * return recovered_vectors
23976  *
23977  */
23978  __pyx_t_14 = __pyx_v_ndi;
23979  if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_v_vector_sum.shape[0];
23980  __pyx_t_19 = __pyx_v_node;
23981  __pyx_t_15 = __pyx_v_ndi;
23982  if (__pyx_t_19 < 0) __pyx_t_19 += __pyx_v_recovered_vectors.shape[0];
23983  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_recovered_vectors.shape[1];
23984  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_recovered_vectors.data + __pyx_t_19 * __pyx_v_recovered_vectors.strides[0]) ) + __pyx_t_15 * __pyx_v_recovered_vectors.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_14 * __pyx_v_vector_sum.strides[0]) ))) / __pyx_v_nb_el);
23985  }
23986  }
23987 
23988  /* "mprans/MeshSmoothing.pyx":1758
23989  * for ndi in range(nd):
23990  * recovered_vectors[node, ndi] = vector_sum[ndi]/nb_el
23991  * return recovered_vectors # <<<<<<<<<<<<<<
23992  *
23993  * cdef double[:,:] cyVectorRecoveryAtNodesWeighted(double[:,:] vectors,
23994  */
23995  __PYX_INC_MEMVIEW(&__pyx_v_recovered_vectors, 0);
23996  __pyx_r = __pyx_v_recovered_vectors;
23997  goto __pyx_L0;
23998 
23999  /* "mprans/MeshSmoothing.pyx":1730
24000  * return recovered_scalars
24001  *
24002  * cdef double[:,:] cyVectorRecoveryAtNodes(double[:,:] vectors, # <<<<<<<<<<<<<<
24003  * int[:] nodeElementsArray,
24004  * int[:] nodeElementOffsets,
24005  */
24006 
24007  /* function exit code */
24008  __pyx_L1_error:;
24009  __Pyx_XDECREF(__pyx_t_1);
24010  __Pyx_XDECREF(__pyx_t_2);
24011  __Pyx_XDECREF(__pyx_t_3);
24012  __Pyx_XDECREF(__pyx_t_4);
24013  __Pyx_XDECREF(__pyx_t_5);
24014  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
24015  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
24016  __pyx_r.data = NULL;
24017  __pyx_r.memview = NULL;
24018  __Pyx_AddTraceback("mprans.MeshSmoothing.cyVectorRecoveryAtNodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
24019  goto __pyx_L2;
24020  __pyx_L0:;
24021  if (unlikely(!__pyx_r.memview)) {
24022  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
24023  }
24024  __pyx_L2:;
24025  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_vectors, 1);
24026  __PYX_XDEC_MEMVIEW(&__pyx_v_vector_sum, 1);
24027  __Pyx_RefNannyFinishContext();
24028  return __pyx_r;
24029 }
24030 
24031 /* "mprans/MeshSmoothing.pyx":1760
24032  * return recovered_vectors
24033  *
24034  * cdef double[:,:] cyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
24035  * int[:] nodeElementsArray,
24036  * int[:] nodeElementOffsets,
24037  */
24038 
24039 static __Pyx_memviewslice __pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted(__Pyx_memviewslice __pyx_v_vectors, __Pyx_memviewslice __pyx_v_nodeElementsArray, __Pyx_memviewslice __pyx_v_nodeElementOffsets, __Pyx_memviewslice __pyx_v_detJ_array, int __pyx_v_nd) {
24040  __Pyx_memviewslice __pyx_v_recovered_vectors = { 0, 0, { 0 }, { 0 }, { 0 } };
24041  __Pyx_memviewslice __pyx_v_vector_sum = { 0, 0, { 0 }, { 0 }, { 0 } };
24042  int __pyx_v_nNodes;
24043  double __pyx_v_detJ_patch;
24044  int __pyx_v_nb_el;
24045  int __pyx_v_eN;
24046  int __pyx_v_ndi;
24047  int __pyx_v_node;
24048  int __pyx_v_eOffset;
24049  __Pyx_memviewslice __pyx_r = { 0, 0, { 0 }, { 0 }, { 0 } };
24050  __Pyx_RefNannyDeclarations
24051  PyObject *__pyx_t_1 = NULL;
24052  PyObject *__pyx_t_2 = NULL;
24053  PyObject *__pyx_t_3 = NULL;
24054  size_t __pyx_t_4;
24055  PyObject *__pyx_t_5 = NULL;
24056  PyObject *__pyx_t_6 = NULL;
24057  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
24058  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
24059  int __pyx_t_9;
24060  int __pyx_t_10;
24061  int __pyx_t_11;
24062  int __pyx_t_12;
24063  int __pyx_t_13;
24064  int __pyx_t_14;
24065  Py_ssize_t __pyx_t_15;
24066  Py_ssize_t __pyx_t_16;
24067  Py_ssize_t __pyx_t_17;
24068  int __pyx_t_18;
24069  int __pyx_t_19;
24070  int __pyx_t_20;
24071  Py_ssize_t __pyx_t_21;
24072  Py_ssize_t __pyx_t_22;
24073  Py_ssize_t __pyx_t_23;
24074  int __pyx_lineno = 0;
24075  const char *__pyx_filename = NULL;
24076  int __pyx_clineno = 0;
24077  __Pyx_RefNannySetupContext("cyVectorRecoveryAtNodesWeighted", 0);
24078 
24079  /* "mprans/MeshSmoothing.pyx":1765
24080  * double[:,:] detJ_array,
24081  * int nd):
24082  * cdef double[:, :] recovered_vectors = np.zeros((len(nodeElementOffsets)-1, nd)) # <<<<<<<<<<<<<<
24083  * cdef double[:] vector_sum = np.zeros(nd)
24084  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24085  */
24086  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
24087  __Pyx_GOTREF(__pyx_t_2);
24088  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1765, __pyx_L1_error)
24089  __Pyx_GOTREF(__pyx_t_3);
24090  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
24091  __pyx_t_4 = __Pyx_MemoryView_Len(__pyx_v_nodeElementOffsets);
24092  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_4 - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1765, __pyx_L1_error)
24093  __Pyx_GOTREF(__pyx_t_2);
24094  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1765, __pyx_L1_error)
24095  __Pyx_GOTREF(__pyx_t_5);
24096  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1765, __pyx_L1_error)
24097  __Pyx_GOTREF(__pyx_t_6);
24098  __Pyx_GIVEREF(__pyx_t_2);
24099  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
24100  __Pyx_GIVEREF(__pyx_t_5);
24101  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
24102  __pyx_t_2 = 0;
24103  __pyx_t_5 = 0;
24104  __pyx_t_5 = NULL;
24105  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
24106  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
24107  if (likely(__pyx_t_5)) {
24108  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
24109  __Pyx_INCREF(__pyx_t_5);
24110  __Pyx_INCREF(function);
24111  __Pyx_DECREF_SET(__pyx_t_3, function);
24112  }
24113  }
24114  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6);
24115  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24116  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24117  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1765, __pyx_L1_error)
24118  __Pyx_GOTREF(__pyx_t_1);
24119  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24120  __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1765, __pyx_L1_error)
24121  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24122  __pyx_v_recovered_vectors = __pyx_t_7;
24123  __pyx_t_7.memview = NULL;
24124  __pyx_t_7.data = NULL;
24125 
24126  /* "mprans/MeshSmoothing.pyx":1766
24127  * int nd):
24128  * cdef double[:, :] recovered_vectors = np.zeros((len(nodeElementOffsets)-1, nd))
24129  * cdef double[:] vector_sum = np.zeros(nd) # <<<<<<<<<<<<<<
24130  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24131  * cdef double detJ_patch = 0.
24132  */
24133  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1766, __pyx_L1_error)
24134  __Pyx_GOTREF(__pyx_t_3);
24135  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1766, __pyx_L1_error)
24136  __Pyx_GOTREF(__pyx_t_6);
24137  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24138  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nd); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1766, __pyx_L1_error)
24139  __Pyx_GOTREF(__pyx_t_3);
24140  __pyx_t_5 = NULL;
24141  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
24142  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
24143  if (likely(__pyx_t_5)) {
24144  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
24145  __Pyx_INCREF(__pyx_t_5);
24146  __Pyx_INCREF(function);
24147  __Pyx_DECREF_SET(__pyx_t_6, function);
24148  }
24149  }
24150  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3);
24151  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
24152  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
24153  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1766, __pyx_L1_error)
24154  __Pyx_GOTREF(__pyx_t_1);
24155  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
24156  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1766, __pyx_L1_error)
24157  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
24158  __pyx_v_vector_sum = __pyx_t_8;
24159  __pyx_t_8.memview = NULL;
24160  __pyx_t_8.data = NULL;
24161 
24162  /* "mprans/MeshSmoothing.pyx":1767
24163  * cdef double[:, :] recovered_vectors = np.zeros((len(nodeElementOffsets)-1, nd))
24164  * cdef double[:] vector_sum = np.zeros(nd)
24165  * cdef int nNodes = nodeElementOffsets.shape[0]-1 # <<<<<<<<<<<<<<
24166  * cdef double detJ_patch = 0.
24167  * cdef int nb_el
24168  */
24169  __pyx_v_nNodes = ((__pyx_v_nodeElementOffsets.shape[0]) - 1);
24170 
24171  /* "mprans/MeshSmoothing.pyx":1768
24172  * cdef double[:] vector_sum = np.zeros(nd)
24173  * cdef int nNodes = nodeElementOffsets.shape[0]-1
24174  * cdef double detJ_patch = 0. # <<<<<<<<<<<<<<
24175  * cdef int nb_el
24176  * cdef int eN
24177  */
24178  __pyx_v_detJ_patch = 0.;
24179 
24180  /* "mprans/MeshSmoothing.pyx":1774
24181  * cdef int node
24182  * cdef int eOffset
24183  * for node in range(nNodes): # <<<<<<<<<<<<<<
24184  * nb_el = 0
24185  * detJ_patch = 0.
24186  */
24187  __pyx_t_9 = __pyx_v_nNodes;
24188  __pyx_t_10 = __pyx_t_9;
24189  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
24190  __pyx_v_node = __pyx_t_11;
24191 
24192  /* "mprans/MeshSmoothing.pyx":1775
24193  * cdef int eOffset
24194  * for node in range(nNodes):
24195  * nb_el = 0 # <<<<<<<<<<<<<<
24196  * detJ_patch = 0.
24197  * for ndi in range(nd):
24198  */
24199  __pyx_v_nb_el = 0;
24200 
24201  /* "mprans/MeshSmoothing.pyx":1776
24202  * for node in range(nNodes):
24203  * nb_el = 0
24204  * detJ_patch = 0. # <<<<<<<<<<<<<<
24205  * for ndi in range(nd):
24206  * vector_sum[ndi] = 0.
24207  */
24208  __pyx_v_detJ_patch = 0.;
24209 
24210  /* "mprans/MeshSmoothing.pyx":1777
24211  * nb_el = 0
24212  * detJ_patch = 0.
24213  * for ndi in range(nd): # <<<<<<<<<<<<<<
24214  * vector_sum[ndi] = 0.
24215  * for eOffset in range(nodeElementOffsets[node],
24216  */
24217  __pyx_t_12 = __pyx_v_nd;
24218  __pyx_t_13 = __pyx_t_12;
24219  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
24220  __pyx_v_ndi = __pyx_t_14;
24221 
24222  /* "mprans/MeshSmoothing.pyx":1778
24223  * detJ_patch = 0.
24224  * for ndi in range(nd):
24225  * vector_sum[ndi] = 0. # <<<<<<<<<<<<<<
24226  * for eOffset in range(nodeElementOffsets[node],
24227  * nodeElementOffsets[node+1]):
24228  */
24229  __pyx_t_15 = __pyx_v_ndi;
24230  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vector_sum.shape[0];
24231  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_15 * __pyx_v_vector_sum.strides[0]) )) = 0.;
24232  }
24233 
24234  /* "mprans/MeshSmoothing.pyx":1780
24235  * vector_sum[ndi] = 0.
24236  * for eOffset in range(nodeElementOffsets[node],
24237  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
24238  * nb_el += 1
24239  * eN = nodeElementsArray[eOffset]
24240  */
24241  __pyx_t_15 = (__pyx_v_node + 1);
24242  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeElementOffsets.shape[0];
24243  __pyx_t_12 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_15 * __pyx_v_nodeElementOffsets.strides[0]) )));
24244 
24245  /* "mprans/MeshSmoothing.pyx":1779
24246  * for ndi in range(nd):
24247  * vector_sum[ndi] = 0.
24248  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
24249  * nodeElementOffsets[node+1]):
24250  * nb_el += 1
24251  */
24252  __pyx_t_15 = __pyx_v_node;
24253  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_nodeElementOffsets.shape[0];
24254 
24255  /* "mprans/MeshSmoothing.pyx":1780
24256  * vector_sum[ndi] = 0.
24257  * for eOffset in range(nodeElementOffsets[node],
24258  * nodeElementOffsets[node+1]): # <<<<<<<<<<<<<<
24259  * nb_el += 1
24260  * eN = nodeElementsArray[eOffset]
24261  */
24262  __pyx_t_13 = __pyx_t_12;
24263  for (__pyx_t_14 = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementOffsets.data + __pyx_t_15 * __pyx_v_nodeElementOffsets.strides[0]) ))); __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
24264 
24265  /* "mprans/MeshSmoothing.pyx":1779
24266  * for ndi in range(nd):
24267  * vector_sum[ndi] = 0.
24268  * for eOffset in range(nodeElementOffsets[node], # <<<<<<<<<<<<<<
24269  * nodeElementOffsets[node+1]):
24270  * nb_el += 1
24271  */
24272  __pyx_v_eOffset = __pyx_t_14;
24273 
24274  /* "mprans/MeshSmoothing.pyx":1781
24275  * for eOffset in range(nodeElementOffsets[node],
24276  * nodeElementOffsets[node+1]):
24277  * nb_el += 1 # <<<<<<<<<<<<<<
24278  * eN = nodeElementsArray[eOffset]
24279  * # for k in range(n_quad):
24280  */
24281  __pyx_v_nb_el = (__pyx_v_nb_el + 1);
24282 
24283  /* "mprans/MeshSmoothing.pyx":1782
24284  * nodeElementOffsets[node+1]):
24285  * nb_el += 1
24286  * eN = nodeElementsArray[eOffset] # <<<<<<<<<<<<<<
24287  * # for k in range(n_quad):
24288  * # vector_k = vectors[eN, k]
24289  */
24290  __pyx_t_16 = __pyx_v_eOffset;
24291  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_nodeElementsArray.shape[0];
24292  __pyx_v_eN = (*((int *) ( /* dim=0 */ (__pyx_v_nodeElementsArray.data + __pyx_t_16 * __pyx_v_nodeElementsArray.strides[0]) )));
24293 
24294  /* "mprans/MeshSmoothing.pyx":1787
24295  * # vector_eN_av += vector_k
24296  * # vector_eN_av /= n_quad
24297  * detJ_patch += detJ_array[eN,0] # <<<<<<<<<<<<<<
24298  * for ndi in range(nd):
24299  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24300  */
24301  __pyx_t_16 = __pyx_v_eN;
24302  __pyx_t_17 = 0;
24303  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_detJ_array.shape[0];
24304  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_detJ_array.shape[1];
24305  __pyx_v_detJ_patch = (__pyx_v_detJ_patch + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_16 * __pyx_v_detJ_array.strides[0]) ) + __pyx_t_17 * __pyx_v_detJ_array.strides[1]) ))));
24306 
24307  /* "mprans/MeshSmoothing.pyx":1788
24308  * # vector_eN_av /= n_quad
24309  * detJ_patch += detJ_array[eN,0]
24310  * for ndi in range(nd): # <<<<<<<<<<<<<<
24311  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24312  * for ndi in range(nd):
24313  */
24314  __pyx_t_18 = __pyx_v_nd;
24315  __pyx_t_19 = __pyx_t_18;
24316  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) {
24317  __pyx_v_ndi = __pyx_t_20;
24318 
24319  /* "mprans/MeshSmoothing.pyx":1789
24320  * detJ_patch += detJ_array[eN,0]
24321  * for ndi in range(nd):
24322  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points # <<<<<<<<<<<<<<
24323  * for ndi in range(nd):
24324  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch
24325  */
24326  __pyx_t_17 = __pyx_v_eN;
24327  __pyx_t_16 = 0;
24328  if (__pyx_t_17 < 0) __pyx_t_17 += __pyx_v_detJ_array.shape[0];
24329  if (__pyx_t_16 < 0) __pyx_t_16 += __pyx_v_detJ_array.shape[1];
24330  __pyx_t_21 = __pyx_v_eN;
24331  __pyx_t_22 = __pyx_v_ndi;
24332  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_vectors.shape[0];
24333  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_vectors.shape[1];
24334  __pyx_t_23 = __pyx_v_ndi;
24335  if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_v_vector_sum.shape[0];
24336  *((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_23 * __pyx_v_vector_sum.strides[0]) )) += ((*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_detJ_array.data + __pyx_t_17 * __pyx_v_detJ_array.strides[0]) ) + __pyx_t_16 * __pyx_v_detJ_array.strides[1]) ))) * (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_vectors.data + __pyx_t_21 * __pyx_v_vectors.strides[0]) ) + __pyx_t_22 * __pyx_v_vectors.strides[1]) ))));
24337  }
24338  }
24339 
24340  /* "mprans/MeshSmoothing.pyx":1790
24341  * for ndi in range(nd):
24342  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24343  * for ndi in range(nd): # <<<<<<<<<<<<<<
24344  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch
24345  * return recovered_vectors
24346  */
24347  __pyx_t_12 = __pyx_v_nd;
24348  __pyx_t_13 = __pyx_t_12;
24349  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
24350  __pyx_v_ndi = __pyx_t_14;
24351 
24352  /* "mprans/MeshSmoothing.pyx":1791
24353  * vector_sum[ndi] += detJ_array[eN,0]*vectors[eN, ndi] # same value at all quad points
24354  * for ndi in range(nd):
24355  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch # <<<<<<<<<<<<<<
24356  * return recovered_vectors
24357  */
24358  __pyx_t_15 = __pyx_v_ndi;
24359  if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_v_vector_sum.shape[0];
24360  __pyx_t_22 = __pyx_v_node;
24361  __pyx_t_21 = __pyx_v_ndi;
24362  if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_v_recovered_vectors.shape[0];
24363  if (__pyx_t_21 < 0) __pyx_t_21 += __pyx_v_recovered_vectors.shape[1];
24364  *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_recovered_vectors.data + __pyx_t_22 * __pyx_v_recovered_vectors.strides[0]) ) + __pyx_t_21 * __pyx_v_recovered_vectors.strides[1]) )) = ((*((double *) ( /* dim=0 */ (__pyx_v_vector_sum.data + __pyx_t_15 * __pyx_v_vector_sum.strides[0]) ))) / __pyx_v_detJ_patch);
24365  }
24366  }
24367 
24368  /* "mprans/MeshSmoothing.pyx":1792
24369  * for ndi in range(nd):
24370  * recovered_vectors[node, ndi] = vector_sum[ndi]/detJ_patch
24371  * return recovered_vectors # <<<<<<<<<<<<<<
24372  */
24373  __PYX_INC_MEMVIEW(&__pyx_v_recovered_vectors, 0);
24374  __pyx_r = __pyx_v_recovered_vectors;
24375  goto __pyx_L0;
24376 
24377  /* "mprans/MeshSmoothing.pyx":1760
24378  * return recovered_vectors
24379  *
24380  * cdef double[:,:] cyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
24381  * int[:] nodeElementsArray,
24382  * int[:] nodeElementOffsets,
24383  */
24384 
24385  /* function exit code */
24386  __pyx_L1_error:;
24387  __Pyx_XDECREF(__pyx_t_1);
24388  __Pyx_XDECREF(__pyx_t_2);
24389  __Pyx_XDECREF(__pyx_t_3);
24390  __Pyx_XDECREF(__pyx_t_5);
24391  __Pyx_XDECREF(__pyx_t_6);
24392  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
24393  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
24394  __pyx_r.data = NULL;
24395  __pyx_r.memview = NULL;
24396  __Pyx_AddTraceback("mprans.MeshSmoothing.cyVectorRecoveryAtNodesWeighted", __pyx_clineno, __pyx_lineno, __pyx_filename);
24397  goto __pyx_L2;
24398  __pyx_L0:;
24399  if (unlikely(!__pyx_r.memview)) {
24400  PyErr_SetString(PyExc_TypeError, "Memoryview return value is not initialized");
24401  }
24402  __pyx_L2:;
24403  __PYX_XDEC_MEMVIEW(&__pyx_v_recovered_vectors, 1);
24404  __PYX_XDEC_MEMVIEW(&__pyx_v_vector_sum, 1);
24405  __Pyx_RefNannyFinishContext();
24406  return __pyx_r;
24407 }
24408 
24409 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
24410  * ctypedef npy_cdouble complex_t
24411  *
24412  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
24413  * return PyArray_MultiIterNew(1, <void*>a)
24414  *
24415  */
24416 
24417 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
24418  PyObject *__pyx_r = NULL;
24419  __Pyx_RefNannyDeclarations
24420  PyObject *__pyx_t_1 = NULL;
24421  int __pyx_lineno = 0;
24422  const char *__pyx_filename = NULL;
24423  int __pyx_clineno = 0;
24424  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
24425 
24426  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":736
24427  *
24428  * cdef inline object PyArray_MultiIterNew1(a):
24429  * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
24430  *
24431  * cdef inline object PyArray_MultiIterNew2(a, b):
24432  */
24433  __Pyx_XDECREF(__pyx_r);
24434  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 736, __pyx_L1_error)
24435  __Pyx_GOTREF(__pyx_t_1);
24436  __pyx_r = __pyx_t_1;
24437  __pyx_t_1 = 0;
24438  goto __pyx_L0;
24439 
24440  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":735
24441  * ctypedef npy_cdouble complex_t
24442  *
24443  * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
24444  * return PyArray_MultiIterNew(1, <void*>a)
24445  *
24446  */
24447 
24448  /* function exit code */
24449  __pyx_L1_error:;
24450  __Pyx_XDECREF(__pyx_t_1);
24451  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
24452  __pyx_r = 0;
24453  __pyx_L0:;
24454  __Pyx_XGIVEREF(__pyx_r);
24455  __Pyx_RefNannyFinishContext();
24456  return __pyx_r;
24457 }
24458 
24459 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
24460  * return PyArray_MultiIterNew(1, <void*>a)
24461  *
24462  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
24463  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
24464  *
24465  */
24466 
24467 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
24468  PyObject *__pyx_r = NULL;
24469  __Pyx_RefNannyDeclarations
24470  PyObject *__pyx_t_1 = NULL;
24471  int __pyx_lineno = 0;
24472  const char *__pyx_filename = NULL;
24473  int __pyx_clineno = 0;
24474  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
24475 
24476  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":739
24477  *
24478  * cdef inline object PyArray_MultiIterNew2(a, b):
24479  * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
24480  *
24481  * cdef inline object PyArray_MultiIterNew3(a, b, c):
24482  */
24483  __Pyx_XDECREF(__pyx_r);
24484  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 739, __pyx_L1_error)
24485  __Pyx_GOTREF(__pyx_t_1);
24486  __pyx_r = __pyx_t_1;
24487  __pyx_t_1 = 0;
24488  goto __pyx_L0;
24489 
24490  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":738
24491  * return PyArray_MultiIterNew(1, <void*>a)
24492  *
24493  * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
24494  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
24495  *
24496  */
24497 
24498  /* function exit code */
24499  __pyx_L1_error:;
24500  __Pyx_XDECREF(__pyx_t_1);
24501  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
24502  __pyx_r = 0;
24503  __pyx_L0:;
24504  __Pyx_XGIVEREF(__pyx_r);
24505  __Pyx_RefNannyFinishContext();
24506  return __pyx_r;
24507 }
24508 
24509 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
24510  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
24511  *
24512  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
24513  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
24514  *
24515  */
24516 
24517 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
24518  PyObject *__pyx_r = NULL;
24519  __Pyx_RefNannyDeclarations
24520  PyObject *__pyx_t_1 = NULL;
24521  int __pyx_lineno = 0;
24522  const char *__pyx_filename = NULL;
24523  int __pyx_clineno = 0;
24524  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
24525 
24526  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":742
24527  *
24528  * cdef inline object PyArray_MultiIterNew3(a, b, c):
24529  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
24530  *
24531  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
24532  */
24533  __Pyx_XDECREF(__pyx_r);
24534  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 742, __pyx_L1_error)
24535  __Pyx_GOTREF(__pyx_t_1);
24536  __pyx_r = __pyx_t_1;
24537  __pyx_t_1 = 0;
24538  goto __pyx_L0;
24539 
24540  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":741
24541  * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
24542  *
24543  * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
24544  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
24545  *
24546  */
24547 
24548  /* function exit code */
24549  __pyx_L1_error:;
24550  __Pyx_XDECREF(__pyx_t_1);
24551  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
24552  __pyx_r = 0;
24553  __pyx_L0:;
24554  __Pyx_XGIVEREF(__pyx_r);
24555  __Pyx_RefNannyFinishContext();
24556  return __pyx_r;
24557 }
24558 
24559 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
24560  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
24561  *
24562  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
24563  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
24564  *
24565  */
24566 
24567 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
24568  PyObject *__pyx_r = NULL;
24569  __Pyx_RefNannyDeclarations
24570  PyObject *__pyx_t_1 = NULL;
24571  int __pyx_lineno = 0;
24572  const char *__pyx_filename = NULL;
24573  int __pyx_clineno = 0;
24574  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
24575 
24576  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":745
24577  *
24578  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
24579  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
24580  *
24581  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
24582  */
24583  __Pyx_XDECREF(__pyx_r);
24584  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 745, __pyx_L1_error)
24585  __Pyx_GOTREF(__pyx_t_1);
24586  __pyx_r = __pyx_t_1;
24587  __pyx_t_1 = 0;
24588  goto __pyx_L0;
24589 
24590  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":744
24591  * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
24592  *
24593  * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
24594  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
24595  *
24596  */
24597 
24598  /* function exit code */
24599  __pyx_L1_error:;
24600  __Pyx_XDECREF(__pyx_t_1);
24601  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
24602  __pyx_r = 0;
24603  __pyx_L0:;
24604  __Pyx_XGIVEREF(__pyx_r);
24605  __Pyx_RefNannyFinishContext();
24606  return __pyx_r;
24607 }
24608 
24609 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
24610  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
24611  *
24612  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
24613  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
24614  *
24615  */
24616 
24617 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
24618  PyObject *__pyx_r = NULL;
24619  __Pyx_RefNannyDeclarations
24620  PyObject *__pyx_t_1 = NULL;
24621  int __pyx_lineno = 0;
24622  const char *__pyx_filename = NULL;
24623  int __pyx_clineno = 0;
24624  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
24625 
24626  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":748
24627  *
24628  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
24629  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
24630  *
24631  * cdef inline tuple PyDataType_SHAPE(dtype d):
24632  */
24633  __Pyx_XDECREF(__pyx_r);
24634  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 748, __pyx_L1_error)
24635  __Pyx_GOTREF(__pyx_t_1);
24636  __pyx_r = __pyx_t_1;
24637  __pyx_t_1 = 0;
24638  goto __pyx_L0;
24639 
24640  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":747
24641  * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
24642  *
24643  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
24644  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
24645  *
24646  */
24647 
24648  /* function exit code */
24649  __pyx_L1_error:;
24650  __Pyx_XDECREF(__pyx_t_1);
24651  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
24652  __pyx_r = 0;
24653  __pyx_L0:;
24654  __Pyx_XGIVEREF(__pyx_r);
24655  __Pyx_RefNannyFinishContext();
24656  return __pyx_r;
24657 }
24658 
24659 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
24660  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
24661  *
24662  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
24663  * if PyDataType_HASSUBARRAY(d):
24664  * return <tuple>d.subarray.shape
24665  */
24666 
24667 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
24668  PyObject *__pyx_r = NULL;
24669  __Pyx_RefNannyDeclarations
24670  int __pyx_t_1;
24671  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
24672 
24673  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
24674  *
24675  * cdef inline tuple PyDataType_SHAPE(dtype d):
24676  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
24677  * return <tuple>d.subarray.shape
24678  * else:
24679  */
24680  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
24681  if (__pyx_t_1) {
24682 
24683  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":752
24684  * cdef inline tuple PyDataType_SHAPE(dtype d):
24685  * if PyDataType_HASSUBARRAY(d):
24686  * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
24687  * else:
24688  * return ()
24689  */
24690  __Pyx_XDECREF(__pyx_r);
24691  __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
24692  __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
24693  goto __pyx_L0;
24694 
24695  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":751
24696  *
24697  * cdef inline tuple PyDataType_SHAPE(dtype d):
24698  * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
24699  * return <tuple>d.subarray.shape
24700  * else:
24701  */
24702  }
24703 
24704  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":754
24705  * return <tuple>d.subarray.shape
24706  * else:
24707  * return () # <<<<<<<<<<<<<<
24708  *
24709  *
24710  */
24711  /*else*/ {
24712  __Pyx_XDECREF(__pyx_r);
24713  __Pyx_INCREF(__pyx_empty_tuple);
24714  __pyx_r = __pyx_empty_tuple;
24715  goto __pyx_L0;
24716  }
24717 
24718  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":750
24719  * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
24720  *
24721  * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
24722  * if PyDataType_HASSUBARRAY(d):
24723  * return <tuple>d.subarray.shape
24724  */
24725 
24726  /* function exit code */
24727  __pyx_L0:;
24728  __Pyx_XGIVEREF(__pyx_r);
24729  __Pyx_RefNannyFinishContext();
24730  return __pyx_r;
24731 }
24732 
24733 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
24734  * int _import_umath() except -1
24735  *
24736  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
24737  * Py_INCREF(base) # important to do this before stealing the reference below!
24738  * PyArray_SetBaseObject(arr, base)
24739  */
24740 
24741 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
24742  __Pyx_RefNannyDeclarations
24743  __Pyx_RefNannySetupContext("set_array_base", 0);
24744 
24745  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":930
24746  *
24747  * cdef inline void set_array_base(ndarray arr, object base):
24748  * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
24749  * PyArray_SetBaseObject(arr, base)
24750  *
24751  */
24752  Py_INCREF(__pyx_v_base);
24753 
24754  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":931
24755  * cdef inline void set_array_base(ndarray arr, object base):
24756  * Py_INCREF(base) # important to do this before stealing the reference below!
24757  * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
24758  *
24759  * cdef inline object get_array_base(ndarray arr):
24760  */
24761  (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
24762 
24763  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":929
24764  * int _import_umath() except -1
24765  *
24766  * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
24767  * Py_INCREF(base) # important to do this before stealing the reference below!
24768  * PyArray_SetBaseObject(arr, base)
24769  */
24770 
24771  /* function exit code */
24772  __Pyx_RefNannyFinishContext();
24773 }
24774 
24775 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
24776  * PyArray_SetBaseObject(arr, base)
24777  *
24778  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
24779  * base = PyArray_BASE(arr)
24780  * if base is NULL:
24781  */
24782 
24783 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
24784  PyObject *__pyx_v_base;
24785  PyObject *__pyx_r = NULL;
24786  __Pyx_RefNannyDeclarations
24787  int __pyx_t_1;
24788  __Pyx_RefNannySetupContext("get_array_base", 0);
24789 
24790  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":934
24791  *
24792  * cdef inline object get_array_base(ndarray arr):
24793  * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
24794  * if base is NULL:
24795  * return None
24796  */
24797  __pyx_v_base = PyArray_BASE(__pyx_v_arr);
24798 
24799  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
24800  * cdef inline object get_array_base(ndarray arr):
24801  * base = PyArray_BASE(arr)
24802  * if base is NULL: # <<<<<<<<<<<<<<
24803  * return None
24804  * return <object>base
24805  */
24806  __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
24807  if (__pyx_t_1) {
24808 
24809  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":936
24810  * base = PyArray_BASE(arr)
24811  * if base is NULL:
24812  * return None # <<<<<<<<<<<<<<
24813  * return <object>base
24814  *
24815  */
24816  __Pyx_XDECREF(__pyx_r);
24817  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
24818  goto __pyx_L0;
24819 
24820  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":935
24821  * cdef inline object get_array_base(ndarray arr):
24822  * base = PyArray_BASE(arr)
24823  * if base is NULL: # <<<<<<<<<<<<<<
24824  * return None
24825  * return <object>base
24826  */
24827  }
24828 
24829  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":937
24830  * if base is NULL:
24831  * return None
24832  * return <object>base # <<<<<<<<<<<<<<
24833  *
24834  * # Versions of the import_* functions which are more suitable for
24835  */
24836  __Pyx_XDECREF(__pyx_r);
24837  __Pyx_INCREF(((PyObject *)__pyx_v_base));
24838  __pyx_r = ((PyObject *)__pyx_v_base);
24839  goto __pyx_L0;
24840 
24841  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":933
24842  * PyArray_SetBaseObject(arr, base)
24843  *
24844  * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
24845  * base = PyArray_BASE(arr)
24846  * if base is NULL:
24847  */
24848 
24849  /* function exit code */
24850  __pyx_L0:;
24851  __Pyx_XGIVEREF(__pyx_r);
24852  __Pyx_RefNannyFinishContext();
24853  return __pyx_r;
24854 }
24855 
24856 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
24857  * # Versions of the import_* functions which are more suitable for
24858  * # Cython code.
24859  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
24860  * try:
24861  * __pyx_import_array()
24862  */
24863 
24864 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
24865  int __pyx_r;
24866  __Pyx_RefNannyDeclarations
24867  PyObject *__pyx_t_1 = NULL;
24868  PyObject *__pyx_t_2 = NULL;
24869  PyObject *__pyx_t_3 = NULL;
24870  int __pyx_t_4;
24871  PyObject *__pyx_t_5 = NULL;
24872  PyObject *__pyx_t_6 = NULL;
24873  PyObject *__pyx_t_7 = NULL;
24874  PyObject *__pyx_t_8 = NULL;
24875  int __pyx_lineno = 0;
24876  const char *__pyx_filename = NULL;
24877  int __pyx_clineno = 0;
24878  __Pyx_RefNannySetupContext("import_array", 0);
24879 
24880  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
24881  * # Cython code.
24882  * cdef inline int import_array() except -1:
24883  * try: # <<<<<<<<<<<<<<
24884  * __pyx_import_array()
24885  * except Exception:
24886  */
24887  {
24888  __Pyx_PyThreadState_declare
24889  __Pyx_PyThreadState_assign
24890  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
24891  __Pyx_XGOTREF(__pyx_t_1);
24892  __Pyx_XGOTREF(__pyx_t_2);
24893  __Pyx_XGOTREF(__pyx_t_3);
24894  /*try:*/ {
24895 
24896  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":943
24897  * cdef inline int import_array() except -1:
24898  * try:
24899  * __pyx_import_array() # <<<<<<<<<<<<<<
24900  * except Exception:
24901  * raise ImportError("numpy.core.multiarray failed to import")
24902  */
24903  __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 943, __pyx_L3_error)
24904 
24905  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
24906  * # Cython code.
24907  * cdef inline int import_array() except -1:
24908  * try: # <<<<<<<<<<<<<<
24909  * __pyx_import_array()
24910  * except Exception:
24911  */
24912  }
24913  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
24914  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
24915  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
24916  goto __pyx_L8_try_end;
24917  __pyx_L3_error:;
24918 
24919  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":944
24920  * try:
24921  * __pyx_import_array()
24922  * except Exception: # <<<<<<<<<<<<<<
24923  * raise ImportError("numpy.core.multiarray failed to import")
24924  *
24925  */
24926  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
24927  if (__pyx_t_4) {
24928  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
24929  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 944, __pyx_L5_except_error)
24930  __Pyx_GOTREF(__pyx_t_5);
24931  __Pyx_GOTREF(__pyx_t_6);
24932  __Pyx_GOTREF(__pyx_t_7);
24933 
24934  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
24935  * __pyx_import_array()
24936  * except Exception:
24937  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
24938  *
24939  * cdef inline int import_umath() except -1:
24940  */
24941  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 945, __pyx_L5_except_error)
24942  __Pyx_GOTREF(__pyx_t_8);
24943  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
24944  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
24945  __PYX_ERR(1, 945, __pyx_L5_except_error)
24946  }
24947  goto __pyx_L5_except_error;
24948  __pyx_L5_except_error:;
24949 
24950  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":942
24951  * # Cython code.
24952  * cdef inline int import_array() except -1:
24953  * try: # <<<<<<<<<<<<<<
24954  * __pyx_import_array()
24955  * except Exception:
24956  */
24957  __Pyx_XGIVEREF(__pyx_t_1);
24958  __Pyx_XGIVEREF(__pyx_t_2);
24959  __Pyx_XGIVEREF(__pyx_t_3);
24960  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
24961  goto __pyx_L1_error;
24962  __pyx_L8_try_end:;
24963  }
24964 
24965  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":941
24966  * # Versions of the import_* functions which are more suitable for
24967  * # Cython code.
24968  * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
24969  * try:
24970  * __pyx_import_array()
24971  */
24972 
24973  /* function exit code */
24974  __pyx_r = 0;
24975  goto __pyx_L0;
24976  __pyx_L1_error:;
24977  __Pyx_XDECREF(__pyx_t_5);
24978  __Pyx_XDECREF(__pyx_t_6);
24979  __Pyx_XDECREF(__pyx_t_7);
24980  __Pyx_XDECREF(__pyx_t_8);
24981  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
24982  __pyx_r = -1;
24983  __pyx_L0:;
24984  __Pyx_RefNannyFinishContext();
24985  return __pyx_r;
24986 }
24987 
24988 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
24989  * raise ImportError("numpy.core.multiarray failed to import")
24990  *
24991  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
24992  * try:
24993  * _import_umath()
24994  */
24995 
24996 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
24997  int __pyx_r;
24998  __Pyx_RefNannyDeclarations
24999  PyObject *__pyx_t_1 = NULL;
25000  PyObject *__pyx_t_2 = NULL;
25001  PyObject *__pyx_t_3 = NULL;
25002  int __pyx_t_4;
25003  PyObject *__pyx_t_5 = NULL;
25004  PyObject *__pyx_t_6 = NULL;
25005  PyObject *__pyx_t_7 = NULL;
25006  PyObject *__pyx_t_8 = NULL;
25007  int __pyx_lineno = 0;
25008  const char *__pyx_filename = NULL;
25009  int __pyx_clineno = 0;
25010  __Pyx_RefNannySetupContext("import_umath", 0);
25011 
25012  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
25013  *
25014  * cdef inline int import_umath() except -1:
25015  * try: # <<<<<<<<<<<<<<
25016  * _import_umath()
25017  * except Exception:
25018  */
25019  {
25020  __Pyx_PyThreadState_declare
25021  __Pyx_PyThreadState_assign
25022  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
25023  __Pyx_XGOTREF(__pyx_t_1);
25024  __Pyx_XGOTREF(__pyx_t_2);
25025  __Pyx_XGOTREF(__pyx_t_3);
25026  /*try:*/ {
25027 
25028  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":949
25029  * cdef inline int import_umath() except -1:
25030  * try:
25031  * _import_umath() # <<<<<<<<<<<<<<
25032  * except Exception:
25033  * raise ImportError("numpy.core.umath failed to import")
25034  */
25035  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 949, __pyx_L3_error)
25036 
25037  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
25038  *
25039  * cdef inline int import_umath() except -1:
25040  * try: # <<<<<<<<<<<<<<
25041  * _import_umath()
25042  * except Exception:
25043  */
25044  }
25045  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
25046  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25047  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25048  goto __pyx_L8_try_end;
25049  __pyx_L3_error:;
25050 
25051  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":950
25052  * try:
25053  * _import_umath()
25054  * except Exception: # <<<<<<<<<<<<<<
25055  * raise ImportError("numpy.core.umath failed to import")
25056  *
25057  */
25058  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
25059  if (__pyx_t_4) {
25060  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
25061  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 950, __pyx_L5_except_error)
25062  __Pyx_GOTREF(__pyx_t_5);
25063  __Pyx_GOTREF(__pyx_t_6);
25064  __Pyx_GOTREF(__pyx_t_7);
25065 
25066  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
25067  * _import_umath()
25068  * except Exception:
25069  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
25070  *
25071  * cdef inline int import_ufunc() except -1:
25072  */
25073  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 951, __pyx_L5_except_error)
25074  __Pyx_GOTREF(__pyx_t_8);
25075  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
25076  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
25077  __PYX_ERR(1, 951, __pyx_L5_except_error)
25078  }
25079  goto __pyx_L5_except_error;
25080  __pyx_L5_except_error:;
25081 
25082  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":948
25083  *
25084  * cdef inline int import_umath() except -1:
25085  * try: # <<<<<<<<<<<<<<
25086  * _import_umath()
25087  * except Exception:
25088  */
25089  __Pyx_XGIVEREF(__pyx_t_1);
25090  __Pyx_XGIVEREF(__pyx_t_2);
25091  __Pyx_XGIVEREF(__pyx_t_3);
25092  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25093  goto __pyx_L1_error;
25094  __pyx_L8_try_end:;
25095  }
25096 
25097  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":947
25098  * raise ImportError("numpy.core.multiarray failed to import")
25099  *
25100  * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
25101  * try:
25102  * _import_umath()
25103  */
25104 
25105  /* function exit code */
25106  __pyx_r = 0;
25107  goto __pyx_L0;
25108  __pyx_L1_error:;
25109  __Pyx_XDECREF(__pyx_t_5);
25110  __Pyx_XDECREF(__pyx_t_6);
25111  __Pyx_XDECREF(__pyx_t_7);
25112  __Pyx_XDECREF(__pyx_t_8);
25113  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
25114  __pyx_r = -1;
25115  __pyx_L0:;
25116  __Pyx_RefNannyFinishContext();
25117  return __pyx_r;
25118 }
25119 
25120 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
25121  * raise ImportError("numpy.core.umath failed to import")
25122  *
25123  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
25124  * try:
25125  * _import_umath()
25126  */
25127 
25128 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
25129  int __pyx_r;
25130  __Pyx_RefNannyDeclarations
25131  PyObject *__pyx_t_1 = NULL;
25132  PyObject *__pyx_t_2 = NULL;
25133  PyObject *__pyx_t_3 = NULL;
25134  int __pyx_t_4;
25135  PyObject *__pyx_t_5 = NULL;
25136  PyObject *__pyx_t_6 = NULL;
25137  PyObject *__pyx_t_7 = NULL;
25138  PyObject *__pyx_t_8 = NULL;
25139  int __pyx_lineno = 0;
25140  const char *__pyx_filename = NULL;
25141  int __pyx_clineno = 0;
25142  __Pyx_RefNannySetupContext("import_ufunc", 0);
25143 
25144  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
25145  *
25146  * cdef inline int import_ufunc() except -1:
25147  * try: # <<<<<<<<<<<<<<
25148  * _import_umath()
25149  * except Exception:
25150  */
25151  {
25152  __Pyx_PyThreadState_declare
25153  __Pyx_PyThreadState_assign
25154  __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
25155  __Pyx_XGOTREF(__pyx_t_1);
25156  __Pyx_XGOTREF(__pyx_t_2);
25157  __Pyx_XGOTREF(__pyx_t_3);
25158  /*try:*/ {
25159 
25160  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":955
25161  * cdef inline int import_ufunc() except -1:
25162  * try:
25163  * _import_umath() # <<<<<<<<<<<<<<
25164  * except Exception:
25165  * raise ImportError("numpy.core.umath failed to import")
25166  */
25167  __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 955, __pyx_L3_error)
25168 
25169  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
25170  *
25171  * cdef inline int import_ufunc() except -1:
25172  * try: # <<<<<<<<<<<<<<
25173  * _import_umath()
25174  * except Exception:
25175  */
25176  }
25177  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
25178  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
25179  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
25180  goto __pyx_L8_try_end;
25181  __pyx_L3_error:;
25182 
25183  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":956
25184  * try:
25185  * _import_umath()
25186  * except Exception: # <<<<<<<<<<<<<<
25187  * raise ImportError("numpy.core.umath failed to import")
25188  *
25189  */
25190  __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
25191  if (__pyx_t_4) {
25192  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
25193  if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 956, __pyx_L5_except_error)
25194  __Pyx_GOTREF(__pyx_t_5);
25195  __Pyx_GOTREF(__pyx_t_6);
25196  __Pyx_GOTREF(__pyx_t_7);
25197 
25198  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":957
25199  * _import_umath()
25200  * except Exception:
25201  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
25202  *
25203  * cdef extern from *:
25204  */
25205  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 957, __pyx_L5_except_error)
25206  __Pyx_GOTREF(__pyx_t_8);
25207  __Pyx_Raise(__pyx_t_8, 0, 0, 0);
25208  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
25209  __PYX_ERR(1, 957, __pyx_L5_except_error)
25210  }
25211  goto __pyx_L5_except_error;
25212  __pyx_L5_except_error:;
25213 
25214  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":954
25215  *
25216  * cdef inline int import_ufunc() except -1:
25217  * try: # <<<<<<<<<<<<<<
25218  * _import_umath()
25219  * except Exception:
25220  */
25221  __Pyx_XGIVEREF(__pyx_t_1);
25222  __Pyx_XGIVEREF(__pyx_t_2);
25223  __Pyx_XGIVEREF(__pyx_t_3);
25224  __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
25225  goto __pyx_L1_error;
25226  __pyx_L8_try_end:;
25227  }
25228 
25229  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":953
25230  * raise ImportError("numpy.core.umath failed to import")
25231  *
25232  * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
25233  * try:
25234  * _import_umath()
25235  */
25236 
25237  /* function exit code */
25238  __pyx_r = 0;
25239  goto __pyx_L0;
25240  __pyx_L1_error:;
25241  __Pyx_XDECREF(__pyx_t_5);
25242  __Pyx_XDECREF(__pyx_t_6);
25243  __Pyx_XDECREF(__pyx_t_7);
25244  __Pyx_XDECREF(__pyx_t_8);
25245  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
25246  __pyx_r = -1;
25247  __pyx_L0:;
25248  __Pyx_RefNannyFinishContext();
25249  return __pyx_r;
25250 }
25251 
25252 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
25253  *
25254  *
25255  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
25256  * """
25257  * Cython equivalent of `isinstance(obj, np.timedelta64)`
25258  */
25259 
25260 static CYTHON_INLINE int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
25261  int __pyx_r;
25262  __Pyx_RefNannyDeclarations
25263  __Pyx_RefNannySetupContext("is_timedelta64_object", 0);
25264 
25265  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":979
25266  * bool
25267  * """
25268  * return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type) # <<<<<<<<<<<<<<
25269  *
25270  *
25271  */
25272  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
25273  goto __pyx_L0;
25274 
25275  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":967
25276  *
25277  *
25278  * cdef inline bint is_timedelta64_object(object obj): # <<<<<<<<<<<<<<
25279  * """
25280  * Cython equivalent of `isinstance(obj, np.timedelta64)`
25281  */
25282 
25283  /* function exit code */
25284  __pyx_L0:;
25285  __Pyx_RefNannyFinishContext();
25286  return __pyx_r;
25287 }
25288 
25289 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
25290  *
25291  *
25292  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
25293  * """
25294  * Cython equivalent of `isinstance(obj, np.datetime64)`
25295  */
25296 
25297 static CYTHON_INLINE int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
25298  int __pyx_r;
25299  __Pyx_RefNannyDeclarations
25300  __Pyx_RefNannySetupContext("is_datetime64_object", 0);
25301 
25302  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":994
25303  * bool
25304  * """
25305  * return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type) # <<<<<<<<<<<<<<
25306  *
25307  *
25308  */
25309  __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
25310  goto __pyx_L0;
25311 
25312  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":982
25313  *
25314  *
25315  * cdef inline bint is_datetime64_object(object obj): # <<<<<<<<<<<<<<
25316  * """
25317  * Cython equivalent of `isinstance(obj, np.datetime64)`
25318  */
25319 
25320  /* function exit code */
25321  __pyx_L0:;
25322  __Pyx_RefNannyFinishContext();
25323  return __pyx_r;
25324 }
25325 
25326 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
25327  *
25328  *
25329  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
25330  * """
25331  * returns the int64 value underlying scalar numpy datetime64 object
25332  */
25333 
25334 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
25335  npy_datetime __pyx_r;
25336 
25337  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1004
25338  * also needed. That can be found using `get_datetime64_unit`.
25339  * """
25340  * return (<PyDatetimeScalarObject*>obj).obval # <<<<<<<<<<<<<<
25341  *
25342  *
25343  */
25344  __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
25345  goto __pyx_L0;
25346 
25347  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":997
25348  *
25349  *
25350  * cdef inline npy_datetime get_datetime64_value(object obj) nogil: # <<<<<<<<<<<<<<
25351  * """
25352  * returns the int64 value underlying scalar numpy datetime64 object
25353  */
25354 
25355  /* function exit code */
25356  __pyx_L0:;
25357  return __pyx_r;
25358 }
25359 
25360 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
25361  *
25362  *
25363  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
25364  * """
25365  * returns the int64 value underlying scalar numpy timedelta64 object
25366  */
25367 
25368 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
25369  npy_timedelta __pyx_r;
25370 
25371  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1011
25372  * returns the int64 value underlying scalar numpy timedelta64 object
25373  * """
25374  * return (<PyTimedeltaScalarObject*>obj).obval # <<<<<<<<<<<<<<
25375  *
25376  *
25377  */
25378  __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
25379  goto __pyx_L0;
25380 
25381  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1007
25382  *
25383  *
25384  * cdef inline npy_timedelta get_timedelta64_value(object obj) nogil: # <<<<<<<<<<<<<<
25385  * """
25386  * returns the int64 value underlying scalar numpy timedelta64 object
25387  */
25388 
25389  /* function exit code */
25390  __pyx_L0:;
25391  return __pyx_r;
25392 }
25393 
25394 /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
25395  *
25396  *
25397  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
25398  * """
25399  * returns the unit part of the dtype for a numpy datetime64 object.
25400  */
25401 
25402 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
25403  NPY_DATETIMEUNIT __pyx_r;
25404 
25405  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1018
25406  * returns the unit part of the dtype for a numpy datetime64 object.
25407  * """
25408  * return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base # <<<<<<<<<<<<<<
25409  */
25410  __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
25411  goto __pyx_L0;
25412 
25413  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":1014
25414  *
25415  *
25416  * cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil: # <<<<<<<<<<<<<<
25417  * """
25418  * returns the unit part of the dtype for a numpy datetime64 object.
25419  */
25420 
25421  /* function exit code */
25422  __pyx_L0:;
25423  return __pyx_r;
25424 }
25425 
25426 /* "View.MemoryView":122
25427  * cdef bint dtype_is_object
25428  *
25429  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
25430  * mode="c", bint allocate_buffer=True):
25431  *
25432  */
25433 
25434 /* Python wrapper */
25435 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
25436 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
25437  PyObject *__pyx_v_shape = 0;
25438  Py_ssize_t __pyx_v_itemsize;
25439  PyObject *__pyx_v_format = 0;
25440  PyObject *__pyx_v_mode = 0;
25441  int __pyx_v_allocate_buffer;
25442  int __pyx_lineno = 0;
25443  const char *__pyx_filename = NULL;
25444  int __pyx_clineno = 0;
25445  int __pyx_r;
25446  __Pyx_RefNannyDeclarations
25447  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
25448  {
25449  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
25450  PyObject* values[5] = {0,0,0,0,0};
25451  values[3] = ((PyObject *)__pyx_n_s_c);
25452  if (unlikely(__pyx_kwds)) {
25453  Py_ssize_t kw_args;
25454  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
25455  switch (pos_args) {
25456  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
25457  CYTHON_FALLTHROUGH;
25458  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
25459  CYTHON_FALLTHROUGH;
25460  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
25461  CYTHON_FALLTHROUGH;
25462  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25463  CYTHON_FALLTHROUGH;
25464  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25465  CYTHON_FALLTHROUGH;
25466  case 0: break;
25467  default: goto __pyx_L5_argtuple_error;
25468  }
25469  kw_args = PyDict_Size(__pyx_kwds);
25470  switch (pos_args) {
25471  case 0:
25472  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
25473  else goto __pyx_L5_argtuple_error;
25474  CYTHON_FALLTHROUGH;
25475  case 1:
25476  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
25477  else {
25478  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
25479  }
25480  CYTHON_FALLTHROUGH;
25481  case 2:
25482  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
25483  else {
25484  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
25485  }
25486  CYTHON_FALLTHROUGH;
25487  case 3:
25488  if (kw_args > 0) {
25489  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
25490  if (value) { values[3] = value; kw_args--; }
25491  }
25492  CYTHON_FALLTHROUGH;
25493  case 4:
25494  if (kw_args > 0) {
25495  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
25496  if (value) { values[4] = value; kw_args--; }
25497  }
25498  }
25499  if (unlikely(kw_args > 0)) {
25500  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
25501  }
25502  } else {
25503  switch (PyTuple_GET_SIZE(__pyx_args)) {
25504  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
25505  CYTHON_FALLTHROUGH;
25506  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
25507  CYTHON_FALLTHROUGH;
25508  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
25509  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
25510  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
25511  break;
25512  default: goto __pyx_L5_argtuple_error;
25513  }
25514  }
25515  __pyx_v_shape = ((PyObject*)values[0]);
25516  __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
25517  __pyx_v_format = values[2];
25518  __pyx_v_mode = values[3];
25519  if (values[4]) {
25520  __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
25521  } else {
25522 
25523  /* "View.MemoryView":123
25524  *
25525  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
25526  * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
25527  *
25528  * cdef int idx
25529  */
25530  __pyx_v_allocate_buffer = ((int)1);
25531  }
25532  }
25533  goto __pyx_L4_argument_unpacking_done;
25534  __pyx_L5_argtuple_error:;
25535  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
25536  __pyx_L3_error:;
25537  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
25538  __Pyx_RefNannyFinishContext();
25539  return -1;
25540  __pyx_L4_argument_unpacking_done:;
25541  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
25542  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
25543  PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
25544  }
25545  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
25546 
25547  /* "View.MemoryView":122
25548  * cdef bint dtype_is_object
25549  *
25550  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
25551  * mode="c", bint allocate_buffer=True):
25552  *
25553  */
25554 
25555  /* function exit code */
25556  goto __pyx_L0;
25557  __pyx_L1_error:;
25558  __pyx_r = -1;
25559  __pyx_L0:;
25560  __Pyx_RefNannyFinishContext();
25561  return __pyx_r;
25562 }
25563 
25564 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
25565  int __pyx_v_idx;
25566  Py_ssize_t __pyx_v_i;
25567  Py_ssize_t __pyx_v_dim;
25568  PyObject **__pyx_v_p;
25569  char __pyx_v_order;
25570  int __pyx_r;
25571  __Pyx_RefNannyDeclarations
25572  Py_ssize_t __pyx_t_1;
25573  int __pyx_t_2;
25574  PyObject *__pyx_t_3 = NULL;
25575  int __pyx_t_4;
25576  PyObject *__pyx_t_5 = NULL;
25577  PyObject *__pyx_t_6 = NULL;
25578  char *__pyx_t_7;
25579  int __pyx_t_8;
25580  Py_ssize_t __pyx_t_9;
25581  PyObject *__pyx_t_10 = NULL;
25582  Py_ssize_t __pyx_t_11;
25583  int __pyx_lineno = 0;
25584  const char *__pyx_filename = NULL;
25585  int __pyx_clineno = 0;
25586  __Pyx_RefNannySetupContext("__cinit__", 0);
25587  __Pyx_INCREF(__pyx_v_format);
25588 
25589  /* "View.MemoryView":129
25590  * cdef PyObject **p
25591  *
25592  * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
25593  * self.itemsize = itemsize
25594  *
25595  */
25596  if (unlikely(__pyx_v_shape == Py_None)) {
25597  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
25598  __PYX_ERR(2, 129, __pyx_L1_error)
25599  }
25600  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
25601  __pyx_v_self->ndim = ((int)__pyx_t_1);
25602 
25603  /* "View.MemoryView":130
25604  *
25605  * self.ndim = <int> len(shape)
25606  * self.itemsize = itemsize # <<<<<<<<<<<<<<
25607  *
25608  * if not self.ndim:
25609  */
25610  __pyx_v_self->itemsize = __pyx_v_itemsize;
25611 
25612  /* "View.MemoryView":132
25613  * self.itemsize = itemsize
25614  *
25615  * if not self.ndim: # <<<<<<<<<<<<<<
25616  * raise ValueError("Empty shape tuple for cython.array")
25617  *
25618  */
25619  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
25620  if (unlikely(__pyx_t_2)) {
25621 
25622  /* "View.MemoryView":133
25623  *
25624  * if not self.ndim:
25625  * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
25626  *
25627  * if itemsize <= 0:
25628  */
25629  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
25630  __Pyx_GOTREF(__pyx_t_3);
25631  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25632  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25633  __PYX_ERR(2, 133, __pyx_L1_error)
25634 
25635  /* "View.MemoryView":132
25636  * self.itemsize = itemsize
25637  *
25638  * if not self.ndim: # <<<<<<<<<<<<<<
25639  * raise ValueError("Empty shape tuple for cython.array")
25640  *
25641  */
25642  }
25643 
25644  /* "View.MemoryView":135
25645  * raise ValueError("Empty shape tuple for cython.array")
25646  *
25647  * if itemsize <= 0: # <<<<<<<<<<<<<<
25648  * raise ValueError("itemsize <= 0 for cython.array")
25649  *
25650  */
25651  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
25652  if (unlikely(__pyx_t_2)) {
25653 
25654  /* "View.MemoryView":136
25655  *
25656  * if itemsize <= 0:
25657  * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
25658  *
25659  * if not isinstance(format, bytes):
25660  */
25661  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
25662  __Pyx_GOTREF(__pyx_t_3);
25663  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25664  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25665  __PYX_ERR(2, 136, __pyx_L1_error)
25666 
25667  /* "View.MemoryView":135
25668  * raise ValueError("Empty shape tuple for cython.array")
25669  *
25670  * if itemsize <= 0: # <<<<<<<<<<<<<<
25671  * raise ValueError("itemsize <= 0 for cython.array")
25672  *
25673  */
25674  }
25675 
25676  /* "View.MemoryView":138
25677  * raise ValueError("itemsize <= 0 for cython.array")
25678  *
25679  * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
25680  * format = format.encode('ASCII')
25681  * self._format = format # keep a reference to the byte string
25682  */
25683  __pyx_t_2 = PyBytes_Check(__pyx_v_format);
25684  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
25685  if (__pyx_t_4) {
25686 
25687  /* "View.MemoryView":139
25688  *
25689  * if not isinstance(format, bytes):
25690  * format = format.encode('ASCII') # <<<<<<<<<<<<<<
25691  * self._format = format # keep a reference to the byte string
25692  * self.format = self._format
25693  */
25694  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
25695  __Pyx_GOTREF(__pyx_t_5);
25696  __pyx_t_6 = NULL;
25697  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
25698  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
25699  if (likely(__pyx_t_6)) {
25700  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
25701  __Pyx_INCREF(__pyx_t_6);
25702  __Pyx_INCREF(function);
25703  __Pyx_DECREF_SET(__pyx_t_5, function);
25704  }
25705  }
25706  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
25707  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
25708  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
25709  __Pyx_GOTREF(__pyx_t_3);
25710  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25711  __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
25712  __pyx_t_3 = 0;
25713 
25714  /* "View.MemoryView":138
25715  * raise ValueError("itemsize <= 0 for cython.array")
25716  *
25717  * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
25718  * format = format.encode('ASCII')
25719  * self._format = format # keep a reference to the byte string
25720  */
25721  }
25722 
25723  /* "View.MemoryView":140
25724  * if not isinstance(format, bytes):
25725  * format = format.encode('ASCII')
25726  * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
25727  * self.format = self._format
25728  *
25729  */
25730  if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error)
25731  __pyx_t_3 = __pyx_v_format;
25732  __Pyx_INCREF(__pyx_t_3);
25733  __Pyx_GIVEREF(__pyx_t_3);
25734  __Pyx_GOTREF(__pyx_v_self->_format);
25735  __Pyx_DECREF(__pyx_v_self->_format);
25736  __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
25737  __pyx_t_3 = 0;
25738 
25739  /* "View.MemoryView":141
25740  * format = format.encode('ASCII')
25741  * self._format = format # keep a reference to the byte string
25742  * self.format = self._format # <<<<<<<<<<<<<<
25743  *
25744  *
25745  */
25746  if (unlikely(__pyx_v_self->_format == Py_None)) {
25747  PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
25748  __PYX_ERR(2, 141, __pyx_L1_error)
25749  }
25750  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
25751  __pyx_v_self->format = __pyx_t_7;
25752 
25753  /* "View.MemoryView":144
25754  *
25755  *
25756  * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
25757  * self._strides = self._shape + self.ndim
25758  *
25759  */
25760  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
25761 
25762  /* "View.MemoryView":145
25763  *
25764  * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
25765  * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
25766  *
25767  * if not self._shape:
25768  */
25769  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
25770 
25771  /* "View.MemoryView":147
25772  * self._strides = self._shape + self.ndim
25773  *
25774  * if not self._shape: # <<<<<<<<<<<<<<
25775  * raise MemoryError("unable to allocate shape and strides.")
25776  *
25777  */
25778  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
25779  if (unlikely(__pyx_t_4)) {
25780 
25781  /* "View.MemoryView":148
25782  *
25783  * if not self._shape:
25784  * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
25785  *
25786  *
25787  */
25788  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
25789  __Pyx_GOTREF(__pyx_t_3);
25790  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
25791  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25792  __PYX_ERR(2, 148, __pyx_L1_error)
25793 
25794  /* "View.MemoryView":147
25795  * self._strides = self._shape + self.ndim
25796  *
25797  * if not self._shape: # <<<<<<<<<<<<<<
25798  * raise MemoryError("unable to allocate shape and strides.")
25799  *
25800  */
25801  }
25802 
25803  /* "View.MemoryView":151
25804  *
25805  *
25806  * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
25807  * if dim <= 0:
25808  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
25809  */
25810  __pyx_t_8 = 0;
25811  __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
25812  for (;;) {
25813  if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
25814  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25815  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error)
25816  #else
25817  __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
25818  __Pyx_GOTREF(__pyx_t_5);
25819  #endif
25820  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
25821  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
25822  __pyx_v_dim = __pyx_t_9;
25823  __pyx_v_idx = __pyx_t_8;
25824  __pyx_t_8 = (__pyx_t_8 + 1);
25825 
25826  /* "View.MemoryView":152
25827  *
25828  * for idx, dim in enumerate(shape):
25829  * if dim <= 0: # <<<<<<<<<<<<<<
25830  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
25831  * self._shape[idx] = dim
25832  */
25833  __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
25834  if (unlikely(__pyx_t_4)) {
25835 
25836  /* "View.MemoryView":153
25837  * for idx, dim in enumerate(shape):
25838  * if dim <= 0:
25839  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
25840  * self._shape[idx] = dim
25841  *
25842  */
25843  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
25844  __Pyx_GOTREF(__pyx_t_5);
25845  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
25846  __Pyx_GOTREF(__pyx_t_6);
25847  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
25848  __Pyx_GOTREF(__pyx_t_10);
25849  __Pyx_GIVEREF(__pyx_t_5);
25850  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
25851  __Pyx_GIVEREF(__pyx_t_6);
25852  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
25853  __pyx_t_5 = 0;
25854  __pyx_t_6 = 0;
25855  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
25856  __Pyx_GOTREF(__pyx_t_6);
25857  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
25858  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
25859  __Pyx_GOTREF(__pyx_t_10);
25860  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
25861  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
25862  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
25863  __PYX_ERR(2, 153, __pyx_L1_error)
25864 
25865  /* "View.MemoryView":152
25866  *
25867  * for idx, dim in enumerate(shape):
25868  * if dim <= 0: # <<<<<<<<<<<<<<
25869  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
25870  * self._shape[idx] = dim
25871  */
25872  }
25873 
25874  /* "View.MemoryView":154
25875  * if dim <= 0:
25876  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
25877  * self._shape[idx] = dim # <<<<<<<<<<<<<<
25878  *
25879  * cdef char order
25880  */
25881  (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
25882 
25883  /* "View.MemoryView":151
25884  *
25885  *
25886  * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
25887  * if dim <= 0:
25888  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
25889  */
25890  }
25891  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25892 
25893  /* "View.MemoryView":157
25894  *
25895  * cdef char order
25896  * if mode == 'fortran': # <<<<<<<<<<<<<<
25897  * order = b'F'
25898  * self.mode = u'fortran'
25899  */
25900  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
25901  if (__pyx_t_4) {
25902 
25903  /* "View.MemoryView":158
25904  * cdef char order
25905  * if mode == 'fortran':
25906  * order = b'F' # <<<<<<<<<<<<<<
25907  * self.mode = u'fortran'
25908  * elif mode == 'c':
25909  */
25910  __pyx_v_order = 'F';
25911 
25912  /* "View.MemoryView":159
25913  * if mode == 'fortran':
25914  * order = b'F'
25915  * self.mode = u'fortran' # <<<<<<<<<<<<<<
25916  * elif mode == 'c':
25917  * order = b'C'
25918  */
25919  __Pyx_INCREF(__pyx_n_u_fortran);
25920  __Pyx_GIVEREF(__pyx_n_u_fortran);
25921  __Pyx_GOTREF(__pyx_v_self->mode);
25922  __Pyx_DECREF(__pyx_v_self->mode);
25923  __pyx_v_self->mode = __pyx_n_u_fortran;
25924 
25925  /* "View.MemoryView":157
25926  *
25927  * cdef char order
25928  * if mode == 'fortran': # <<<<<<<<<<<<<<
25929  * order = b'F'
25930  * self.mode = u'fortran'
25931  */
25932  goto __pyx_L10;
25933  }
25934 
25935  /* "View.MemoryView":160
25936  * order = b'F'
25937  * self.mode = u'fortran'
25938  * elif mode == 'c': # <<<<<<<<<<<<<<
25939  * order = b'C'
25940  * self.mode = u'c'
25941  */
25942  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
25943  if (likely(__pyx_t_4)) {
25944 
25945  /* "View.MemoryView":161
25946  * self.mode = u'fortran'
25947  * elif mode == 'c':
25948  * order = b'C' # <<<<<<<<<<<<<<
25949  * self.mode = u'c'
25950  * else:
25951  */
25952  __pyx_v_order = 'C';
25953 
25954  /* "View.MemoryView":162
25955  * elif mode == 'c':
25956  * order = b'C'
25957  * self.mode = u'c' # <<<<<<<<<<<<<<
25958  * else:
25959  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
25960  */
25961  __Pyx_INCREF(__pyx_n_u_c);
25962  __Pyx_GIVEREF(__pyx_n_u_c);
25963  __Pyx_GOTREF(__pyx_v_self->mode);
25964  __Pyx_DECREF(__pyx_v_self->mode);
25965  __pyx_v_self->mode = __pyx_n_u_c;
25966 
25967  /* "View.MemoryView":160
25968  * order = b'F'
25969  * self.mode = u'fortran'
25970  * elif mode == 'c': # <<<<<<<<<<<<<<
25971  * order = b'C'
25972  * self.mode = u'c'
25973  */
25974  goto __pyx_L10;
25975  }
25976 
25977  /* "View.MemoryView":164
25978  * self.mode = u'c'
25979  * else:
25980  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
25981  *
25982  * self.len = fill_contig_strides_array(self._shape, self._strides,
25983  */
25984  /*else*/ {
25985  __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error)
25986  __Pyx_GOTREF(__pyx_t_3);
25987  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
25988  __Pyx_GOTREF(__pyx_t_10);
25989  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
25990  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
25991  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
25992  __PYX_ERR(2, 164, __pyx_L1_error)
25993  }
25994  __pyx_L10:;
25995 
25996  /* "View.MemoryView":166
25997  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
25998  *
25999  * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
26000  * itemsize, self.ndim, order)
26001  *
26002  */
26003  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
26004 
26005  /* "View.MemoryView":169
26006  * itemsize, self.ndim, order)
26007  *
26008  * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
26009  * self.dtype_is_object = format == b'O'
26010  * if allocate_buffer:
26011  */
26012  __pyx_v_self->free_data = __pyx_v_allocate_buffer;
26013 
26014  /* "View.MemoryView":170
26015  *
26016  * self.free_data = allocate_buffer
26017  * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
26018  * if allocate_buffer:
26019  *
26020  */
26021  __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error)
26022  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
26023  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26024  __pyx_v_self->dtype_is_object = __pyx_t_4;
26025 
26026  /* "View.MemoryView":171
26027  * self.free_data = allocate_buffer
26028  * self.dtype_is_object = format == b'O'
26029  * if allocate_buffer: # <<<<<<<<<<<<<<
26030  *
26031  *
26032  */
26033  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
26034  if (__pyx_t_4) {
26035 
26036  /* "View.MemoryView":174
26037  *
26038  *
26039  * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
26040  * if not self.data:
26041  * raise MemoryError("unable to allocate array data.")
26042  */
26043  __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
26044 
26045  /* "View.MemoryView":175
26046  *
26047  * self.data = <char *>malloc(self.len)
26048  * if not self.data: # <<<<<<<<<<<<<<
26049  * raise MemoryError("unable to allocate array data.")
26050  *
26051  */
26052  __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
26053  if (unlikely(__pyx_t_4)) {
26054 
26055  /* "View.MemoryView":176
26056  * self.data = <char *>malloc(self.len)
26057  * if not self.data:
26058  * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
26059  *
26060  * if self.dtype_is_object:
26061  */
26062  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
26063  __Pyx_GOTREF(__pyx_t_10);
26064  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
26065  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
26066  __PYX_ERR(2, 176, __pyx_L1_error)
26067 
26068  /* "View.MemoryView":175
26069  *
26070  * self.data = <char *>malloc(self.len)
26071  * if not self.data: # <<<<<<<<<<<<<<
26072  * raise MemoryError("unable to allocate array data.")
26073  *
26074  */
26075  }
26076 
26077  /* "View.MemoryView":178
26078  * raise MemoryError("unable to allocate array data.")
26079  *
26080  * if self.dtype_is_object: # <<<<<<<<<<<<<<
26081  * p = <PyObject **> self.data
26082  * for i in range(self.len / itemsize):
26083  */
26084  __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
26085  if (__pyx_t_4) {
26086 
26087  /* "View.MemoryView":179
26088  *
26089  * if self.dtype_is_object:
26090  * p = <PyObject **> self.data # <<<<<<<<<<<<<<
26091  * for i in range(self.len / itemsize):
26092  * p[i] = Py_None
26093  */
26094  __pyx_v_p = ((PyObject **)__pyx_v_self->data);
26095 
26096  /* "View.MemoryView":180
26097  * if self.dtype_is_object:
26098  * p = <PyObject **> self.data
26099  * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
26100  * p[i] = Py_None
26101  * Py_INCREF(Py_None)
26102  */
26103  if (unlikely(__pyx_v_itemsize == 0)) {
26104  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
26105  __PYX_ERR(2, 180, __pyx_L1_error)
26106  }
26107  else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
26108  PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
26109  __PYX_ERR(2, 180, __pyx_L1_error)
26110  }
26111  __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
26112  __pyx_t_9 = __pyx_t_1;
26113  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
26114  __pyx_v_i = __pyx_t_11;
26115 
26116  /* "View.MemoryView":181
26117  * p = <PyObject **> self.data
26118  * for i in range(self.len / itemsize):
26119  * p[i] = Py_None # <<<<<<<<<<<<<<
26120  * Py_INCREF(Py_None)
26121  *
26122  */
26123  (__pyx_v_p[__pyx_v_i]) = Py_None;
26124 
26125  /* "View.MemoryView":182
26126  * for i in range(self.len / itemsize):
26127  * p[i] = Py_None
26128  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
26129  *
26130  * @cname('getbuffer')
26131  */
26132  Py_INCREF(Py_None);
26133  }
26134 
26135  /* "View.MemoryView":178
26136  * raise MemoryError("unable to allocate array data.")
26137  *
26138  * if self.dtype_is_object: # <<<<<<<<<<<<<<
26139  * p = <PyObject **> self.data
26140  * for i in range(self.len / itemsize):
26141  */
26142  }
26143 
26144  /* "View.MemoryView":171
26145  * self.free_data = allocate_buffer
26146  * self.dtype_is_object = format == b'O'
26147  * if allocate_buffer: # <<<<<<<<<<<<<<
26148  *
26149  *
26150  */
26151  }
26152 
26153  /* "View.MemoryView":122
26154  * cdef bint dtype_is_object
26155  *
26156  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
26157  * mode="c", bint allocate_buffer=True):
26158  *
26159  */
26160 
26161  /* function exit code */
26162  __pyx_r = 0;
26163  goto __pyx_L0;
26164  __pyx_L1_error:;
26165  __Pyx_XDECREF(__pyx_t_3);
26166  __Pyx_XDECREF(__pyx_t_5);
26167  __Pyx_XDECREF(__pyx_t_6);
26168  __Pyx_XDECREF(__pyx_t_10);
26169  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26170  __pyx_r = -1;
26171  __pyx_L0:;
26172  __Pyx_XDECREF(__pyx_v_format);
26173  __Pyx_RefNannyFinishContext();
26174  return __pyx_r;
26175 }
26176 
26177 /* "View.MemoryView":185
26178  *
26179  * @cname('getbuffer')
26180  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
26181  * cdef int bufmode = -1
26182  * if self.mode == u"c":
26183  */
26184 
26185 /* Python wrapper */
26186 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
26187 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
26188  int __pyx_r;
26189  __Pyx_RefNannyDeclarations
26190  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
26191  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
26192 
26193  /* function exit code */
26194  __Pyx_RefNannyFinishContext();
26195  return __pyx_r;
26196 }
26197 
26198 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
26199  int __pyx_v_bufmode;
26200  int __pyx_r;
26201  __Pyx_RefNannyDeclarations
26202  int __pyx_t_1;
26203  int __pyx_t_2;
26204  PyObject *__pyx_t_3 = NULL;
26205  char *__pyx_t_4;
26206  Py_ssize_t __pyx_t_5;
26207  int __pyx_t_6;
26208  Py_ssize_t *__pyx_t_7;
26209  int __pyx_lineno = 0;
26210  const char *__pyx_filename = NULL;
26211  int __pyx_clineno = 0;
26212  if (__pyx_v_info == NULL) {
26213  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
26214  return -1;
26215  }
26216  __Pyx_RefNannySetupContext("__getbuffer__", 0);
26217  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
26218  __Pyx_GIVEREF(__pyx_v_info->obj);
26219 
26220  /* "View.MemoryView":186
26221  * @cname('getbuffer')
26222  * def __getbuffer__(self, Py_buffer *info, int flags):
26223  * cdef int bufmode = -1 # <<<<<<<<<<<<<<
26224  * if self.mode == u"c":
26225  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26226  */
26227  __pyx_v_bufmode = -1;
26228 
26229  /* "View.MemoryView":187
26230  * def __getbuffer__(self, Py_buffer *info, int flags):
26231  * cdef int bufmode = -1
26232  * if self.mode == u"c": # <<<<<<<<<<<<<<
26233  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26234  * elif self.mode == u"fortran":
26235  */
26236  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
26237  __pyx_t_2 = (__pyx_t_1 != 0);
26238  if (__pyx_t_2) {
26239 
26240  /* "View.MemoryView":188
26241  * cdef int bufmode = -1
26242  * if self.mode == u"c":
26243  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
26244  * elif self.mode == u"fortran":
26245  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26246  */
26247  __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
26248 
26249  /* "View.MemoryView":187
26250  * def __getbuffer__(self, Py_buffer *info, int flags):
26251  * cdef int bufmode = -1
26252  * if self.mode == u"c": # <<<<<<<<<<<<<<
26253  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26254  * elif self.mode == u"fortran":
26255  */
26256  goto __pyx_L3;
26257  }
26258 
26259  /* "View.MemoryView":189
26260  * if self.mode == u"c":
26261  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26262  * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
26263  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26264  * if not (flags & bufmode):
26265  */
26266  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
26267  __pyx_t_1 = (__pyx_t_2 != 0);
26268  if (__pyx_t_1) {
26269 
26270  /* "View.MemoryView":190
26271  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26272  * elif self.mode == u"fortran":
26273  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
26274  * if not (flags & bufmode):
26275  * raise ValueError("Can only create a buffer that is contiguous in memory.")
26276  */
26277  __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
26278 
26279  /* "View.MemoryView":189
26280  * if self.mode == u"c":
26281  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26282  * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
26283  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26284  * if not (flags & bufmode):
26285  */
26286  }
26287  __pyx_L3:;
26288 
26289  /* "View.MemoryView":191
26290  * elif self.mode == u"fortran":
26291  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26292  * if not (flags & bufmode): # <<<<<<<<<<<<<<
26293  * raise ValueError("Can only create a buffer that is contiguous in memory.")
26294  * info.buf = self.data
26295  */
26296  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
26297  if (unlikely(__pyx_t_1)) {
26298 
26299  /* "View.MemoryView":192
26300  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26301  * if not (flags & bufmode):
26302  * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
26303  * info.buf = self.data
26304  * info.len = self.len
26305  */
26306  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
26307  __Pyx_GOTREF(__pyx_t_3);
26308  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
26309  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26310  __PYX_ERR(2, 192, __pyx_L1_error)
26311 
26312  /* "View.MemoryView":191
26313  * elif self.mode == u"fortran":
26314  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
26315  * if not (flags & bufmode): # <<<<<<<<<<<<<<
26316  * raise ValueError("Can only create a buffer that is contiguous in memory.")
26317  * info.buf = self.data
26318  */
26319  }
26320 
26321  /* "View.MemoryView":193
26322  * if not (flags & bufmode):
26323  * raise ValueError("Can only create a buffer that is contiguous in memory.")
26324  * info.buf = self.data # <<<<<<<<<<<<<<
26325  * info.len = self.len
26326  * info.ndim = self.ndim
26327  */
26328  __pyx_t_4 = __pyx_v_self->data;
26329  __pyx_v_info->buf = __pyx_t_4;
26330 
26331  /* "View.MemoryView":194
26332  * raise ValueError("Can only create a buffer that is contiguous in memory.")
26333  * info.buf = self.data
26334  * info.len = self.len # <<<<<<<<<<<<<<
26335  * info.ndim = self.ndim
26336  * info.shape = self._shape
26337  */
26338  __pyx_t_5 = __pyx_v_self->len;
26339  __pyx_v_info->len = __pyx_t_5;
26340 
26341  /* "View.MemoryView":195
26342  * info.buf = self.data
26343  * info.len = self.len
26344  * info.ndim = self.ndim # <<<<<<<<<<<<<<
26345  * info.shape = self._shape
26346  * info.strides = self._strides
26347  */
26348  __pyx_t_6 = __pyx_v_self->ndim;
26349  __pyx_v_info->ndim = __pyx_t_6;
26350 
26351  /* "View.MemoryView":196
26352  * info.len = self.len
26353  * info.ndim = self.ndim
26354  * info.shape = self._shape # <<<<<<<<<<<<<<
26355  * info.strides = self._strides
26356  * info.suboffsets = NULL
26357  */
26358  __pyx_t_7 = __pyx_v_self->_shape;
26359  __pyx_v_info->shape = __pyx_t_7;
26360 
26361  /* "View.MemoryView":197
26362  * info.ndim = self.ndim
26363  * info.shape = self._shape
26364  * info.strides = self._strides # <<<<<<<<<<<<<<
26365  * info.suboffsets = NULL
26366  * info.itemsize = self.itemsize
26367  */
26368  __pyx_t_7 = __pyx_v_self->_strides;
26369  __pyx_v_info->strides = __pyx_t_7;
26370 
26371  /* "View.MemoryView":198
26372  * info.shape = self._shape
26373  * info.strides = self._strides
26374  * info.suboffsets = NULL # <<<<<<<<<<<<<<
26375  * info.itemsize = self.itemsize
26376  * info.readonly = 0
26377  */
26378  __pyx_v_info->suboffsets = NULL;
26379 
26380  /* "View.MemoryView":199
26381  * info.strides = self._strides
26382  * info.suboffsets = NULL
26383  * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
26384  * info.readonly = 0
26385  *
26386  */
26387  __pyx_t_5 = __pyx_v_self->itemsize;
26388  __pyx_v_info->itemsize = __pyx_t_5;
26389 
26390  /* "View.MemoryView":200
26391  * info.suboffsets = NULL
26392  * info.itemsize = self.itemsize
26393  * info.readonly = 0 # <<<<<<<<<<<<<<
26394  *
26395  * if flags & PyBUF_FORMAT:
26396  */
26397  __pyx_v_info->readonly = 0;
26398 
26399  /* "View.MemoryView":202
26400  * info.readonly = 0
26401  *
26402  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
26403  * info.format = self.format
26404  * else:
26405  */
26406  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
26407  if (__pyx_t_1) {
26408 
26409  /* "View.MemoryView":203
26410  *
26411  * if flags & PyBUF_FORMAT:
26412  * info.format = self.format # <<<<<<<<<<<<<<
26413  * else:
26414  * info.format = NULL
26415  */
26416  __pyx_t_4 = __pyx_v_self->format;
26417  __pyx_v_info->format = __pyx_t_4;
26418 
26419  /* "View.MemoryView":202
26420  * info.readonly = 0
26421  *
26422  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
26423  * info.format = self.format
26424  * else:
26425  */
26426  goto __pyx_L5;
26427  }
26428 
26429  /* "View.MemoryView":205
26430  * info.format = self.format
26431  * else:
26432  * info.format = NULL # <<<<<<<<<<<<<<
26433  *
26434  * info.obj = self
26435  */
26436  /*else*/ {
26437  __pyx_v_info->format = NULL;
26438  }
26439  __pyx_L5:;
26440 
26441  /* "View.MemoryView":207
26442  * info.format = NULL
26443  *
26444  * info.obj = self # <<<<<<<<<<<<<<
26445  *
26446  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
26447  */
26448  __Pyx_INCREF(((PyObject *)__pyx_v_self));
26449  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
26450  __Pyx_GOTREF(__pyx_v_info->obj);
26451  __Pyx_DECREF(__pyx_v_info->obj);
26452  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
26453 
26454  /* "View.MemoryView":185
26455  *
26456  * @cname('getbuffer')
26457  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
26458  * cdef int bufmode = -1
26459  * if self.mode == u"c":
26460  */
26461 
26462  /* function exit code */
26463  __pyx_r = 0;
26464  goto __pyx_L0;
26465  __pyx_L1_error:;
26466  __Pyx_XDECREF(__pyx_t_3);
26467  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26468  __pyx_r = -1;
26469  if (__pyx_v_info->obj != NULL) {
26470  __Pyx_GOTREF(__pyx_v_info->obj);
26471  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
26472  }
26473  goto __pyx_L2;
26474  __pyx_L0:;
26475  if (__pyx_v_info->obj == Py_None) {
26476  __Pyx_GOTREF(__pyx_v_info->obj);
26477  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
26478  }
26479  __pyx_L2:;
26480  __Pyx_RefNannyFinishContext();
26481  return __pyx_r;
26482 }
26483 
26484 /* "View.MemoryView":211
26485  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
26486  *
26487  * def __dealloc__(array self): # <<<<<<<<<<<<<<
26488  * if self.callback_free_data != NULL:
26489  * self.callback_free_data(self.data)
26490  */
26491 
26492 /* Python wrapper */
26493 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
26494 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
26495  __Pyx_RefNannyDeclarations
26496  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
26497  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
26498 
26499  /* function exit code */
26500  __Pyx_RefNannyFinishContext();
26501 }
26502 
26503 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
26504  __Pyx_RefNannyDeclarations
26505  int __pyx_t_1;
26506  __Pyx_RefNannySetupContext("__dealloc__", 0);
26507 
26508  /* "View.MemoryView":212
26509  *
26510  * def __dealloc__(array self):
26511  * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
26512  * self.callback_free_data(self.data)
26513  * elif self.free_data:
26514  */
26515  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
26516  if (__pyx_t_1) {
26517 
26518  /* "View.MemoryView":213
26519  * def __dealloc__(array self):
26520  * if self.callback_free_data != NULL:
26521  * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
26522  * elif self.free_data:
26523  * if self.dtype_is_object:
26524  */
26525  __pyx_v_self->callback_free_data(__pyx_v_self->data);
26526 
26527  /* "View.MemoryView":212
26528  *
26529  * def __dealloc__(array self):
26530  * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
26531  * self.callback_free_data(self.data)
26532  * elif self.free_data:
26533  */
26534  goto __pyx_L3;
26535  }
26536 
26537  /* "View.MemoryView":214
26538  * if self.callback_free_data != NULL:
26539  * self.callback_free_data(self.data)
26540  * elif self.free_data: # <<<<<<<<<<<<<<
26541  * if self.dtype_is_object:
26542  * refcount_objects_in_slice(self.data, self._shape,
26543  */
26544  __pyx_t_1 = (__pyx_v_self->free_data != 0);
26545  if (__pyx_t_1) {
26546 
26547  /* "View.MemoryView":215
26548  * self.callback_free_data(self.data)
26549  * elif self.free_data:
26550  * if self.dtype_is_object: # <<<<<<<<<<<<<<
26551  * refcount_objects_in_slice(self.data, self._shape,
26552  * self._strides, self.ndim, False)
26553  */
26554  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
26555  if (__pyx_t_1) {
26556 
26557  /* "View.MemoryView":216
26558  * elif self.free_data:
26559  * if self.dtype_is_object:
26560  * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
26561  * self._strides, self.ndim, False)
26562  * free(self.data)
26563  */
26564  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
26565 
26566  /* "View.MemoryView":215
26567  * self.callback_free_data(self.data)
26568  * elif self.free_data:
26569  * if self.dtype_is_object: # <<<<<<<<<<<<<<
26570  * refcount_objects_in_slice(self.data, self._shape,
26571  * self._strides, self.ndim, False)
26572  */
26573  }
26574 
26575  /* "View.MemoryView":218
26576  * refcount_objects_in_slice(self.data, self._shape,
26577  * self._strides, self.ndim, False)
26578  * free(self.data) # <<<<<<<<<<<<<<
26579  * PyObject_Free(self._shape)
26580  *
26581  */
26582  free(__pyx_v_self->data);
26583 
26584  /* "View.MemoryView":214
26585  * if self.callback_free_data != NULL:
26586  * self.callback_free_data(self.data)
26587  * elif self.free_data: # <<<<<<<<<<<<<<
26588  * if self.dtype_is_object:
26589  * refcount_objects_in_slice(self.data, self._shape,
26590  */
26591  }
26592  __pyx_L3:;
26593 
26594  /* "View.MemoryView":219
26595  * self._strides, self.ndim, False)
26596  * free(self.data)
26597  * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
26598  *
26599  * @property
26600  */
26601  PyObject_Free(__pyx_v_self->_shape);
26602 
26603  /* "View.MemoryView":211
26604  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
26605  *
26606  * def __dealloc__(array self): # <<<<<<<<<<<<<<
26607  * if self.callback_free_data != NULL:
26608  * self.callback_free_data(self.data)
26609  */
26610 
26611  /* function exit code */
26612  __Pyx_RefNannyFinishContext();
26613 }
26614 
26615 /* "View.MemoryView":222
26616  *
26617  * @property
26618  * def memview(self): # <<<<<<<<<<<<<<
26619  * return self.get_memview()
26620  *
26621  */
26622 
26623 /* Python wrapper */
26624 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
26625 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
26626  PyObject *__pyx_r = 0;
26627  __Pyx_RefNannyDeclarations
26628  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
26629  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
26630 
26631  /* function exit code */
26632  __Pyx_RefNannyFinishContext();
26633  return __pyx_r;
26634 }
26635 
26636 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
26637  PyObject *__pyx_r = NULL;
26638  __Pyx_RefNannyDeclarations
26639  PyObject *__pyx_t_1 = NULL;
26640  int __pyx_lineno = 0;
26641  const char *__pyx_filename = NULL;
26642  int __pyx_clineno = 0;
26643  __Pyx_RefNannySetupContext("__get__", 0);
26644 
26645  /* "View.MemoryView":223
26646  * @property
26647  * def memview(self):
26648  * return self.get_memview() # <<<<<<<<<<<<<<
26649  *
26650  * @cname('get_memview')
26651  */
26652  __Pyx_XDECREF(__pyx_r);
26653  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
26654  __Pyx_GOTREF(__pyx_t_1);
26655  __pyx_r = __pyx_t_1;
26656  __pyx_t_1 = 0;
26657  goto __pyx_L0;
26658 
26659  /* "View.MemoryView":222
26660  *
26661  * @property
26662  * def memview(self): # <<<<<<<<<<<<<<
26663  * return self.get_memview()
26664  *
26665  */
26666 
26667  /* function exit code */
26668  __pyx_L1_error:;
26669  __Pyx_XDECREF(__pyx_t_1);
26670  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26671  __pyx_r = NULL;
26672  __pyx_L0:;
26673  __Pyx_XGIVEREF(__pyx_r);
26674  __Pyx_RefNannyFinishContext();
26675  return __pyx_r;
26676 }
26677 
26678 /* "View.MemoryView":226
26679  *
26680  * @cname('get_memview')
26681  * cdef get_memview(self): # <<<<<<<<<<<<<<
26682  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
26683  * return memoryview(self, flags, self.dtype_is_object)
26684  */
26685 
26686 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
26687  int __pyx_v_flags;
26688  PyObject *__pyx_r = NULL;
26689  __Pyx_RefNannyDeclarations
26690  PyObject *__pyx_t_1 = NULL;
26691  PyObject *__pyx_t_2 = NULL;
26692  PyObject *__pyx_t_3 = NULL;
26693  int __pyx_lineno = 0;
26694  const char *__pyx_filename = NULL;
26695  int __pyx_clineno = 0;
26696  __Pyx_RefNannySetupContext("get_memview", 0);
26697 
26698  /* "View.MemoryView":227
26699  * @cname('get_memview')
26700  * cdef get_memview(self):
26701  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
26702  * return memoryview(self, flags, self.dtype_is_object)
26703  *
26704  */
26705  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
26706 
26707  /* "View.MemoryView":228
26708  * cdef get_memview(self):
26709  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
26710  * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
26711  *
26712  * def __len__(self):
26713  */
26714  __Pyx_XDECREF(__pyx_r);
26715  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
26716  __Pyx_GOTREF(__pyx_t_1);
26717  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
26718  __Pyx_GOTREF(__pyx_t_2);
26719  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
26720  __Pyx_GOTREF(__pyx_t_3);
26721  __Pyx_INCREF(((PyObject *)__pyx_v_self));
26722  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
26723  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
26724  __Pyx_GIVEREF(__pyx_t_1);
26725  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
26726  __Pyx_GIVEREF(__pyx_t_2);
26727  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
26728  __pyx_t_1 = 0;
26729  __pyx_t_2 = 0;
26730  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
26731  __Pyx_GOTREF(__pyx_t_2);
26732  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
26733  __pyx_r = __pyx_t_2;
26734  __pyx_t_2 = 0;
26735  goto __pyx_L0;
26736 
26737  /* "View.MemoryView":226
26738  *
26739  * @cname('get_memview')
26740  * cdef get_memview(self): # <<<<<<<<<<<<<<
26741  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
26742  * return memoryview(self, flags, self.dtype_is_object)
26743  */
26744 
26745  /* function exit code */
26746  __pyx_L1_error:;
26747  __Pyx_XDECREF(__pyx_t_1);
26748  __Pyx_XDECREF(__pyx_t_2);
26749  __Pyx_XDECREF(__pyx_t_3);
26750  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
26751  __pyx_r = 0;
26752  __pyx_L0:;
26753  __Pyx_XGIVEREF(__pyx_r);
26754  __Pyx_RefNannyFinishContext();
26755  return __pyx_r;
26756 }
26757 
26758 /* "View.MemoryView":230
26759  * return memoryview(self, flags, self.dtype_is_object)
26760  *
26761  * def __len__(self): # <<<<<<<<<<<<<<
26762  * return self._shape[0]
26763  *
26764  */
26765 
26766 /* Python wrapper */
26767 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
26768 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
26769  Py_ssize_t __pyx_r;
26770  __Pyx_RefNannyDeclarations
26771  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
26772  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
26773 
26774  /* function exit code */
26775  __Pyx_RefNannyFinishContext();
26776  return __pyx_r;
26777 }
26778 
26779 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
26780  Py_ssize_t __pyx_r;
26781  __Pyx_RefNannyDeclarations
26782  __Pyx_RefNannySetupContext("__len__", 0);
26783 
26784  /* "View.MemoryView":231
26785  *
26786  * def __len__(self):
26787  * return self._shape[0] # <<<<<<<<<<<<<<
26788  *
26789  * def __getattr__(self, attr):
26790  */
26791  __pyx_r = (__pyx_v_self->_shape[0]);
26792  goto __pyx_L0;
26793 
26794  /* "View.MemoryView":230
26795  * return memoryview(self, flags, self.dtype_is_object)
26796  *
26797  * def __len__(self): # <<<<<<<<<<<<<<
26798  * return self._shape[0]
26799  *
26800  */
26801 
26802  /* function exit code */
26803  __pyx_L0:;
26804  __Pyx_RefNannyFinishContext();
26805  return __pyx_r;
26806 }
26807 
26808 /* "View.MemoryView":233
26809  * return self._shape[0]
26810  *
26811  * def __getattr__(self, attr): # <<<<<<<<<<<<<<
26812  * return getattr(self.memview, attr)
26813  *
26814  */
26815 
26816 /* Python wrapper */
26817 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
26818 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
26819  PyObject *__pyx_r = 0;
26820  __Pyx_RefNannyDeclarations
26821  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
26822  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
26823 
26824  /* function exit code */
26825  __Pyx_RefNannyFinishContext();
26826  return __pyx_r;
26827 }
26828 
26829 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
26830  PyObject *__pyx_r = NULL;
26831  __Pyx_RefNannyDeclarations
26832  PyObject *__pyx_t_1 = NULL;
26833  PyObject *__pyx_t_2 = NULL;
26834  int __pyx_lineno = 0;
26835  const char *__pyx_filename = NULL;
26836  int __pyx_clineno = 0;
26837  __Pyx_RefNannySetupContext("__getattr__", 0);
26838 
26839  /* "View.MemoryView":234
26840  *
26841  * def __getattr__(self, attr):
26842  * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
26843  *
26844  * def __getitem__(self, item):
26845  */
26846  __Pyx_XDECREF(__pyx_r);
26847  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
26848  __Pyx_GOTREF(__pyx_t_1);
26849  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
26850  __Pyx_GOTREF(__pyx_t_2);
26851  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26852  __pyx_r = __pyx_t_2;
26853  __pyx_t_2 = 0;
26854  goto __pyx_L0;
26855 
26856  /* "View.MemoryView":233
26857  * return self._shape[0]
26858  *
26859  * def __getattr__(self, attr): # <<<<<<<<<<<<<<
26860  * return getattr(self.memview, attr)
26861  *
26862  */
26863 
26864  /* function exit code */
26865  __pyx_L1_error:;
26866  __Pyx_XDECREF(__pyx_t_1);
26867  __Pyx_XDECREF(__pyx_t_2);
26868  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26869  __pyx_r = NULL;
26870  __pyx_L0:;
26871  __Pyx_XGIVEREF(__pyx_r);
26872  __Pyx_RefNannyFinishContext();
26873  return __pyx_r;
26874 }
26875 
26876 /* "View.MemoryView":236
26877  * return getattr(self.memview, attr)
26878  *
26879  * def __getitem__(self, item): # <<<<<<<<<<<<<<
26880  * return self.memview[item]
26881  *
26882  */
26883 
26884 /* Python wrapper */
26885 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
26886 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
26887  PyObject *__pyx_r = 0;
26888  __Pyx_RefNannyDeclarations
26889  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
26890  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
26891 
26892  /* function exit code */
26893  __Pyx_RefNannyFinishContext();
26894  return __pyx_r;
26895 }
26896 
26897 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
26898  PyObject *__pyx_r = NULL;
26899  __Pyx_RefNannyDeclarations
26900  PyObject *__pyx_t_1 = NULL;
26901  PyObject *__pyx_t_2 = NULL;
26902  int __pyx_lineno = 0;
26903  const char *__pyx_filename = NULL;
26904  int __pyx_clineno = 0;
26905  __Pyx_RefNannySetupContext("__getitem__", 0);
26906 
26907  /* "View.MemoryView":237
26908  *
26909  * def __getitem__(self, item):
26910  * return self.memview[item] # <<<<<<<<<<<<<<
26911  *
26912  * def __setitem__(self, item, value):
26913  */
26914  __Pyx_XDECREF(__pyx_r);
26915  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
26916  __Pyx_GOTREF(__pyx_t_1);
26917  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
26918  __Pyx_GOTREF(__pyx_t_2);
26919  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26920  __pyx_r = __pyx_t_2;
26921  __pyx_t_2 = 0;
26922  goto __pyx_L0;
26923 
26924  /* "View.MemoryView":236
26925  * return getattr(self.memview, attr)
26926  *
26927  * def __getitem__(self, item): # <<<<<<<<<<<<<<
26928  * return self.memview[item]
26929  *
26930  */
26931 
26932  /* function exit code */
26933  __pyx_L1_error:;
26934  __Pyx_XDECREF(__pyx_t_1);
26935  __Pyx_XDECREF(__pyx_t_2);
26936  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
26937  __pyx_r = NULL;
26938  __pyx_L0:;
26939  __Pyx_XGIVEREF(__pyx_r);
26940  __Pyx_RefNannyFinishContext();
26941  return __pyx_r;
26942 }
26943 
26944 /* "View.MemoryView":239
26945  * return self.memview[item]
26946  *
26947  * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
26948  * self.memview[item] = value
26949  *
26950  */
26951 
26952 /* Python wrapper */
26953 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
26954 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
26955  int __pyx_r;
26956  __Pyx_RefNannyDeclarations
26957  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
26958  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
26959 
26960  /* function exit code */
26961  __Pyx_RefNannyFinishContext();
26962  return __pyx_r;
26963 }
26964 
26965 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
26966  int __pyx_r;
26967  __Pyx_RefNannyDeclarations
26968  PyObject *__pyx_t_1 = NULL;
26969  int __pyx_lineno = 0;
26970  const char *__pyx_filename = NULL;
26971  int __pyx_clineno = 0;
26972  __Pyx_RefNannySetupContext("__setitem__", 0);
26973 
26974  /* "View.MemoryView":240
26975  *
26976  * def __setitem__(self, item, value):
26977  * self.memview[item] = value # <<<<<<<<<<<<<<
26978  *
26979  *
26980  */
26981  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
26982  __Pyx_GOTREF(__pyx_t_1);
26983  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
26984  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
26985 
26986  /* "View.MemoryView":239
26987  * return self.memview[item]
26988  *
26989  * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
26990  * self.memview[item] = value
26991  *
26992  */
26993 
26994  /* function exit code */
26995  __pyx_r = 0;
26996  goto __pyx_L0;
26997  __pyx_L1_error:;
26998  __Pyx_XDECREF(__pyx_t_1);
26999  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27000  __pyx_r = -1;
27001  __pyx_L0:;
27002  __Pyx_RefNannyFinishContext();
27003  return __pyx_r;
27004 }
27005 
27006 /* "(tree fragment)":1
27007  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
27008  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27009  * def __setstate_cython__(self, __pyx_state):
27010  */
27011 
27012 /* Python wrapper */
27013 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
27014 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
27015  PyObject *__pyx_r = 0;
27016  __Pyx_RefNannyDeclarations
27017  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
27018  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
27019 
27020  /* function exit code */
27021  __Pyx_RefNannyFinishContext();
27022  return __pyx_r;
27023 }
27024 
27025 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
27026  PyObject *__pyx_r = NULL;
27027  __Pyx_RefNannyDeclarations
27028  PyObject *__pyx_t_1 = NULL;
27029  int __pyx_lineno = 0;
27030  const char *__pyx_filename = NULL;
27031  int __pyx_clineno = 0;
27032  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
27033 
27034  /* "(tree fragment)":2
27035  * def __reduce_cython__(self):
27036  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
27037  * def __setstate_cython__(self, __pyx_state):
27038  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27039  */
27040  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
27041  __Pyx_GOTREF(__pyx_t_1);
27042  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
27043  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27044  __PYX_ERR(2, 2, __pyx_L1_error)
27045 
27046  /* "(tree fragment)":1
27047  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
27048  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27049  * def __setstate_cython__(self, __pyx_state):
27050  */
27051 
27052  /* function exit code */
27053  __pyx_L1_error:;
27054  __Pyx_XDECREF(__pyx_t_1);
27055  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27056  __pyx_r = NULL;
27057  __Pyx_XGIVEREF(__pyx_r);
27058  __Pyx_RefNannyFinishContext();
27059  return __pyx_r;
27060 }
27061 
27062 /* "(tree fragment)":3
27063  * def __reduce_cython__(self):
27064  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27065  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
27066  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27067  */
27068 
27069 /* Python wrapper */
27070 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
27071 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
27072  PyObject *__pyx_r = 0;
27073  __Pyx_RefNannyDeclarations
27074  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
27075  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
27076 
27077  /* function exit code */
27078  __Pyx_RefNannyFinishContext();
27079  return __pyx_r;
27080 }
27081 
27082 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
27083  PyObject *__pyx_r = NULL;
27084  __Pyx_RefNannyDeclarations
27085  PyObject *__pyx_t_1 = NULL;
27086  int __pyx_lineno = 0;
27087  const char *__pyx_filename = NULL;
27088  int __pyx_clineno = 0;
27089  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
27090 
27091  /* "(tree fragment)":4
27092  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27093  * def __setstate_cython__(self, __pyx_state):
27094  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
27095  */
27096  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
27097  __Pyx_GOTREF(__pyx_t_1);
27098  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
27099  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27100  __PYX_ERR(2, 4, __pyx_L1_error)
27101 
27102  /* "(tree fragment)":3
27103  * def __reduce_cython__(self):
27104  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27105  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
27106  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
27107  */
27108 
27109  /* function exit code */
27110  __pyx_L1_error:;
27111  __Pyx_XDECREF(__pyx_t_1);
27112  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27113  __pyx_r = NULL;
27114  __Pyx_XGIVEREF(__pyx_r);
27115  __Pyx_RefNannyFinishContext();
27116  return __pyx_r;
27117 }
27118 
27119 /* "View.MemoryView":244
27120  *
27121  * @cname("__pyx_array_new")
27122  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
27123  * char *mode, char *buf):
27124  * cdef array result
27125  */
27126 
27127 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
27128  struct __pyx_array_obj *__pyx_v_result = 0;
27129  struct __pyx_array_obj *__pyx_r = NULL;
27130  __Pyx_RefNannyDeclarations
27131  int __pyx_t_1;
27132  PyObject *__pyx_t_2 = NULL;
27133  PyObject *__pyx_t_3 = NULL;
27134  PyObject *__pyx_t_4 = NULL;
27135  PyObject *__pyx_t_5 = NULL;
27136  int __pyx_lineno = 0;
27137  const char *__pyx_filename = NULL;
27138  int __pyx_clineno = 0;
27139  __Pyx_RefNannySetupContext("array_cwrapper", 0);
27140 
27141  /* "View.MemoryView":248
27142  * cdef array result
27143  *
27144  * if buf == NULL: # <<<<<<<<<<<<<<
27145  * result = array(shape, itemsize, format, mode.decode('ASCII'))
27146  * else:
27147  */
27148  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
27149  if (__pyx_t_1) {
27150 
27151  /* "View.MemoryView":249
27152  *
27153  * if buf == NULL:
27154  * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
27155  * else:
27156  * result = array(shape, itemsize, format, mode.decode('ASCII'),
27157  */
27158  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
27159  __Pyx_GOTREF(__pyx_t_2);
27160  __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
27161  __Pyx_GOTREF(__pyx_t_3);
27162  __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
27163  __Pyx_GOTREF(__pyx_t_4);
27164  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
27165  __Pyx_GOTREF(__pyx_t_5);
27166  __Pyx_INCREF(__pyx_v_shape);
27167  __Pyx_GIVEREF(__pyx_v_shape);
27168  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
27169  __Pyx_GIVEREF(__pyx_t_2);
27170  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
27171  __Pyx_GIVEREF(__pyx_t_3);
27172  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
27173  __Pyx_GIVEREF(__pyx_t_4);
27174  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
27175  __pyx_t_2 = 0;
27176  __pyx_t_3 = 0;
27177  __pyx_t_4 = 0;
27178  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
27179  __Pyx_GOTREF(__pyx_t_4);
27180  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
27181  __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
27182  __pyx_t_4 = 0;
27183 
27184  /* "View.MemoryView":248
27185  * cdef array result
27186  *
27187  * if buf == NULL: # <<<<<<<<<<<<<<
27188  * result = array(shape, itemsize, format, mode.decode('ASCII'))
27189  * else:
27190  */
27191  goto __pyx_L3;
27192  }
27193 
27194  /* "View.MemoryView":251
27195  * result = array(shape, itemsize, format, mode.decode('ASCII'))
27196  * else:
27197  * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
27198  * allocate_buffer=False)
27199  * result.data = buf
27200  */
27201  /*else*/ {
27202  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
27203  __Pyx_GOTREF(__pyx_t_4);
27204  __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
27205  __Pyx_GOTREF(__pyx_t_5);
27206  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error)
27207  __Pyx_GOTREF(__pyx_t_3);
27208  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
27209  __Pyx_GOTREF(__pyx_t_2);
27210  __Pyx_INCREF(__pyx_v_shape);
27211  __Pyx_GIVEREF(__pyx_v_shape);
27212  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
27213  __Pyx_GIVEREF(__pyx_t_4);
27214  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
27215  __Pyx_GIVEREF(__pyx_t_5);
27216  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
27217  __Pyx_GIVEREF(__pyx_t_3);
27218  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
27219  __pyx_t_4 = 0;
27220  __pyx_t_5 = 0;
27221  __pyx_t_3 = 0;
27222 
27223  /* "View.MemoryView":252
27224  * else:
27225  * result = array(shape, itemsize, format, mode.decode('ASCII'),
27226  * allocate_buffer=False) # <<<<<<<<<<<<<<
27227  * result.data = buf
27228  *
27229  */
27230  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
27231  __Pyx_GOTREF(__pyx_t_3);
27232  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
27233 
27234  /* "View.MemoryView":251
27235  * result = array(shape, itemsize, format, mode.decode('ASCII'))
27236  * else:
27237  * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
27238  * allocate_buffer=False)
27239  * result.data = buf
27240  */
27241  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
27242  __Pyx_GOTREF(__pyx_t_5);
27243  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
27244  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
27245  __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
27246  __pyx_t_5 = 0;
27247 
27248  /* "View.MemoryView":253
27249  * result = array(shape, itemsize, format, mode.decode('ASCII'),
27250  * allocate_buffer=False)
27251  * result.data = buf # <<<<<<<<<<<<<<
27252  *
27253  * return result
27254  */
27255  __pyx_v_result->data = __pyx_v_buf;
27256  }
27257  __pyx_L3:;
27258 
27259  /* "View.MemoryView":255
27260  * result.data = buf
27261  *
27262  * return result # <<<<<<<<<<<<<<
27263  *
27264  *
27265  */
27266  __Pyx_XDECREF(((PyObject *)__pyx_r));
27267  __Pyx_INCREF(((PyObject *)__pyx_v_result));
27268  __pyx_r = __pyx_v_result;
27269  goto __pyx_L0;
27270 
27271  /* "View.MemoryView":244
27272  *
27273  * @cname("__pyx_array_new")
27274  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
27275  * char *mode, char *buf):
27276  * cdef array result
27277  */
27278 
27279  /* function exit code */
27280  __pyx_L1_error:;
27281  __Pyx_XDECREF(__pyx_t_2);
27282  __Pyx_XDECREF(__pyx_t_3);
27283  __Pyx_XDECREF(__pyx_t_4);
27284  __Pyx_XDECREF(__pyx_t_5);
27285  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
27286  __pyx_r = 0;
27287  __pyx_L0:;
27288  __Pyx_XDECREF((PyObject *)__pyx_v_result);
27289  __Pyx_XGIVEREF((PyObject *)__pyx_r);
27290  __Pyx_RefNannyFinishContext();
27291  return __pyx_r;
27292 }
27293 
27294 /* "View.MemoryView":281
27295  * cdef class Enum(object):
27296  * cdef object name
27297  * def __init__(self, name): # <<<<<<<<<<<<<<
27298  * self.name = name
27299  * def __repr__(self):
27300  */
27301 
27302 /* Python wrapper */
27303 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27304 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27305  PyObject *__pyx_v_name = 0;
27306  int __pyx_lineno = 0;
27307  const char *__pyx_filename = NULL;
27308  int __pyx_clineno = 0;
27309  int __pyx_r;
27310  __Pyx_RefNannyDeclarations
27311  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
27312  {
27313  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
27314  PyObject* values[1] = {0};
27315  if (unlikely(__pyx_kwds)) {
27316  Py_ssize_t kw_args;
27317  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27318  switch (pos_args) {
27319  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27320  CYTHON_FALLTHROUGH;
27321  case 0: break;
27322  default: goto __pyx_L5_argtuple_error;
27323  }
27324  kw_args = PyDict_Size(__pyx_kwds);
27325  switch (pos_args) {
27326  case 0:
27327  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
27328  else goto __pyx_L5_argtuple_error;
27329  }
27330  if (unlikely(kw_args > 0)) {
27331  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
27332  }
27333  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
27334  goto __pyx_L5_argtuple_error;
27335  } else {
27336  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27337  }
27338  __pyx_v_name = values[0];
27339  }
27340  goto __pyx_L4_argument_unpacking_done;
27341  __pyx_L5_argtuple_error:;
27342  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
27343  __pyx_L3_error:;
27344  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27345  __Pyx_RefNannyFinishContext();
27346  return -1;
27347  __pyx_L4_argument_unpacking_done:;
27348  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
27349 
27350  /* function exit code */
27351  __Pyx_RefNannyFinishContext();
27352  return __pyx_r;
27353 }
27354 
27355 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
27356  int __pyx_r;
27357  __Pyx_RefNannyDeclarations
27358  __Pyx_RefNannySetupContext("__init__", 0);
27359 
27360  /* "View.MemoryView":282
27361  * cdef object name
27362  * def __init__(self, name):
27363  * self.name = name # <<<<<<<<<<<<<<
27364  * def __repr__(self):
27365  * return self.name
27366  */
27367  __Pyx_INCREF(__pyx_v_name);
27368  __Pyx_GIVEREF(__pyx_v_name);
27369  __Pyx_GOTREF(__pyx_v_self->name);
27370  __Pyx_DECREF(__pyx_v_self->name);
27371  __pyx_v_self->name = __pyx_v_name;
27372 
27373  /* "View.MemoryView":281
27374  * cdef class Enum(object):
27375  * cdef object name
27376  * def __init__(self, name): # <<<<<<<<<<<<<<
27377  * self.name = name
27378  * def __repr__(self):
27379  */
27380 
27381  /* function exit code */
27382  __pyx_r = 0;
27383  __Pyx_RefNannyFinishContext();
27384  return __pyx_r;
27385 }
27386 
27387 /* "View.MemoryView":283
27388  * def __init__(self, name):
27389  * self.name = name
27390  * def __repr__(self): # <<<<<<<<<<<<<<
27391  * return self.name
27392  *
27393  */
27394 
27395 /* Python wrapper */
27396 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
27397 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
27398  PyObject *__pyx_r = 0;
27399  __Pyx_RefNannyDeclarations
27400  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
27401  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
27402 
27403  /* function exit code */
27404  __Pyx_RefNannyFinishContext();
27405  return __pyx_r;
27406 }
27407 
27408 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
27409  PyObject *__pyx_r = NULL;
27410  __Pyx_RefNannyDeclarations
27411  __Pyx_RefNannySetupContext("__repr__", 0);
27412 
27413  /* "View.MemoryView":284
27414  * self.name = name
27415  * def __repr__(self):
27416  * return self.name # <<<<<<<<<<<<<<
27417  *
27418  * cdef generic = Enum("<strided and direct or indirect>")
27419  */
27420  __Pyx_XDECREF(__pyx_r);
27421  __Pyx_INCREF(__pyx_v_self->name);
27422  __pyx_r = __pyx_v_self->name;
27423  goto __pyx_L0;
27424 
27425  /* "View.MemoryView":283
27426  * def __init__(self, name):
27427  * self.name = name
27428  * def __repr__(self): # <<<<<<<<<<<<<<
27429  * return self.name
27430  *
27431  */
27432 
27433  /* function exit code */
27434  __pyx_L0:;
27435  __Pyx_XGIVEREF(__pyx_r);
27436  __Pyx_RefNannyFinishContext();
27437  return __pyx_r;
27438 }
27439 
27440 /* "(tree fragment)":1
27441  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
27442  * cdef tuple state
27443  * cdef object _dict
27444  */
27445 
27446 /* Python wrapper */
27447 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
27448 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
27449  PyObject *__pyx_r = 0;
27450  __Pyx_RefNannyDeclarations
27451  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
27452  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
27453 
27454  /* function exit code */
27455  __Pyx_RefNannyFinishContext();
27456  return __pyx_r;
27457 }
27458 
27459 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
27460  PyObject *__pyx_v_state = 0;
27461  PyObject *__pyx_v__dict = 0;
27462  int __pyx_v_use_setstate;
27463  PyObject *__pyx_r = NULL;
27464  __Pyx_RefNannyDeclarations
27465  PyObject *__pyx_t_1 = NULL;
27466  int __pyx_t_2;
27467  int __pyx_t_3;
27468  PyObject *__pyx_t_4 = NULL;
27469  PyObject *__pyx_t_5 = NULL;
27470  int __pyx_lineno = 0;
27471  const char *__pyx_filename = NULL;
27472  int __pyx_clineno = 0;
27473  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
27474 
27475  /* "(tree fragment)":5
27476  * cdef object _dict
27477  * cdef bint use_setstate
27478  * state = (self.name,) # <<<<<<<<<<<<<<
27479  * _dict = getattr(self, '__dict__', None)
27480  * if _dict is not None:
27481  */
27482  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
27483  __Pyx_GOTREF(__pyx_t_1);
27484  __Pyx_INCREF(__pyx_v_self->name);
27485  __Pyx_GIVEREF(__pyx_v_self->name);
27486  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
27487  __pyx_v_state = ((PyObject*)__pyx_t_1);
27488  __pyx_t_1 = 0;
27489 
27490  /* "(tree fragment)":6
27491  * cdef bint use_setstate
27492  * state = (self.name,)
27493  * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
27494  * if _dict is not None:
27495  * state += (_dict,)
27496  */
27497  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
27498  __Pyx_GOTREF(__pyx_t_1);
27499  __pyx_v__dict = __pyx_t_1;
27500  __pyx_t_1 = 0;
27501 
27502  /* "(tree fragment)":7
27503  * state = (self.name,)
27504  * _dict = getattr(self, '__dict__', None)
27505  * if _dict is not None: # <<<<<<<<<<<<<<
27506  * state += (_dict,)
27507  * use_setstate = True
27508  */
27509  __pyx_t_2 = (__pyx_v__dict != Py_None);
27510  __pyx_t_3 = (__pyx_t_2 != 0);
27511  if (__pyx_t_3) {
27512 
27513  /* "(tree fragment)":8
27514  * _dict = getattr(self, '__dict__', None)
27515  * if _dict is not None:
27516  * state += (_dict,) # <<<<<<<<<<<<<<
27517  * use_setstate = True
27518  * else:
27519  */
27520  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
27521  __Pyx_GOTREF(__pyx_t_1);
27522  __Pyx_INCREF(__pyx_v__dict);
27523  __Pyx_GIVEREF(__pyx_v__dict);
27524  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
27525  __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
27526  __Pyx_GOTREF(__pyx_t_4);
27527  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27528  __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
27529  __pyx_t_4 = 0;
27530 
27531  /* "(tree fragment)":9
27532  * if _dict is not None:
27533  * state += (_dict,)
27534  * use_setstate = True # <<<<<<<<<<<<<<
27535  * else:
27536  * use_setstate = self.name is not None
27537  */
27538  __pyx_v_use_setstate = 1;
27539 
27540  /* "(tree fragment)":7
27541  * state = (self.name,)
27542  * _dict = getattr(self, '__dict__', None)
27543  * if _dict is not None: # <<<<<<<<<<<<<<
27544  * state += (_dict,)
27545  * use_setstate = True
27546  */
27547  goto __pyx_L3;
27548  }
27549 
27550  /* "(tree fragment)":11
27551  * use_setstate = True
27552  * else:
27553  * use_setstate = self.name is not None # <<<<<<<<<<<<<<
27554  * if use_setstate:
27555  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
27556  */
27557  /*else*/ {
27558  __pyx_t_3 = (__pyx_v_self->name != Py_None);
27559  __pyx_v_use_setstate = __pyx_t_3;
27560  }
27561  __pyx_L3:;
27562 
27563  /* "(tree fragment)":12
27564  * else:
27565  * use_setstate = self.name is not None
27566  * if use_setstate: # <<<<<<<<<<<<<<
27567  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
27568  * else:
27569  */
27570  __pyx_t_3 = (__pyx_v_use_setstate != 0);
27571  if (__pyx_t_3) {
27572 
27573  /* "(tree fragment)":13
27574  * use_setstate = self.name is not None
27575  * if use_setstate:
27576  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
27577  * else:
27578  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
27579  */
27580  __Pyx_XDECREF(__pyx_r);
27581  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
27582  __Pyx_GOTREF(__pyx_t_4);
27583  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
27584  __Pyx_GOTREF(__pyx_t_1);
27585  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
27586  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
27587  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
27588  __Pyx_INCREF(__pyx_int_184977713);
27589  __Pyx_GIVEREF(__pyx_int_184977713);
27590  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
27591  __Pyx_INCREF(Py_None);
27592  __Pyx_GIVEREF(Py_None);
27593  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
27594  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
27595  __Pyx_GOTREF(__pyx_t_5);
27596  __Pyx_GIVEREF(__pyx_t_4);
27597  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
27598  __Pyx_GIVEREF(__pyx_t_1);
27599  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
27600  __Pyx_INCREF(__pyx_v_state);
27601  __Pyx_GIVEREF(__pyx_v_state);
27602  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
27603  __pyx_t_4 = 0;
27604  __pyx_t_1 = 0;
27605  __pyx_r = __pyx_t_5;
27606  __pyx_t_5 = 0;
27607  goto __pyx_L0;
27608 
27609  /* "(tree fragment)":12
27610  * else:
27611  * use_setstate = self.name is not None
27612  * if use_setstate: # <<<<<<<<<<<<<<
27613  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
27614  * else:
27615  */
27616  }
27617 
27618  /* "(tree fragment)":15
27619  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
27620  * else:
27621  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
27622  * def __setstate_cython__(self, __pyx_state):
27623  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
27624  */
27625  /*else*/ {
27626  __Pyx_XDECREF(__pyx_r);
27627  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
27628  __Pyx_GOTREF(__pyx_t_5);
27629  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
27630  __Pyx_GOTREF(__pyx_t_1);
27631  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
27632  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
27633  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
27634  __Pyx_INCREF(__pyx_int_184977713);
27635  __Pyx_GIVEREF(__pyx_int_184977713);
27636  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
27637  __Pyx_INCREF(__pyx_v_state);
27638  __Pyx_GIVEREF(__pyx_v_state);
27639  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
27640  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
27641  __Pyx_GOTREF(__pyx_t_4);
27642  __Pyx_GIVEREF(__pyx_t_5);
27643  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
27644  __Pyx_GIVEREF(__pyx_t_1);
27645  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
27646  __pyx_t_5 = 0;
27647  __pyx_t_1 = 0;
27648  __pyx_r = __pyx_t_4;
27649  __pyx_t_4 = 0;
27650  goto __pyx_L0;
27651  }
27652 
27653  /* "(tree fragment)":1
27654  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
27655  * cdef tuple state
27656  * cdef object _dict
27657  */
27658 
27659  /* function exit code */
27660  __pyx_L1_error:;
27661  __Pyx_XDECREF(__pyx_t_1);
27662  __Pyx_XDECREF(__pyx_t_4);
27663  __Pyx_XDECREF(__pyx_t_5);
27664  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27665  __pyx_r = NULL;
27666  __pyx_L0:;
27667  __Pyx_XDECREF(__pyx_v_state);
27668  __Pyx_XDECREF(__pyx_v__dict);
27669  __Pyx_XGIVEREF(__pyx_r);
27670  __Pyx_RefNannyFinishContext();
27671  return __pyx_r;
27672 }
27673 
27674 /* "(tree fragment)":16
27675  * else:
27676  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
27677  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
27678  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
27679  */
27680 
27681 /* Python wrapper */
27682 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
27683 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
27684  PyObject *__pyx_r = 0;
27685  __Pyx_RefNannyDeclarations
27686  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
27687  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
27688 
27689  /* function exit code */
27690  __Pyx_RefNannyFinishContext();
27691  return __pyx_r;
27692 }
27693 
27694 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
27695  PyObject *__pyx_r = NULL;
27696  __Pyx_RefNannyDeclarations
27697  PyObject *__pyx_t_1 = NULL;
27698  int __pyx_lineno = 0;
27699  const char *__pyx_filename = NULL;
27700  int __pyx_clineno = 0;
27701  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
27702 
27703  /* "(tree fragment)":17
27704  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
27705  * def __setstate_cython__(self, __pyx_state):
27706  * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
27707  */
27708  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
27709  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
27710  __Pyx_GOTREF(__pyx_t_1);
27711  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
27712 
27713  /* "(tree fragment)":16
27714  * else:
27715  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
27716  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
27717  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
27718  */
27719 
27720  /* function exit code */
27721  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
27722  goto __pyx_L0;
27723  __pyx_L1_error:;
27724  __Pyx_XDECREF(__pyx_t_1);
27725  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27726  __pyx_r = NULL;
27727  __pyx_L0:;
27728  __Pyx_XGIVEREF(__pyx_r);
27729  __Pyx_RefNannyFinishContext();
27730  return __pyx_r;
27731 }
27732 
27733 /* "View.MemoryView":298
27734  *
27735  * @cname('__pyx_align_pointer')
27736  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
27737  * "Align pointer memory on a given boundary"
27738  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
27739  */
27740 
27741 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
27742  Py_intptr_t __pyx_v_aligned_p;
27743  size_t __pyx_v_offset;
27744  void *__pyx_r;
27745  int __pyx_t_1;
27746 
27747  /* "View.MemoryView":300
27748  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
27749  * "Align pointer memory on a given boundary"
27750  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
27751  * cdef size_t offset
27752  *
27753  */
27754  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
27755 
27756  /* "View.MemoryView":304
27757  *
27758  * with cython.cdivision(True):
27759  * offset = aligned_p % alignment # <<<<<<<<<<<<<<
27760  *
27761  * if offset > 0:
27762  */
27763  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
27764 
27765  /* "View.MemoryView":306
27766  * offset = aligned_p % alignment
27767  *
27768  * if offset > 0: # <<<<<<<<<<<<<<
27769  * aligned_p += alignment - offset
27770  *
27771  */
27772  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
27773  if (__pyx_t_1) {
27774 
27775  /* "View.MemoryView":307
27776  *
27777  * if offset > 0:
27778  * aligned_p += alignment - offset # <<<<<<<<<<<<<<
27779  *
27780  * return <void *> aligned_p
27781  */
27782  __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
27783 
27784  /* "View.MemoryView":306
27785  * offset = aligned_p % alignment
27786  *
27787  * if offset > 0: # <<<<<<<<<<<<<<
27788  * aligned_p += alignment - offset
27789  *
27790  */
27791  }
27792 
27793  /* "View.MemoryView":309
27794  * aligned_p += alignment - offset
27795  *
27796  * return <void *> aligned_p # <<<<<<<<<<<<<<
27797  *
27798  *
27799  */
27800  __pyx_r = ((void *)__pyx_v_aligned_p);
27801  goto __pyx_L0;
27802 
27803  /* "View.MemoryView":298
27804  *
27805  * @cname('__pyx_align_pointer')
27806  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
27807  * "Align pointer memory on a given boundary"
27808  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
27809  */
27810 
27811  /* function exit code */
27812  __pyx_L0:;
27813  return __pyx_r;
27814 }
27815 
27816 /* "View.MemoryView":345
27817  * cdef __Pyx_TypeInfo *typeinfo
27818  *
27819  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
27820  * self.obj = obj
27821  * self.flags = flags
27822  */
27823 
27824 /* Python wrapper */
27825 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
27826 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
27827  PyObject *__pyx_v_obj = 0;
27828  int __pyx_v_flags;
27829  int __pyx_v_dtype_is_object;
27830  int __pyx_lineno = 0;
27831  const char *__pyx_filename = NULL;
27832  int __pyx_clineno = 0;
27833  int __pyx_r;
27834  __Pyx_RefNannyDeclarations
27835  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
27836  {
27837  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
27838  PyObject* values[3] = {0,0,0};
27839  if (unlikely(__pyx_kwds)) {
27840  Py_ssize_t kw_args;
27841  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
27842  switch (pos_args) {
27843  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27844  CYTHON_FALLTHROUGH;
27845  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27846  CYTHON_FALLTHROUGH;
27847  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27848  CYTHON_FALLTHROUGH;
27849  case 0: break;
27850  default: goto __pyx_L5_argtuple_error;
27851  }
27852  kw_args = PyDict_Size(__pyx_kwds);
27853  switch (pos_args) {
27854  case 0:
27855  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
27856  else goto __pyx_L5_argtuple_error;
27857  CYTHON_FALLTHROUGH;
27858  case 1:
27859  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
27860  else {
27861  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
27862  }
27863  CYTHON_FALLTHROUGH;
27864  case 2:
27865  if (kw_args > 0) {
27866  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
27867  if (value) { values[2] = value; kw_args--; }
27868  }
27869  }
27870  if (unlikely(kw_args > 0)) {
27871  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
27872  }
27873  } else {
27874  switch (PyTuple_GET_SIZE(__pyx_args)) {
27875  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
27876  CYTHON_FALLTHROUGH;
27877  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
27878  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
27879  break;
27880  default: goto __pyx_L5_argtuple_error;
27881  }
27882  }
27883  __pyx_v_obj = values[0];
27884  __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
27885  if (values[2]) {
27886  __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
27887  } else {
27888  __pyx_v_dtype_is_object = ((int)0);
27889  }
27890  }
27891  goto __pyx_L4_argument_unpacking_done;
27892  __pyx_L5_argtuple_error:;
27893  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
27894  __pyx_L3_error:;
27895  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
27896  __Pyx_RefNannyFinishContext();
27897  return -1;
27898  __pyx_L4_argument_unpacking_done:;
27899  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
27900 
27901  /* function exit code */
27902  __Pyx_RefNannyFinishContext();
27903  return __pyx_r;
27904 }
27905 
27906 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
27907  int __pyx_r;
27908  __Pyx_RefNannyDeclarations
27909  int __pyx_t_1;
27910  int __pyx_t_2;
27911  int __pyx_t_3;
27912  int __pyx_t_4;
27913  int __pyx_lineno = 0;
27914  const char *__pyx_filename = NULL;
27915  int __pyx_clineno = 0;
27916  __Pyx_RefNannySetupContext("__cinit__", 0);
27917 
27918  /* "View.MemoryView":346
27919  *
27920  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
27921  * self.obj = obj # <<<<<<<<<<<<<<
27922  * self.flags = flags
27923  * if type(self) is memoryview or obj is not None:
27924  */
27925  __Pyx_INCREF(__pyx_v_obj);
27926  __Pyx_GIVEREF(__pyx_v_obj);
27927  __Pyx_GOTREF(__pyx_v_self->obj);
27928  __Pyx_DECREF(__pyx_v_self->obj);
27929  __pyx_v_self->obj = __pyx_v_obj;
27930 
27931  /* "View.MemoryView":347
27932  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
27933  * self.obj = obj
27934  * self.flags = flags # <<<<<<<<<<<<<<
27935  * if type(self) is memoryview or obj is not None:
27936  * __Pyx_GetBuffer(obj, &self.view, flags)
27937  */
27938  __pyx_v_self->flags = __pyx_v_flags;
27939 
27940  /* "View.MemoryView":348
27941  * self.obj = obj
27942  * self.flags = flags
27943  * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
27944  * __Pyx_GetBuffer(obj, &self.view, flags)
27945  * if <PyObject *> self.view.obj == NULL:
27946  */
27947  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
27948  __pyx_t_3 = (__pyx_t_2 != 0);
27949  if (!__pyx_t_3) {
27950  } else {
27951  __pyx_t_1 = __pyx_t_3;
27952  goto __pyx_L4_bool_binop_done;
27953  }
27954  __pyx_t_3 = (__pyx_v_obj != Py_None);
27955  __pyx_t_2 = (__pyx_t_3 != 0);
27956  __pyx_t_1 = __pyx_t_2;
27957  __pyx_L4_bool_binop_done:;
27958  if (__pyx_t_1) {
27959 
27960  /* "View.MemoryView":349
27961  * self.flags = flags
27962  * if type(self) is memoryview or obj is not None:
27963  * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
27964  * if <PyObject *> self.view.obj == NULL:
27965  * (<__pyx_buffer *> &self.view).obj = Py_None
27966  */
27967  __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
27968 
27969  /* "View.MemoryView":350
27970  * if type(self) is memoryview or obj is not None:
27971  * __Pyx_GetBuffer(obj, &self.view, flags)
27972  * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
27973  * (<__pyx_buffer *> &self.view).obj = Py_None
27974  * Py_INCREF(Py_None)
27975  */
27976  __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
27977  if (__pyx_t_1) {
27978 
27979  /* "View.MemoryView":351
27980  * __Pyx_GetBuffer(obj, &self.view, flags)
27981  * if <PyObject *> self.view.obj == NULL:
27982  * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
27983  * Py_INCREF(Py_None)
27984  *
27985  */
27986  ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
27987 
27988  /* "View.MemoryView":352
27989  * if <PyObject *> self.view.obj == NULL:
27990  * (<__pyx_buffer *> &self.view).obj = Py_None
27991  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
27992  *
27993  * global __pyx_memoryview_thread_locks_used
27994  */
27995  Py_INCREF(Py_None);
27996 
27997  /* "View.MemoryView":350
27998  * if type(self) is memoryview or obj is not None:
27999  * __Pyx_GetBuffer(obj, &self.view, flags)
28000  * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
28001  * (<__pyx_buffer *> &self.view).obj = Py_None
28002  * Py_INCREF(Py_None)
28003  */
28004  }
28005 
28006  /* "View.MemoryView":348
28007  * self.obj = obj
28008  * self.flags = flags
28009  * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
28010  * __Pyx_GetBuffer(obj, &self.view, flags)
28011  * if <PyObject *> self.view.obj == NULL:
28012  */
28013  }
28014 
28015  /* "View.MemoryView":355
28016  *
28017  * global __pyx_memoryview_thread_locks_used
28018  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
28019  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28020  * __pyx_memoryview_thread_locks_used += 1
28021  */
28022  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
28023  if (__pyx_t_1) {
28024 
28025  /* "View.MemoryView":356
28026  * global __pyx_memoryview_thread_locks_used
28027  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
28028  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
28029  * __pyx_memoryview_thread_locks_used += 1
28030  * if self.lock is NULL:
28031  */
28032  __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
28033 
28034  /* "View.MemoryView":357
28035  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
28036  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28037  * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
28038  * if self.lock is NULL:
28039  * self.lock = PyThread_allocate_lock()
28040  */
28041  __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
28042 
28043  /* "View.MemoryView":355
28044  *
28045  * global __pyx_memoryview_thread_locks_used
28046  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
28047  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28048  * __pyx_memoryview_thread_locks_used += 1
28049  */
28050  }
28051 
28052  /* "View.MemoryView":358
28053  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28054  * __pyx_memoryview_thread_locks_used += 1
28055  * if self.lock is NULL: # <<<<<<<<<<<<<<
28056  * self.lock = PyThread_allocate_lock()
28057  * if self.lock is NULL:
28058  */
28059  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
28060  if (__pyx_t_1) {
28061 
28062  /* "View.MemoryView":359
28063  * __pyx_memoryview_thread_locks_used += 1
28064  * if self.lock is NULL:
28065  * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
28066  * if self.lock is NULL:
28067  * raise MemoryError
28068  */
28069  __pyx_v_self->lock = PyThread_allocate_lock();
28070 
28071  /* "View.MemoryView":360
28072  * if self.lock is NULL:
28073  * self.lock = PyThread_allocate_lock()
28074  * if self.lock is NULL: # <<<<<<<<<<<<<<
28075  * raise MemoryError
28076  *
28077  */
28078  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
28079  if (unlikely(__pyx_t_1)) {
28080 
28081  /* "View.MemoryView":361
28082  * self.lock = PyThread_allocate_lock()
28083  * if self.lock is NULL:
28084  * raise MemoryError # <<<<<<<<<<<<<<
28085  *
28086  * if flags & PyBUF_FORMAT:
28087  */
28088  PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
28089 
28090  /* "View.MemoryView":360
28091  * if self.lock is NULL:
28092  * self.lock = PyThread_allocate_lock()
28093  * if self.lock is NULL: # <<<<<<<<<<<<<<
28094  * raise MemoryError
28095  *
28096  */
28097  }
28098 
28099  /* "View.MemoryView":358
28100  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
28101  * __pyx_memoryview_thread_locks_used += 1
28102  * if self.lock is NULL: # <<<<<<<<<<<<<<
28103  * self.lock = PyThread_allocate_lock()
28104  * if self.lock is NULL:
28105  */
28106  }
28107 
28108  /* "View.MemoryView":363
28109  * raise MemoryError
28110  *
28111  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
28112  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
28113  * else:
28114  */
28115  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
28116  if (__pyx_t_1) {
28117 
28118  /* "View.MemoryView":364
28119  *
28120  * if flags & PyBUF_FORMAT:
28121  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
28122  * else:
28123  * self.dtype_is_object = dtype_is_object
28124  */
28125  __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
28126  if (__pyx_t_2) {
28127  } else {
28128  __pyx_t_1 = __pyx_t_2;
28129  goto __pyx_L11_bool_binop_done;
28130  }
28131  __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
28132  __pyx_t_1 = __pyx_t_2;
28133  __pyx_L11_bool_binop_done:;
28134  __pyx_v_self->dtype_is_object = __pyx_t_1;
28135 
28136  /* "View.MemoryView":363
28137  * raise MemoryError
28138  *
28139  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
28140  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
28141  * else:
28142  */
28143  goto __pyx_L10;
28144  }
28145 
28146  /* "View.MemoryView":366
28147  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
28148  * else:
28149  * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
28150  *
28151  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
28152  */
28153  /*else*/ {
28154  __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
28155  }
28156  __pyx_L10:;
28157 
28158  /* "View.MemoryView":368
28159  * self.dtype_is_object = dtype_is_object
28160  *
28161  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
28162  * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
28163  * self.typeinfo = NULL
28164  */
28165  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
28166 
28167  /* "View.MemoryView":370
28168  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
28169  * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
28170  * self.typeinfo = NULL # <<<<<<<<<<<<<<
28171  *
28172  * def __dealloc__(memoryview self):
28173  */
28174  __pyx_v_self->typeinfo = NULL;
28175 
28176  /* "View.MemoryView":345
28177  * cdef __Pyx_TypeInfo *typeinfo
28178  *
28179  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
28180  * self.obj = obj
28181  * self.flags = flags
28182  */
28183 
28184  /* function exit code */
28185  __pyx_r = 0;
28186  goto __pyx_L0;
28187  __pyx_L1_error:;
28188  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28189  __pyx_r = -1;
28190  __pyx_L0:;
28191  __Pyx_RefNannyFinishContext();
28192  return __pyx_r;
28193 }
28194 
28195 /* "View.MemoryView":372
28196  * self.typeinfo = NULL
28197  *
28198  * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
28199  * if self.obj is not None:
28200  * __Pyx_ReleaseBuffer(&self.view)
28201  */
28202 
28203 /* Python wrapper */
28204 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
28205 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
28206  __Pyx_RefNannyDeclarations
28207  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
28208  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
28209 
28210  /* function exit code */
28211  __Pyx_RefNannyFinishContext();
28212 }
28213 
28214 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
28215  int __pyx_v_i;
28216  __Pyx_RefNannyDeclarations
28217  int __pyx_t_1;
28218  int __pyx_t_2;
28219  int __pyx_t_3;
28220  int __pyx_t_4;
28221  int __pyx_t_5;
28222  PyThread_type_lock __pyx_t_6;
28223  PyThread_type_lock __pyx_t_7;
28224  __Pyx_RefNannySetupContext("__dealloc__", 0);
28225 
28226  /* "View.MemoryView":373
28227  *
28228  * def __dealloc__(memoryview self):
28229  * if self.obj is not None: # <<<<<<<<<<<<<<
28230  * __Pyx_ReleaseBuffer(&self.view)
28231  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
28232  */
28233  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
28234  __pyx_t_2 = (__pyx_t_1 != 0);
28235  if (__pyx_t_2) {
28236 
28237  /* "View.MemoryView":374
28238  * def __dealloc__(memoryview self):
28239  * if self.obj is not None:
28240  * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
28241  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
28242  *
28243  */
28244  __Pyx_ReleaseBuffer((&__pyx_v_self->view));
28245 
28246  /* "View.MemoryView":373
28247  *
28248  * def __dealloc__(memoryview self):
28249  * if self.obj is not None: # <<<<<<<<<<<<<<
28250  * __Pyx_ReleaseBuffer(&self.view)
28251  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
28252  */
28253  goto __pyx_L3;
28254  }
28255 
28256  /* "View.MemoryView":375
28257  * if self.obj is not None:
28258  * __Pyx_ReleaseBuffer(&self.view)
28259  * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
28260  *
28261  * (<__pyx_buffer *> &self.view).obj = NULL
28262  */
28263  __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
28264  if (__pyx_t_2) {
28265 
28266  /* "View.MemoryView":377
28267  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
28268  *
28269  * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
28270  * Py_DECREF(Py_None)
28271  *
28272  */
28273  ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
28274 
28275  /* "View.MemoryView":378
28276  *
28277  * (<__pyx_buffer *> &self.view).obj = NULL
28278  * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
28279  *
28280  * cdef int i
28281  */
28282  Py_DECREF(Py_None);
28283 
28284  /* "View.MemoryView":375
28285  * if self.obj is not None:
28286  * __Pyx_ReleaseBuffer(&self.view)
28287  * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
28288  *
28289  * (<__pyx_buffer *> &self.view).obj = NULL
28290  */
28291  }
28292  __pyx_L3:;
28293 
28294  /* "View.MemoryView":382
28295  * cdef int i
28296  * global __pyx_memoryview_thread_locks_used
28297  * if self.lock != NULL: # <<<<<<<<<<<<<<
28298  * for i in range(__pyx_memoryview_thread_locks_used):
28299  * if __pyx_memoryview_thread_locks[i] is self.lock:
28300  */
28301  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
28302  if (__pyx_t_2) {
28303 
28304  /* "View.MemoryView":383
28305  * global __pyx_memoryview_thread_locks_used
28306  * if self.lock != NULL:
28307  * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
28308  * if __pyx_memoryview_thread_locks[i] is self.lock:
28309  * __pyx_memoryview_thread_locks_used -= 1
28310  */
28311  __pyx_t_3 = __pyx_memoryview_thread_locks_used;
28312  __pyx_t_4 = __pyx_t_3;
28313  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
28314  __pyx_v_i = __pyx_t_5;
28315 
28316  /* "View.MemoryView":384
28317  * if self.lock != NULL:
28318  * for i in range(__pyx_memoryview_thread_locks_used):
28319  * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
28320  * __pyx_memoryview_thread_locks_used -= 1
28321  * if i != __pyx_memoryview_thread_locks_used:
28322  */
28323  __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
28324  if (__pyx_t_2) {
28325 
28326  /* "View.MemoryView":385
28327  * for i in range(__pyx_memoryview_thread_locks_used):
28328  * if __pyx_memoryview_thread_locks[i] is self.lock:
28329  * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
28330  * if i != __pyx_memoryview_thread_locks_used:
28331  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28332  */
28333  __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
28334 
28335  /* "View.MemoryView":386
28336  * if __pyx_memoryview_thread_locks[i] is self.lock:
28337  * __pyx_memoryview_thread_locks_used -= 1
28338  * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
28339  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28340  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28341  */
28342  __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
28343  if (__pyx_t_2) {
28344 
28345  /* "View.MemoryView":388
28346  * if i != __pyx_memoryview_thread_locks_used:
28347  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28348  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
28349  * break
28350  * else:
28351  */
28352  __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
28353  __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
28354 
28355  /* "View.MemoryView":387
28356  * __pyx_memoryview_thread_locks_used -= 1
28357  * if i != __pyx_memoryview_thread_locks_used:
28358  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
28359  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28360  * break
28361  */
28362  (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
28363  (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
28364 
28365  /* "View.MemoryView":386
28366  * if __pyx_memoryview_thread_locks[i] is self.lock:
28367  * __pyx_memoryview_thread_locks_used -= 1
28368  * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
28369  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28370  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28371  */
28372  }
28373 
28374  /* "View.MemoryView":389
28375  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
28376  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
28377  * break # <<<<<<<<<<<<<<
28378  * else:
28379  * PyThread_free_lock(self.lock)
28380  */
28381  goto __pyx_L6_break;
28382 
28383  /* "View.MemoryView":384
28384  * if self.lock != NULL:
28385  * for i in range(__pyx_memoryview_thread_locks_used):
28386  * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
28387  * __pyx_memoryview_thread_locks_used -= 1
28388  * if i != __pyx_memoryview_thread_locks_used:
28389  */
28390  }
28391  }
28392  /*else*/ {
28393 
28394  /* "View.MemoryView":391
28395  * break
28396  * else:
28397  * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
28398  *
28399  * cdef char *get_item_pointer(memoryview self, object index) except NULL:
28400  */
28401  PyThread_free_lock(__pyx_v_self->lock);
28402  }
28403  __pyx_L6_break:;
28404 
28405  /* "View.MemoryView":382
28406  * cdef int i
28407  * global __pyx_memoryview_thread_locks_used
28408  * if self.lock != NULL: # <<<<<<<<<<<<<<
28409  * for i in range(__pyx_memoryview_thread_locks_used):
28410  * if __pyx_memoryview_thread_locks[i] is self.lock:
28411  */
28412  }
28413 
28414  /* "View.MemoryView":372
28415  * self.typeinfo = NULL
28416  *
28417  * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
28418  * if self.obj is not None:
28419  * __Pyx_ReleaseBuffer(&self.view)
28420  */
28421 
28422  /* function exit code */
28423  __Pyx_RefNannyFinishContext();
28424 }
28425 
28426 /* "View.MemoryView":393
28427  * PyThread_free_lock(self.lock)
28428  *
28429  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
28430  * cdef Py_ssize_t dim
28431  * cdef char *itemp = <char *> self.view.buf
28432  */
28433 
28434 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
28435  Py_ssize_t __pyx_v_dim;
28436  char *__pyx_v_itemp;
28437  PyObject *__pyx_v_idx = NULL;
28438  char *__pyx_r;
28439  __Pyx_RefNannyDeclarations
28440  Py_ssize_t __pyx_t_1;
28441  PyObject *__pyx_t_2 = NULL;
28442  Py_ssize_t __pyx_t_3;
28443  PyObject *(*__pyx_t_4)(PyObject *);
28444  PyObject *__pyx_t_5 = NULL;
28445  Py_ssize_t __pyx_t_6;
28446  char *__pyx_t_7;
28447  int __pyx_lineno = 0;
28448  const char *__pyx_filename = NULL;
28449  int __pyx_clineno = 0;
28450  __Pyx_RefNannySetupContext("get_item_pointer", 0);
28451 
28452  /* "View.MemoryView":395
28453  * cdef char *get_item_pointer(memoryview self, object index) except NULL:
28454  * cdef Py_ssize_t dim
28455  * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
28456  *
28457  * for dim, idx in enumerate(index):
28458  */
28459  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
28460 
28461  /* "View.MemoryView":397
28462  * cdef char *itemp = <char *> self.view.buf
28463  *
28464  * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
28465  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
28466  *
28467  */
28468  __pyx_t_1 = 0;
28469  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
28470  __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
28471  __pyx_t_4 = NULL;
28472  } else {
28473  __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
28474  __Pyx_GOTREF(__pyx_t_2);
28475  __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
28476  }
28477  for (;;) {
28478  if (likely(!__pyx_t_4)) {
28479  if (likely(PyList_CheckExact(__pyx_t_2))) {
28480  if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
28481  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
28482  __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
28483  #else
28484  __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
28485  __Pyx_GOTREF(__pyx_t_5);
28486  #endif
28487  } else {
28488  if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
28489  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
28490  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error)
28491  #else
28492  __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
28493  __Pyx_GOTREF(__pyx_t_5);
28494  #endif
28495  }
28496  } else {
28497  __pyx_t_5 = __pyx_t_4(__pyx_t_2);
28498  if (unlikely(!__pyx_t_5)) {
28499  PyObject* exc_type = PyErr_Occurred();
28500  if (exc_type) {
28501  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
28502  else __PYX_ERR(2, 397, __pyx_L1_error)
28503  }
28504  break;
28505  }
28506  __Pyx_GOTREF(__pyx_t_5);
28507  }
28508  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
28509  __pyx_t_5 = 0;
28510  __pyx_v_dim = __pyx_t_1;
28511  __pyx_t_1 = (__pyx_t_1 + 1);
28512 
28513  /* "View.MemoryView":398
28514  *
28515  * for dim, idx in enumerate(index):
28516  * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
28517  *
28518  * return itemp
28519  */
28520  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
28521  __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error)
28522  __pyx_v_itemp = __pyx_t_7;
28523 
28524  /* "View.MemoryView":397
28525  * cdef char *itemp = <char *> self.view.buf
28526  *
28527  * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
28528  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
28529  *
28530  */
28531  }
28532  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28533 
28534  /* "View.MemoryView":400
28535  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
28536  *
28537  * return itemp # <<<<<<<<<<<<<<
28538  *
28539  *
28540  */
28541  __pyx_r = __pyx_v_itemp;
28542  goto __pyx_L0;
28543 
28544  /* "View.MemoryView":393
28545  * PyThread_free_lock(self.lock)
28546  *
28547  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
28548  * cdef Py_ssize_t dim
28549  * cdef char *itemp = <char *> self.view.buf
28550  */
28551 
28552  /* function exit code */
28553  __pyx_L1_error:;
28554  __Pyx_XDECREF(__pyx_t_2);
28555  __Pyx_XDECREF(__pyx_t_5);
28556  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
28557  __pyx_r = NULL;
28558  __pyx_L0:;
28559  __Pyx_XDECREF(__pyx_v_idx);
28560  __Pyx_RefNannyFinishContext();
28561  return __pyx_r;
28562 }
28563 
28564 /* "View.MemoryView":403
28565  *
28566  *
28567  * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
28568  * if index is Ellipsis:
28569  * return self
28570  */
28571 
28572 /* Python wrapper */
28573 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
28574 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
28575  PyObject *__pyx_r = 0;
28576  __Pyx_RefNannyDeclarations
28577  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
28578  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
28579 
28580  /* function exit code */
28581  __Pyx_RefNannyFinishContext();
28582  return __pyx_r;
28583 }
28584 
28585 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
28586  PyObject *__pyx_v_have_slices = NULL;
28587  PyObject *__pyx_v_indices = NULL;
28588  char *__pyx_v_itemp;
28589  PyObject *__pyx_r = NULL;
28590  __Pyx_RefNannyDeclarations
28591  int __pyx_t_1;
28592  int __pyx_t_2;
28593  PyObject *__pyx_t_3 = NULL;
28594  PyObject *__pyx_t_4 = NULL;
28595  PyObject *__pyx_t_5 = NULL;
28596  char *__pyx_t_6;
28597  int __pyx_lineno = 0;
28598  const char *__pyx_filename = NULL;
28599  int __pyx_clineno = 0;
28600  __Pyx_RefNannySetupContext("__getitem__", 0);
28601 
28602  /* "View.MemoryView":404
28603  *
28604  * def __getitem__(memoryview self, object index):
28605  * if index is Ellipsis: # <<<<<<<<<<<<<<
28606  * return self
28607  *
28608  */
28609  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
28610  __pyx_t_2 = (__pyx_t_1 != 0);
28611  if (__pyx_t_2) {
28612 
28613  /* "View.MemoryView":405
28614  * def __getitem__(memoryview self, object index):
28615  * if index is Ellipsis:
28616  * return self # <<<<<<<<<<<<<<
28617  *
28618  * have_slices, indices = _unellipsify(index, self.view.ndim)
28619  */
28620  __Pyx_XDECREF(__pyx_r);
28621  __Pyx_INCREF(((PyObject *)__pyx_v_self));
28622  __pyx_r = ((PyObject *)__pyx_v_self);
28623  goto __pyx_L0;
28624 
28625  /* "View.MemoryView":404
28626  *
28627  * def __getitem__(memoryview self, object index):
28628  * if index is Ellipsis: # <<<<<<<<<<<<<<
28629  * return self
28630  *
28631  */
28632  }
28633 
28634  /* "View.MemoryView":407
28635  * return self
28636  *
28637  * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
28638  *
28639  * cdef char *itemp
28640  */
28641  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
28642  __Pyx_GOTREF(__pyx_t_3);
28643  if (likely(__pyx_t_3 != Py_None)) {
28644  PyObject* sequence = __pyx_t_3;
28645  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
28646  if (unlikely(size != 2)) {
28647  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
28648  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
28649  __PYX_ERR(2, 407, __pyx_L1_error)
28650  }
28651  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
28652  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
28653  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
28654  __Pyx_INCREF(__pyx_t_4);
28655  __Pyx_INCREF(__pyx_t_5);
28656  #else
28657  __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
28658  __Pyx_GOTREF(__pyx_t_4);
28659  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
28660  __Pyx_GOTREF(__pyx_t_5);
28661  #endif
28662  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
28663  } else {
28664  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
28665  }
28666  __pyx_v_have_slices = __pyx_t_4;
28667  __pyx_t_4 = 0;
28668  __pyx_v_indices = __pyx_t_5;
28669  __pyx_t_5 = 0;
28670 
28671  /* "View.MemoryView":410
28672  *
28673  * cdef char *itemp
28674  * if have_slices: # <<<<<<<<<<<<<<
28675  * return memview_slice(self, indices)
28676  * else:
28677  */
28678  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
28679  if (__pyx_t_2) {
28680 
28681  /* "View.MemoryView":411
28682  * cdef char *itemp
28683  * if have_slices:
28684  * return memview_slice(self, indices) # <<<<<<<<<<<<<<
28685  * else:
28686  * itemp = self.get_item_pointer(indices)
28687  */
28688  __Pyx_XDECREF(__pyx_r);
28689  __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
28690  __Pyx_GOTREF(__pyx_t_3);
28691  __pyx_r = __pyx_t_3;
28692  __pyx_t_3 = 0;
28693  goto __pyx_L0;
28694 
28695  /* "View.MemoryView":410
28696  *
28697  * cdef char *itemp
28698  * if have_slices: # <<<<<<<<<<<<<<
28699  * return memview_slice(self, indices)
28700  * else:
28701  */
28702  }
28703 
28704  /* "View.MemoryView":413
28705  * return memview_slice(self, indices)
28706  * else:
28707  * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
28708  * return self.convert_item_to_object(itemp)
28709  *
28710  */
28711  /*else*/ {
28712  __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error)
28713  __pyx_v_itemp = __pyx_t_6;
28714 
28715  /* "View.MemoryView":414
28716  * else:
28717  * itemp = self.get_item_pointer(indices)
28718  * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
28719  *
28720  * def __setitem__(memoryview self, object index, object value):
28721  */
28722  __Pyx_XDECREF(__pyx_r);
28723  __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error)
28724  __Pyx_GOTREF(__pyx_t_3);
28725  __pyx_r = __pyx_t_3;
28726  __pyx_t_3 = 0;
28727  goto __pyx_L0;
28728  }
28729 
28730  /* "View.MemoryView":403
28731  *
28732  *
28733  * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
28734  * if index is Ellipsis:
28735  * return self
28736  */
28737 
28738  /* function exit code */
28739  __pyx_L1_error:;
28740  __Pyx_XDECREF(__pyx_t_3);
28741  __Pyx_XDECREF(__pyx_t_4);
28742  __Pyx_XDECREF(__pyx_t_5);
28743  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28744  __pyx_r = NULL;
28745  __pyx_L0:;
28746  __Pyx_XDECREF(__pyx_v_have_slices);
28747  __Pyx_XDECREF(__pyx_v_indices);
28748  __Pyx_XGIVEREF(__pyx_r);
28749  __Pyx_RefNannyFinishContext();
28750  return __pyx_r;
28751 }
28752 
28753 /* "View.MemoryView":416
28754  * return self.convert_item_to_object(itemp)
28755  *
28756  * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
28757  * if self.view.readonly:
28758  * raise TypeError("Cannot assign to read-only memoryview")
28759  */
28760 
28761 /* Python wrapper */
28762 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
28763 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
28764  int __pyx_r;
28765  __Pyx_RefNannyDeclarations
28766  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
28767  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
28768 
28769  /* function exit code */
28770  __Pyx_RefNannyFinishContext();
28771  return __pyx_r;
28772 }
28773 
28774 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
28775  PyObject *__pyx_v_have_slices = NULL;
28776  PyObject *__pyx_v_obj = NULL;
28777  int __pyx_r;
28778  __Pyx_RefNannyDeclarations
28779  int __pyx_t_1;
28780  PyObject *__pyx_t_2 = NULL;
28781  PyObject *__pyx_t_3 = NULL;
28782  PyObject *__pyx_t_4 = NULL;
28783  int __pyx_lineno = 0;
28784  const char *__pyx_filename = NULL;
28785  int __pyx_clineno = 0;
28786  __Pyx_RefNannySetupContext("__setitem__", 0);
28787  __Pyx_INCREF(__pyx_v_index);
28788 
28789  /* "View.MemoryView":417
28790  *
28791  * def __setitem__(memoryview self, object index, object value):
28792  * if self.view.readonly: # <<<<<<<<<<<<<<
28793  * raise TypeError("Cannot assign to read-only memoryview")
28794  *
28795  */
28796  __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
28797  if (unlikely(__pyx_t_1)) {
28798 
28799  /* "View.MemoryView":418
28800  * def __setitem__(memoryview self, object index, object value):
28801  * if self.view.readonly:
28802  * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
28803  *
28804  * have_slices, index = _unellipsify(index, self.view.ndim)
28805  */
28806  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
28807  __Pyx_GOTREF(__pyx_t_2);
28808  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
28809  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28810  __PYX_ERR(2, 418, __pyx_L1_error)
28811 
28812  /* "View.MemoryView":417
28813  *
28814  * def __setitem__(memoryview self, object index, object value):
28815  * if self.view.readonly: # <<<<<<<<<<<<<<
28816  * raise TypeError("Cannot assign to read-only memoryview")
28817  *
28818  */
28819  }
28820 
28821  /* "View.MemoryView":420
28822  * raise TypeError("Cannot assign to read-only memoryview")
28823  *
28824  * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
28825  *
28826  * if have_slices:
28827  */
28828  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
28829  __Pyx_GOTREF(__pyx_t_2);
28830  if (likely(__pyx_t_2 != Py_None)) {
28831  PyObject* sequence = __pyx_t_2;
28832  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
28833  if (unlikely(size != 2)) {
28834  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
28835  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
28836  __PYX_ERR(2, 420, __pyx_L1_error)
28837  }
28838  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
28839  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
28840  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
28841  __Pyx_INCREF(__pyx_t_3);
28842  __Pyx_INCREF(__pyx_t_4);
28843  #else
28844  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
28845  __Pyx_GOTREF(__pyx_t_3);
28846  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
28847  __Pyx_GOTREF(__pyx_t_4);
28848  #endif
28849  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28850  } else {
28851  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
28852  }
28853  __pyx_v_have_slices = __pyx_t_3;
28854  __pyx_t_3 = 0;
28855  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
28856  __pyx_t_4 = 0;
28857 
28858  /* "View.MemoryView":422
28859  * have_slices, index = _unellipsify(index, self.view.ndim)
28860  *
28861  * if have_slices: # <<<<<<<<<<<<<<
28862  * obj = self.is_slice(value)
28863  * if obj:
28864  */
28865  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
28866  if (__pyx_t_1) {
28867 
28868  /* "View.MemoryView":423
28869  *
28870  * if have_slices:
28871  * obj = self.is_slice(value) # <<<<<<<<<<<<<<
28872  * if obj:
28873  * self.setitem_slice_assignment(self[index], obj)
28874  */
28875  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error)
28876  __Pyx_GOTREF(__pyx_t_2);
28877  __pyx_v_obj = __pyx_t_2;
28878  __pyx_t_2 = 0;
28879 
28880  /* "View.MemoryView":424
28881  * if have_slices:
28882  * obj = self.is_slice(value)
28883  * if obj: # <<<<<<<<<<<<<<
28884  * self.setitem_slice_assignment(self[index], obj)
28885  * else:
28886  */
28887  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
28888  if (__pyx_t_1) {
28889 
28890  /* "View.MemoryView":425
28891  * obj = self.is_slice(value)
28892  * if obj:
28893  * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
28894  * else:
28895  * self.setitem_slice_assign_scalar(self[index], value)
28896  */
28897  __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
28898  __Pyx_GOTREF(__pyx_t_2);
28899  __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error)
28900  __Pyx_GOTREF(__pyx_t_4);
28901  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28902  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28903 
28904  /* "View.MemoryView":424
28905  * if have_slices:
28906  * obj = self.is_slice(value)
28907  * if obj: # <<<<<<<<<<<<<<
28908  * self.setitem_slice_assignment(self[index], obj)
28909  * else:
28910  */
28911  goto __pyx_L5;
28912  }
28913 
28914  /* "View.MemoryView":427
28915  * self.setitem_slice_assignment(self[index], obj)
28916  * else:
28917  * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
28918  * else:
28919  * self.setitem_indexed(index, value)
28920  */
28921  /*else*/ {
28922  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
28923  __Pyx_GOTREF(__pyx_t_4);
28924  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
28925  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
28926  __Pyx_GOTREF(__pyx_t_2);
28927  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
28928  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28929  }
28930  __pyx_L5:;
28931 
28932  /* "View.MemoryView":422
28933  * have_slices, index = _unellipsify(index, self.view.ndim)
28934  *
28935  * if have_slices: # <<<<<<<<<<<<<<
28936  * obj = self.is_slice(value)
28937  * if obj:
28938  */
28939  goto __pyx_L4;
28940  }
28941 
28942  /* "View.MemoryView":429
28943  * self.setitem_slice_assign_scalar(self[index], value)
28944  * else:
28945  * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
28946  *
28947  * cdef is_slice(self, obj):
28948  */
28949  /*else*/ {
28950  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
28951  __Pyx_GOTREF(__pyx_t_2);
28952  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
28953  }
28954  __pyx_L4:;
28955 
28956  /* "View.MemoryView":416
28957  * return self.convert_item_to_object(itemp)
28958  *
28959  * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
28960  * if self.view.readonly:
28961  * raise TypeError("Cannot assign to read-only memoryview")
28962  */
28963 
28964  /* function exit code */
28965  __pyx_r = 0;
28966  goto __pyx_L0;
28967  __pyx_L1_error:;
28968  __Pyx_XDECREF(__pyx_t_2);
28969  __Pyx_XDECREF(__pyx_t_3);
28970  __Pyx_XDECREF(__pyx_t_4);
28971  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
28972  __pyx_r = -1;
28973  __pyx_L0:;
28974  __Pyx_XDECREF(__pyx_v_have_slices);
28975  __Pyx_XDECREF(__pyx_v_obj);
28976  __Pyx_XDECREF(__pyx_v_index);
28977  __Pyx_RefNannyFinishContext();
28978  return __pyx_r;
28979 }
28980 
28981 /* "View.MemoryView":431
28982  * self.setitem_indexed(index, value)
28983  *
28984  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
28985  * if not isinstance(obj, memoryview):
28986  * try:
28987  */
28988 
28989 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
28990  PyObject *__pyx_r = NULL;
28991  __Pyx_RefNannyDeclarations
28992  int __pyx_t_1;
28993  int __pyx_t_2;
28994  PyObject *__pyx_t_3 = NULL;
28995  PyObject *__pyx_t_4 = NULL;
28996  PyObject *__pyx_t_5 = NULL;
28997  PyObject *__pyx_t_6 = NULL;
28998  PyObject *__pyx_t_7 = NULL;
28999  PyObject *__pyx_t_8 = NULL;
29000  int __pyx_t_9;
29001  int __pyx_lineno = 0;
29002  const char *__pyx_filename = NULL;
29003  int __pyx_clineno = 0;
29004  __Pyx_RefNannySetupContext("is_slice", 0);
29005  __Pyx_INCREF(__pyx_v_obj);
29006 
29007  /* "View.MemoryView":432
29008  *
29009  * cdef is_slice(self, obj):
29010  * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
29011  * try:
29012  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29013  */
29014  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
29015  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
29016  if (__pyx_t_2) {
29017 
29018  /* "View.MemoryView":433
29019  * cdef is_slice(self, obj):
29020  * if not isinstance(obj, memoryview):
29021  * try: # <<<<<<<<<<<<<<
29022  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29023  * self.dtype_is_object)
29024  */
29025  {
29026  __Pyx_PyThreadState_declare
29027  __Pyx_PyThreadState_assign
29028  __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
29029  __Pyx_XGOTREF(__pyx_t_3);
29030  __Pyx_XGOTREF(__pyx_t_4);
29031  __Pyx_XGOTREF(__pyx_t_5);
29032  /*try:*/ {
29033 
29034  /* "View.MemoryView":434
29035  * if not isinstance(obj, memoryview):
29036  * try:
29037  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
29038  * self.dtype_is_object)
29039  * except TypeError:
29040  */
29041  __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
29042  __Pyx_GOTREF(__pyx_t_6);
29043 
29044  /* "View.MemoryView":435
29045  * try:
29046  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29047  * self.dtype_is_object) # <<<<<<<<<<<<<<
29048  * except TypeError:
29049  * return None
29050  */
29051  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
29052  __Pyx_GOTREF(__pyx_t_7);
29053 
29054  /* "View.MemoryView":434
29055  * if not isinstance(obj, memoryview):
29056  * try:
29057  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
29058  * self.dtype_is_object)
29059  * except TypeError:
29060  */
29061  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
29062  __Pyx_GOTREF(__pyx_t_8);
29063  __Pyx_INCREF(__pyx_v_obj);
29064  __Pyx_GIVEREF(__pyx_v_obj);
29065  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
29066  __Pyx_GIVEREF(__pyx_t_6);
29067  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
29068  __Pyx_GIVEREF(__pyx_t_7);
29069  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
29070  __pyx_t_6 = 0;
29071  __pyx_t_7 = 0;
29072  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
29073  __Pyx_GOTREF(__pyx_t_7);
29074  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29075  __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
29076  __pyx_t_7 = 0;
29077 
29078  /* "View.MemoryView":433
29079  * cdef is_slice(self, obj):
29080  * if not isinstance(obj, memoryview):
29081  * try: # <<<<<<<<<<<<<<
29082  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29083  * self.dtype_is_object)
29084  */
29085  }
29086  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
29087  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
29088  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29089  goto __pyx_L9_try_end;
29090  __pyx_L4_error:;
29091  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
29092  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
29093  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
29094 
29095  /* "View.MemoryView":436
29096  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29097  * self.dtype_is_object)
29098  * except TypeError: # <<<<<<<<<<<<<<
29099  * return None
29100  *
29101  */
29102  __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
29103  if (__pyx_t_9) {
29104  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
29105  if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
29106  __Pyx_GOTREF(__pyx_t_7);
29107  __Pyx_GOTREF(__pyx_t_8);
29108  __Pyx_GOTREF(__pyx_t_6);
29109 
29110  /* "View.MemoryView":437
29111  * self.dtype_is_object)
29112  * except TypeError:
29113  * return None # <<<<<<<<<<<<<<
29114  *
29115  * return obj
29116  */
29117  __Pyx_XDECREF(__pyx_r);
29118  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29119  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29120  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
29121  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
29122  goto __pyx_L7_except_return;
29123  }
29124  goto __pyx_L6_except_error;
29125  __pyx_L6_except_error:;
29126 
29127  /* "View.MemoryView":433
29128  * cdef is_slice(self, obj):
29129  * if not isinstance(obj, memoryview):
29130  * try: # <<<<<<<<<<<<<<
29131  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29132  * self.dtype_is_object)
29133  */
29134  __Pyx_XGIVEREF(__pyx_t_3);
29135  __Pyx_XGIVEREF(__pyx_t_4);
29136  __Pyx_XGIVEREF(__pyx_t_5);
29137  __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
29138  goto __pyx_L1_error;
29139  __pyx_L7_except_return:;
29140  __Pyx_XGIVEREF(__pyx_t_3);
29141  __Pyx_XGIVEREF(__pyx_t_4);
29142  __Pyx_XGIVEREF(__pyx_t_5);
29143  __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
29144  goto __pyx_L0;
29145  __pyx_L9_try_end:;
29146  }
29147 
29148  /* "View.MemoryView":432
29149  *
29150  * cdef is_slice(self, obj):
29151  * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
29152  * try:
29153  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
29154  */
29155  }
29156 
29157  /* "View.MemoryView":439
29158  * return None
29159  *
29160  * return obj # <<<<<<<<<<<<<<
29161  *
29162  * cdef setitem_slice_assignment(self, dst, src):
29163  */
29164  __Pyx_XDECREF(__pyx_r);
29165  __Pyx_INCREF(__pyx_v_obj);
29166  __pyx_r = __pyx_v_obj;
29167  goto __pyx_L0;
29168 
29169  /* "View.MemoryView":431
29170  * self.setitem_indexed(index, value)
29171  *
29172  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
29173  * if not isinstance(obj, memoryview):
29174  * try:
29175  */
29176 
29177  /* function exit code */
29178  __pyx_L1_error:;
29179  __Pyx_XDECREF(__pyx_t_6);
29180  __Pyx_XDECREF(__pyx_t_7);
29181  __Pyx_XDECREF(__pyx_t_8);
29182  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
29183  __pyx_r = 0;
29184  __pyx_L0:;
29185  __Pyx_XDECREF(__pyx_v_obj);
29186  __Pyx_XGIVEREF(__pyx_r);
29187  __Pyx_RefNannyFinishContext();
29188  return __pyx_r;
29189 }
29190 
29191 /* "View.MemoryView":441
29192  * return obj
29193  *
29194  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
29195  * cdef __Pyx_memviewslice dst_slice
29196  * cdef __Pyx_memviewslice src_slice
29197  */
29198 
29199 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
29200  __Pyx_memviewslice __pyx_v_dst_slice;
29201  __Pyx_memviewslice __pyx_v_src_slice;
29202  PyObject *__pyx_r = NULL;
29203  __Pyx_RefNannyDeclarations
29204  __Pyx_memviewslice *__pyx_t_1;
29205  __Pyx_memviewslice *__pyx_t_2;
29206  PyObject *__pyx_t_3 = NULL;
29207  int __pyx_t_4;
29208  int __pyx_t_5;
29209  int __pyx_t_6;
29210  int __pyx_lineno = 0;
29211  const char *__pyx_filename = NULL;
29212  int __pyx_clineno = 0;
29213  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
29214 
29215  /* "View.MemoryView":445
29216  * cdef __Pyx_memviewslice src_slice
29217  *
29218  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
29219  * get_slice_from_memview(dst, &dst_slice)[0],
29220  * src.ndim, dst.ndim, self.dtype_is_object)
29221  */
29222  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
29223  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 445, __pyx_L1_error)
29224 
29225  /* "View.MemoryView":446
29226  *
29227  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
29228  * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
29229  * src.ndim, dst.ndim, self.dtype_is_object)
29230  *
29231  */
29232  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
29233  __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 446, __pyx_L1_error)
29234 
29235  /* "View.MemoryView":447
29236  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
29237  * get_slice_from_memview(dst, &dst_slice)[0],
29238  * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
29239  *
29240  * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
29241  */
29242  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
29243  __Pyx_GOTREF(__pyx_t_3);
29244  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
29245  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29246  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
29247  __Pyx_GOTREF(__pyx_t_3);
29248  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
29249  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29250 
29251  /* "View.MemoryView":445
29252  * cdef __Pyx_memviewslice src_slice
29253  *
29254  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
29255  * get_slice_from_memview(dst, &dst_slice)[0],
29256  * src.ndim, dst.ndim, self.dtype_is_object)
29257  */
29258  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error)
29259 
29260  /* "View.MemoryView":441
29261  * return obj
29262  *
29263  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
29264  * cdef __Pyx_memviewslice dst_slice
29265  * cdef __Pyx_memviewslice src_slice
29266  */
29267 
29268  /* function exit code */
29269  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29270  goto __pyx_L0;
29271  __pyx_L1_error:;
29272  __Pyx_XDECREF(__pyx_t_3);
29273  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
29274  __pyx_r = 0;
29275  __pyx_L0:;
29276  __Pyx_XGIVEREF(__pyx_r);
29277  __Pyx_RefNannyFinishContext();
29278  return __pyx_r;
29279 }
29280 
29281 /* "View.MemoryView":449
29282  * src.ndim, dst.ndim, self.dtype_is_object)
29283  *
29284  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
29285  * cdef int array[128]
29286  * cdef void *tmp = NULL
29287  */
29288 
29289 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
29290  int __pyx_v_array[0x80];
29291  void *__pyx_v_tmp;
29292  void *__pyx_v_item;
29293  __Pyx_memviewslice *__pyx_v_dst_slice;
29294  __Pyx_memviewslice __pyx_v_tmp_slice;
29295  PyObject *__pyx_r = NULL;
29296  __Pyx_RefNannyDeclarations
29297  __Pyx_memviewslice *__pyx_t_1;
29298  int __pyx_t_2;
29299  PyObject *__pyx_t_3 = NULL;
29300  int __pyx_t_4;
29301  int __pyx_t_5;
29302  char const *__pyx_t_6;
29303  PyObject *__pyx_t_7 = NULL;
29304  PyObject *__pyx_t_8 = NULL;
29305  PyObject *__pyx_t_9 = NULL;
29306  PyObject *__pyx_t_10 = NULL;
29307  PyObject *__pyx_t_11 = NULL;
29308  PyObject *__pyx_t_12 = NULL;
29309  int __pyx_lineno = 0;
29310  const char *__pyx_filename = NULL;
29311  int __pyx_clineno = 0;
29312  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
29313 
29314  /* "View.MemoryView":451
29315  * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
29316  * cdef int array[128]
29317  * cdef void *tmp = NULL # <<<<<<<<<<<<<<
29318  * cdef void *item
29319  *
29320  */
29321  __pyx_v_tmp = NULL;
29322 
29323  /* "View.MemoryView":456
29324  * cdef __Pyx_memviewslice *dst_slice
29325  * cdef __Pyx_memviewslice tmp_slice
29326  * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
29327  *
29328  * if <size_t>self.view.itemsize > sizeof(array):
29329  */
29330  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 456, __pyx_L1_error)
29331  __pyx_v_dst_slice = __pyx_t_1;
29332 
29333  /* "View.MemoryView":458
29334  * dst_slice = get_slice_from_memview(dst, &tmp_slice)
29335  *
29336  * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
29337  * tmp = PyMem_Malloc(self.view.itemsize)
29338  * if tmp == NULL:
29339  */
29340  __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
29341  if (__pyx_t_2) {
29342 
29343  /* "View.MemoryView":459
29344  *
29345  * if <size_t>self.view.itemsize > sizeof(array):
29346  * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
29347  * if tmp == NULL:
29348  * raise MemoryError
29349  */
29350  __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
29351 
29352  /* "View.MemoryView":460
29353  * if <size_t>self.view.itemsize > sizeof(array):
29354  * tmp = PyMem_Malloc(self.view.itemsize)
29355  * if tmp == NULL: # <<<<<<<<<<<<<<
29356  * raise MemoryError
29357  * item = tmp
29358  */
29359  __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
29360  if (unlikely(__pyx_t_2)) {
29361 
29362  /* "View.MemoryView":461
29363  * tmp = PyMem_Malloc(self.view.itemsize)
29364  * if tmp == NULL:
29365  * raise MemoryError # <<<<<<<<<<<<<<
29366  * item = tmp
29367  * else:
29368  */
29369  PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
29370 
29371  /* "View.MemoryView":460
29372  * if <size_t>self.view.itemsize > sizeof(array):
29373  * tmp = PyMem_Malloc(self.view.itemsize)
29374  * if tmp == NULL: # <<<<<<<<<<<<<<
29375  * raise MemoryError
29376  * item = tmp
29377  */
29378  }
29379 
29380  /* "View.MemoryView":462
29381  * if tmp == NULL:
29382  * raise MemoryError
29383  * item = tmp # <<<<<<<<<<<<<<
29384  * else:
29385  * item = <void *> array
29386  */
29387  __pyx_v_item = __pyx_v_tmp;
29388 
29389  /* "View.MemoryView":458
29390  * dst_slice = get_slice_from_memview(dst, &tmp_slice)
29391  *
29392  * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
29393  * tmp = PyMem_Malloc(self.view.itemsize)
29394  * if tmp == NULL:
29395  */
29396  goto __pyx_L3;
29397  }
29398 
29399  /* "View.MemoryView":464
29400  * item = tmp
29401  * else:
29402  * item = <void *> array # <<<<<<<<<<<<<<
29403  *
29404  * try:
29405  */
29406  /*else*/ {
29407  __pyx_v_item = ((void *)__pyx_v_array);
29408  }
29409  __pyx_L3:;
29410 
29411  /* "View.MemoryView":466
29412  * item = <void *> array
29413  *
29414  * try: # <<<<<<<<<<<<<<
29415  * if self.dtype_is_object:
29416  * (<PyObject **> item)[0] = <PyObject *> value
29417  */
29418  /*try:*/ {
29419 
29420  /* "View.MemoryView":467
29421  *
29422  * try:
29423  * if self.dtype_is_object: # <<<<<<<<<<<<<<
29424  * (<PyObject **> item)[0] = <PyObject *> value
29425  * else:
29426  */
29427  __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
29428  if (__pyx_t_2) {
29429 
29430  /* "View.MemoryView":468
29431  * try:
29432  * if self.dtype_is_object:
29433  * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
29434  * else:
29435  * self.assign_item_from_object(<char *> item, value)
29436  */
29437  (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
29438 
29439  /* "View.MemoryView":467
29440  *
29441  * try:
29442  * if self.dtype_is_object: # <<<<<<<<<<<<<<
29443  * (<PyObject **> item)[0] = <PyObject *> value
29444  * else:
29445  */
29446  goto __pyx_L8;
29447  }
29448 
29449  /* "View.MemoryView":470
29450  * (<PyObject **> item)[0] = <PyObject *> value
29451  * else:
29452  * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
29453  *
29454  *
29455  */
29456  /*else*/ {
29457  __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 470, __pyx_L6_error)
29458  __Pyx_GOTREF(__pyx_t_3);
29459  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29460  }
29461  __pyx_L8:;
29462 
29463  /* "View.MemoryView":474
29464  *
29465  *
29466  * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
29467  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
29468  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
29469  */
29470  __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
29471  if (__pyx_t_2) {
29472 
29473  /* "View.MemoryView":475
29474  *
29475  * if self.view.suboffsets != NULL:
29476  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
29477  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
29478  * item, self.dtype_is_object)
29479  */
29480  __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
29481  __Pyx_GOTREF(__pyx_t_3);
29482  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
29483 
29484  /* "View.MemoryView":474
29485  *
29486  *
29487  * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
29488  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
29489  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
29490  */
29491  }
29492 
29493  /* "View.MemoryView":476
29494  * if self.view.suboffsets != NULL:
29495  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
29496  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
29497  * item, self.dtype_is_object)
29498  * finally:
29499  */
29500  __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
29501  }
29502 
29503  /* "View.MemoryView":479
29504  * item, self.dtype_is_object)
29505  * finally:
29506  * PyMem_Free(tmp) # <<<<<<<<<<<<<<
29507  *
29508  * cdef setitem_indexed(self, index, value):
29509  */
29510  /*finally:*/ {
29511  /*normal exit:*/{
29512  PyMem_Free(__pyx_v_tmp);
29513  goto __pyx_L7;
29514  }
29515  __pyx_L6_error:;
29516  /*exception exit:*/{
29517  __Pyx_PyThreadState_declare
29518  __Pyx_PyThreadState_assign
29519  __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
29520  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
29521  if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
29522  if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
29523  __Pyx_XGOTREF(__pyx_t_7);
29524  __Pyx_XGOTREF(__pyx_t_8);
29525  __Pyx_XGOTREF(__pyx_t_9);
29526  __Pyx_XGOTREF(__pyx_t_10);
29527  __Pyx_XGOTREF(__pyx_t_11);
29528  __Pyx_XGOTREF(__pyx_t_12);
29529  __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
29530  {
29531  PyMem_Free(__pyx_v_tmp);
29532  }
29533  if (PY_MAJOR_VERSION >= 3) {
29534  __Pyx_XGIVEREF(__pyx_t_10);
29535  __Pyx_XGIVEREF(__pyx_t_11);
29536  __Pyx_XGIVEREF(__pyx_t_12);
29537  __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
29538  }
29539  __Pyx_XGIVEREF(__pyx_t_7);
29540  __Pyx_XGIVEREF(__pyx_t_8);
29541  __Pyx_XGIVEREF(__pyx_t_9);
29542  __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
29543  __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
29544  __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
29545  goto __pyx_L1_error;
29546  }
29547  __pyx_L7:;
29548  }
29549 
29550  /* "View.MemoryView":449
29551  * src.ndim, dst.ndim, self.dtype_is_object)
29552  *
29553  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
29554  * cdef int array[128]
29555  * cdef void *tmp = NULL
29556  */
29557 
29558  /* function exit code */
29559  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29560  goto __pyx_L0;
29561  __pyx_L1_error:;
29562  __Pyx_XDECREF(__pyx_t_3);
29563  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
29564  __pyx_r = 0;
29565  __pyx_L0:;
29566  __Pyx_XGIVEREF(__pyx_r);
29567  __Pyx_RefNannyFinishContext();
29568  return __pyx_r;
29569 }
29570 
29571 /* "View.MemoryView":481
29572  * PyMem_Free(tmp)
29573  *
29574  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
29575  * cdef char *itemp = self.get_item_pointer(index)
29576  * self.assign_item_from_object(itemp, value)
29577  */
29578 
29579 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
29580  char *__pyx_v_itemp;
29581  PyObject *__pyx_r = NULL;
29582  __Pyx_RefNannyDeclarations
29583  char *__pyx_t_1;
29584  PyObject *__pyx_t_2 = NULL;
29585  int __pyx_lineno = 0;
29586  const char *__pyx_filename = NULL;
29587  int __pyx_clineno = 0;
29588  __Pyx_RefNannySetupContext("setitem_indexed", 0);
29589 
29590  /* "View.MemoryView":482
29591  *
29592  * cdef setitem_indexed(self, index, value):
29593  * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
29594  * self.assign_item_from_object(itemp, value)
29595  *
29596  */
29597  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error)
29598  __pyx_v_itemp = __pyx_t_1;
29599 
29600  /* "View.MemoryView":483
29601  * cdef setitem_indexed(self, index, value):
29602  * cdef char *itemp = self.get_item_pointer(index)
29603  * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
29604  *
29605  * cdef convert_item_to_object(self, char *itemp):
29606  */
29607  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error)
29608  __Pyx_GOTREF(__pyx_t_2);
29609  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
29610 
29611  /* "View.MemoryView":481
29612  * PyMem_Free(tmp)
29613  *
29614  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
29615  * cdef char *itemp = self.get_item_pointer(index)
29616  * self.assign_item_from_object(itemp, value)
29617  */
29618 
29619  /* function exit code */
29620  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
29621  goto __pyx_L0;
29622  __pyx_L1_error:;
29623  __Pyx_XDECREF(__pyx_t_2);
29624  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
29625  __pyx_r = 0;
29626  __pyx_L0:;
29627  __Pyx_XGIVEREF(__pyx_r);
29628  __Pyx_RefNannyFinishContext();
29629  return __pyx_r;
29630 }
29631 
29632 /* "View.MemoryView":485
29633  * self.assign_item_from_object(itemp, value)
29634  *
29635  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
29636  * """Only used if instantiated manually by the user, or if Cython doesn't
29637  * know how to convert the type"""
29638  */
29639 
29640 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
29641  PyObject *__pyx_v_struct = NULL;
29642  PyObject *__pyx_v_bytesitem = 0;
29643  PyObject *__pyx_v_result = NULL;
29644  PyObject *__pyx_r = NULL;
29645  __Pyx_RefNannyDeclarations
29646  PyObject *__pyx_t_1 = NULL;
29647  PyObject *__pyx_t_2 = NULL;
29648  PyObject *__pyx_t_3 = NULL;
29649  PyObject *__pyx_t_4 = NULL;
29650  PyObject *__pyx_t_5 = NULL;
29651  PyObject *__pyx_t_6 = NULL;
29652  PyObject *__pyx_t_7 = NULL;
29653  int __pyx_t_8;
29654  PyObject *__pyx_t_9 = NULL;
29655  size_t __pyx_t_10;
29656  int __pyx_t_11;
29657  int __pyx_lineno = 0;
29658  const char *__pyx_filename = NULL;
29659  int __pyx_clineno = 0;
29660  __Pyx_RefNannySetupContext("convert_item_to_object", 0);
29661 
29662  /* "View.MemoryView":488
29663  * """Only used if instantiated manually by the user, or if Cython doesn't
29664  * know how to convert the type"""
29665  * import struct # <<<<<<<<<<<<<<
29666  * cdef bytes bytesitem
29667  *
29668  */
29669  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
29670  __Pyx_GOTREF(__pyx_t_1);
29671  __pyx_v_struct = __pyx_t_1;
29672  __pyx_t_1 = 0;
29673 
29674  /* "View.MemoryView":491
29675  * cdef bytes bytesitem
29676  *
29677  * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
29678  * try:
29679  * result = struct.unpack(self.view.format, bytesitem)
29680  */
29681  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
29682  __Pyx_GOTREF(__pyx_t_1);
29683  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
29684  __pyx_t_1 = 0;
29685 
29686  /* "View.MemoryView":492
29687  *
29688  * bytesitem = itemp[:self.view.itemsize]
29689  * try: # <<<<<<<<<<<<<<
29690  * result = struct.unpack(self.view.format, bytesitem)
29691  * except struct.error:
29692  */
29693  {
29694  __Pyx_PyThreadState_declare
29695  __Pyx_PyThreadState_assign
29696  __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
29697  __Pyx_XGOTREF(__pyx_t_2);
29698  __Pyx_XGOTREF(__pyx_t_3);
29699  __Pyx_XGOTREF(__pyx_t_4);
29700  /*try:*/ {
29701 
29702  /* "View.MemoryView":493
29703  * bytesitem = itemp[:self.view.itemsize]
29704  * try:
29705  * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
29706  * except struct.error:
29707  * raise ValueError("Unable to convert item to object")
29708  */
29709  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
29710  __Pyx_GOTREF(__pyx_t_5);
29711  __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
29712  __Pyx_GOTREF(__pyx_t_6);
29713  __pyx_t_7 = NULL;
29714  __pyx_t_8 = 0;
29715  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
29716  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
29717  if (likely(__pyx_t_7)) {
29718  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
29719  __Pyx_INCREF(__pyx_t_7);
29720  __Pyx_INCREF(function);
29721  __Pyx_DECREF_SET(__pyx_t_5, function);
29722  __pyx_t_8 = 1;
29723  }
29724  }
29725  #if CYTHON_FAST_PYCALL
29726  if (PyFunction_Check(__pyx_t_5)) {
29727  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
29728  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
29729  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
29730  __Pyx_GOTREF(__pyx_t_1);
29731  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29732  } else
29733  #endif
29734  #if CYTHON_FAST_PYCCALL
29735  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
29736  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
29737  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
29738  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
29739  __Pyx_GOTREF(__pyx_t_1);
29740  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29741  } else
29742  #endif
29743  {
29744  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
29745  __Pyx_GOTREF(__pyx_t_9);
29746  if (__pyx_t_7) {
29747  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
29748  }
29749  __Pyx_GIVEREF(__pyx_t_6);
29750  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
29751  __Pyx_INCREF(__pyx_v_bytesitem);
29752  __Pyx_GIVEREF(__pyx_v_bytesitem);
29753  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
29754  __pyx_t_6 = 0;
29755  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
29756  __Pyx_GOTREF(__pyx_t_1);
29757  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
29758  }
29759  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29760  __pyx_v_result = __pyx_t_1;
29761  __pyx_t_1 = 0;
29762 
29763  /* "View.MemoryView":492
29764  *
29765  * bytesitem = itemp[:self.view.itemsize]
29766  * try: # <<<<<<<<<<<<<<
29767  * result = struct.unpack(self.view.format, bytesitem)
29768  * except struct.error:
29769  */
29770  }
29771 
29772  /* "View.MemoryView":497
29773  * raise ValueError("Unable to convert item to object")
29774  * else:
29775  * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
29776  * return result[0]
29777  * return result
29778  */
29779  /*else:*/ {
29780  __pyx_t_10 = strlen(__pyx_v_self->view.format);
29781  __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
29782  if (__pyx_t_11) {
29783 
29784  /* "View.MemoryView":498
29785  * else:
29786  * if len(self.view.format) == 1:
29787  * return result[0] # <<<<<<<<<<<<<<
29788  * return result
29789  *
29790  */
29791  __Pyx_XDECREF(__pyx_r);
29792  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error)
29793  __Pyx_GOTREF(__pyx_t_1);
29794  __pyx_r = __pyx_t_1;
29795  __pyx_t_1 = 0;
29796  goto __pyx_L6_except_return;
29797 
29798  /* "View.MemoryView":497
29799  * raise ValueError("Unable to convert item to object")
29800  * else:
29801  * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
29802  * return result[0]
29803  * return result
29804  */
29805  }
29806 
29807  /* "View.MemoryView":499
29808  * if len(self.view.format) == 1:
29809  * return result[0]
29810  * return result # <<<<<<<<<<<<<<
29811  *
29812  * cdef assign_item_from_object(self, char *itemp, object value):
29813  */
29814  __Pyx_XDECREF(__pyx_r);
29815  __Pyx_INCREF(__pyx_v_result);
29816  __pyx_r = __pyx_v_result;
29817  goto __pyx_L6_except_return;
29818  }
29819  __pyx_L3_error:;
29820  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
29821  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
29822  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
29823  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
29824  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
29825 
29826  /* "View.MemoryView":494
29827  * try:
29828  * result = struct.unpack(self.view.format, bytesitem)
29829  * except struct.error: # <<<<<<<<<<<<<<
29830  * raise ValueError("Unable to convert item to object")
29831  * else:
29832  */
29833  __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
29834  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
29835  __Pyx_GOTREF(__pyx_t_6);
29836  __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
29837  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29838  __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
29839  __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
29840  if (__pyx_t_8) {
29841  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
29842  if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
29843  __Pyx_GOTREF(__pyx_t_9);
29844  __Pyx_GOTREF(__pyx_t_5);
29845  __Pyx_GOTREF(__pyx_t_1);
29846 
29847  /* "View.MemoryView":495
29848  * result = struct.unpack(self.view.format, bytesitem)
29849  * except struct.error:
29850  * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
29851  * else:
29852  * if len(self.view.format) == 1:
29853  */
29854  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
29855  __Pyx_GOTREF(__pyx_t_6);
29856  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
29857  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29858  __PYX_ERR(2, 495, __pyx_L5_except_error)
29859  }
29860  goto __pyx_L5_except_error;
29861  __pyx_L5_except_error:;
29862 
29863  /* "View.MemoryView":492
29864  *
29865  * bytesitem = itemp[:self.view.itemsize]
29866  * try: # <<<<<<<<<<<<<<
29867  * result = struct.unpack(self.view.format, bytesitem)
29868  * except struct.error:
29869  */
29870  __Pyx_XGIVEREF(__pyx_t_2);
29871  __Pyx_XGIVEREF(__pyx_t_3);
29872  __Pyx_XGIVEREF(__pyx_t_4);
29873  __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
29874  goto __pyx_L1_error;
29875  __pyx_L6_except_return:;
29876  __Pyx_XGIVEREF(__pyx_t_2);
29877  __Pyx_XGIVEREF(__pyx_t_3);
29878  __Pyx_XGIVEREF(__pyx_t_4);
29879  __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
29880  goto __pyx_L0;
29881  }
29882 
29883  /* "View.MemoryView":485
29884  * self.assign_item_from_object(itemp, value)
29885  *
29886  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
29887  * """Only used if instantiated manually by the user, or if Cython doesn't
29888  * know how to convert the type"""
29889  */
29890 
29891  /* function exit code */
29892  __pyx_L1_error:;
29893  __Pyx_XDECREF(__pyx_t_1);
29894  __Pyx_XDECREF(__pyx_t_5);
29895  __Pyx_XDECREF(__pyx_t_6);
29896  __Pyx_XDECREF(__pyx_t_7);
29897  __Pyx_XDECREF(__pyx_t_9);
29898  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
29899  __pyx_r = 0;
29900  __pyx_L0:;
29901  __Pyx_XDECREF(__pyx_v_struct);
29902  __Pyx_XDECREF(__pyx_v_bytesitem);
29903  __Pyx_XDECREF(__pyx_v_result);
29904  __Pyx_XGIVEREF(__pyx_r);
29905  __Pyx_RefNannyFinishContext();
29906  return __pyx_r;
29907 }
29908 
29909 /* "View.MemoryView":501
29910  * return result
29911  *
29912  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
29913  * """Only used if instantiated manually by the user, or if Cython doesn't
29914  * know how to convert the type"""
29915  */
29916 
29917 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
29918  PyObject *__pyx_v_struct = NULL;
29919  char __pyx_v_c;
29920  PyObject *__pyx_v_bytesvalue = 0;
29921  Py_ssize_t __pyx_v_i;
29922  PyObject *__pyx_r = NULL;
29923  __Pyx_RefNannyDeclarations
29924  PyObject *__pyx_t_1 = NULL;
29925  int __pyx_t_2;
29926  int __pyx_t_3;
29927  PyObject *__pyx_t_4 = NULL;
29928  PyObject *__pyx_t_5 = NULL;
29929  PyObject *__pyx_t_6 = NULL;
29930  int __pyx_t_7;
29931  PyObject *__pyx_t_8 = NULL;
29932  Py_ssize_t __pyx_t_9;
29933  PyObject *__pyx_t_10 = NULL;
29934  char *__pyx_t_11;
29935  char *__pyx_t_12;
29936  char *__pyx_t_13;
29937  char *__pyx_t_14;
29938  int __pyx_lineno = 0;
29939  const char *__pyx_filename = NULL;
29940  int __pyx_clineno = 0;
29941  __Pyx_RefNannySetupContext("assign_item_from_object", 0);
29942 
29943  /* "View.MemoryView":504
29944  * """Only used if instantiated manually by the user, or if Cython doesn't
29945  * know how to convert the type"""
29946  * import struct # <<<<<<<<<<<<<<
29947  * cdef char c
29948  * cdef bytes bytesvalue
29949  */
29950  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
29951  __Pyx_GOTREF(__pyx_t_1);
29952  __pyx_v_struct = __pyx_t_1;
29953  __pyx_t_1 = 0;
29954 
29955  /* "View.MemoryView":509
29956  * cdef Py_ssize_t i
29957  *
29958  * if isinstance(value, tuple): # <<<<<<<<<<<<<<
29959  * bytesvalue = struct.pack(self.view.format, *value)
29960  * else:
29961  */
29962  __pyx_t_2 = PyTuple_Check(__pyx_v_value);
29963  __pyx_t_3 = (__pyx_t_2 != 0);
29964  if (__pyx_t_3) {
29965 
29966  /* "View.MemoryView":510
29967  *
29968  * if isinstance(value, tuple):
29969  * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
29970  * else:
29971  * bytesvalue = struct.pack(self.view.format, value)
29972  */
29973  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
29974  __Pyx_GOTREF(__pyx_t_1);
29975  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
29976  __Pyx_GOTREF(__pyx_t_4);
29977  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
29978  __Pyx_GOTREF(__pyx_t_5);
29979  __Pyx_GIVEREF(__pyx_t_4);
29980  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
29981  __pyx_t_4 = 0;
29982  __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
29983  __Pyx_GOTREF(__pyx_t_4);
29984  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
29985  __Pyx_GOTREF(__pyx_t_6);
29986  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
29987  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
29988  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
29989  __Pyx_GOTREF(__pyx_t_4);
29990  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
29991  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
29992  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error)
29993  __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
29994  __pyx_t_4 = 0;
29995 
29996  /* "View.MemoryView":509
29997  * cdef Py_ssize_t i
29998  *
29999  * if isinstance(value, tuple): # <<<<<<<<<<<<<<
30000  * bytesvalue = struct.pack(self.view.format, *value)
30001  * else:
30002  */
30003  goto __pyx_L3;
30004  }
30005 
30006  /* "View.MemoryView":512
30007  * bytesvalue = struct.pack(self.view.format, *value)
30008  * else:
30009  * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
30010  *
30011  * for i, c in enumerate(bytesvalue):
30012  */
30013  /*else*/ {
30014  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
30015  __Pyx_GOTREF(__pyx_t_6);
30016  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
30017  __Pyx_GOTREF(__pyx_t_1);
30018  __pyx_t_5 = NULL;
30019  __pyx_t_7 = 0;
30020  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
30021  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
30022  if (likely(__pyx_t_5)) {
30023  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
30024  __Pyx_INCREF(__pyx_t_5);
30025  __Pyx_INCREF(function);
30026  __Pyx_DECREF_SET(__pyx_t_6, function);
30027  __pyx_t_7 = 1;
30028  }
30029  }
30030  #if CYTHON_FAST_PYCALL
30031  if (PyFunction_Check(__pyx_t_6)) {
30032  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
30033  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
30034  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30035  __Pyx_GOTREF(__pyx_t_4);
30036  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30037  } else
30038  #endif
30039  #if CYTHON_FAST_PYCCALL
30040  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
30041  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
30042  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
30043  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
30044  __Pyx_GOTREF(__pyx_t_4);
30045  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30046  } else
30047  #endif
30048  {
30049  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
30050  __Pyx_GOTREF(__pyx_t_8);
30051  if (__pyx_t_5) {
30052  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
30053  }
30054  __Pyx_GIVEREF(__pyx_t_1);
30055  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
30056  __Pyx_INCREF(__pyx_v_value);
30057  __Pyx_GIVEREF(__pyx_v_value);
30058  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
30059  __pyx_t_1 = 0;
30060  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
30061  __Pyx_GOTREF(__pyx_t_4);
30062  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
30063  }
30064  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30065  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
30066  __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
30067  __pyx_t_4 = 0;
30068  }
30069  __pyx_L3:;
30070 
30071  /* "View.MemoryView":514
30072  * bytesvalue = struct.pack(self.view.format, value)
30073  *
30074  * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
30075  * itemp[i] = c
30076  *
30077  */
30078  __pyx_t_9 = 0;
30079  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
30080  PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
30081  __PYX_ERR(2, 514, __pyx_L1_error)
30082  }
30083  __Pyx_INCREF(__pyx_v_bytesvalue);
30084  __pyx_t_10 = __pyx_v_bytesvalue;
30085  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
30086  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
30087  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
30088  __pyx_t_11 = __pyx_t_14;
30089  __pyx_v_c = (__pyx_t_11[0]);
30090 
30091  /* "View.MemoryView":515
30092  *
30093  * for i, c in enumerate(bytesvalue):
30094  * itemp[i] = c # <<<<<<<<<<<<<<
30095  *
30096  * @cname('getbuffer')
30097  */
30098  __pyx_v_i = __pyx_t_9;
30099 
30100  /* "View.MemoryView":514
30101  * bytesvalue = struct.pack(self.view.format, value)
30102  *
30103  * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
30104  * itemp[i] = c
30105  *
30106  */
30107  __pyx_t_9 = (__pyx_t_9 + 1);
30108 
30109  /* "View.MemoryView":515
30110  *
30111  * for i, c in enumerate(bytesvalue):
30112  * itemp[i] = c # <<<<<<<<<<<<<<
30113  *
30114  * @cname('getbuffer')
30115  */
30116  (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
30117  }
30118  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
30119 
30120  /* "View.MemoryView":501
30121  * return result
30122  *
30123  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
30124  * """Only used if instantiated manually by the user, or if Cython doesn't
30125  * know how to convert the type"""
30126  */
30127 
30128  /* function exit code */
30129  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
30130  goto __pyx_L0;
30131  __pyx_L1_error:;
30132  __Pyx_XDECREF(__pyx_t_1);
30133  __Pyx_XDECREF(__pyx_t_4);
30134  __Pyx_XDECREF(__pyx_t_5);
30135  __Pyx_XDECREF(__pyx_t_6);
30136  __Pyx_XDECREF(__pyx_t_8);
30137  __Pyx_XDECREF(__pyx_t_10);
30138  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
30139  __pyx_r = 0;
30140  __pyx_L0:;
30141  __Pyx_XDECREF(__pyx_v_struct);
30142  __Pyx_XDECREF(__pyx_v_bytesvalue);
30143  __Pyx_XGIVEREF(__pyx_r);
30144  __Pyx_RefNannyFinishContext();
30145  return __pyx_r;
30146 }
30147 
30148 /* "View.MemoryView":518
30149  *
30150  * @cname('getbuffer')
30151  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
30152  * if flags & PyBUF_WRITABLE and self.view.readonly:
30153  * raise ValueError("Cannot create writable memory view from read-only memoryview")
30154  */
30155 
30156 /* Python wrapper */
30157 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
30158 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
30159  int __pyx_r;
30160  __Pyx_RefNannyDeclarations
30161  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
30162  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
30163 
30164  /* function exit code */
30165  __Pyx_RefNannyFinishContext();
30166  return __pyx_r;
30167 }
30168 
30169 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
30170  int __pyx_r;
30171  __Pyx_RefNannyDeclarations
30172  int __pyx_t_1;
30173  int __pyx_t_2;
30174  PyObject *__pyx_t_3 = NULL;
30175  Py_ssize_t *__pyx_t_4;
30176  char *__pyx_t_5;
30177  void *__pyx_t_6;
30178  int __pyx_t_7;
30179  Py_ssize_t __pyx_t_8;
30180  int __pyx_lineno = 0;
30181  const char *__pyx_filename = NULL;
30182  int __pyx_clineno = 0;
30183  if (__pyx_v_info == NULL) {
30184  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
30185  return -1;
30186  }
30187  __Pyx_RefNannySetupContext("__getbuffer__", 0);
30188  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
30189  __Pyx_GIVEREF(__pyx_v_info->obj);
30190 
30191  /* "View.MemoryView":519
30192  * @cname('getbuffer')
30193  * def __getbuffer__(self, Py_buffer *info, int flags):
30194  * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
30195  * raise ValueError("Cannot create writable memory view from read-only memoryview")
30196  *
30197  */
30198  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
30199  if (__pyx_t_2) {
30200  } else {
30201  __pyx_t_1 = __pyx_t_2;
30202  goto __pyx_L4_bool_binop_done;
30203  }
30204  __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
30205  __pyx_t_1 = __pyx_t_2;
30206  __pyx_L4_bool_binop_done:;
30207  if (unlikely(__pyx_t_1)) {
30208 
30209  /* "View.MemoryView":520
30210  * def __getbuffer__(self, Py_buffer *info, int flags):
30211  * if flags & PyBUF_WRITABLE and self.view.readonly:
30212  * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
30213  *
30214  * if flags & PyBUF_ND:
30215  */
30216  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
30217  __Pyx_GOTREF(__pyx_t_3);
30218  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
30219  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30220  __PYX_ERR(2, 520, __pyx_L1_error)
30221 
30222  /* "View.MemoryView":519
30223  * @cname('getbuffer')
30224  * def __getbuffer__(self, Py_buffer *info, int flags):
30225  * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
30226  * raise ValueError("Cannot create writable memory view from read-only memoryview")
30227  *
30228  */
30229  }
30230 
30231  /* "View.MemoryView":522
30232  * raise ValueError("Cannot create writable memory view from read-only memoryview")
30233  *
30234  * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
30235  * info.shape = self.view.shape
30236  * else:
30237  */
30238  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
30239  if (__pyx_t_1) {
30240 
30241  /* "View.MemoryView":523
30242  *
30243  * if flags & PyBUF_ND:
30244  * info.shape = self.view.shape # <<<<<<<<<<<<<<
30245  * else:
30246  * info.shape = NULL
30247  */
30248  __pyx_t_4 = __pyx_v_self->view.shape;
30249  __pyx_v_info->shape = __pyx_t_4;
30250 
30251  /* "View.MemoryView":522
30252  * raise ValueError("Cannot create writable memory view from read-only memoryview")
30253  *
30254  * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
30255  * info.shape = self.view.shape
30256  * else:
30257  */
30258  goto __pyx_L6;
30259  }
30260 
30261  /* "View.MemoryView":525
30262  * info.shape = self.view.shape
30263  * else:
30264  * info.shape = NULL # <<<<<<<<<<<<<<
30265  *
30266  * if flags & PyBUF_STRIDES:
30267  */
30268  /*else*/ {
30269  __pyx_v_info->shape = NULL;
30270  }
30271  __pyx_L6:;
30272 
30273  /* "View.MemoryView":527
30274  * info.shape = NULL
30275  *
30276  * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
30277  * info.strides = self.view.strides
30278  * else:
30279  */
30280  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
30281  if (__pyx_t_1) {
30282 
30283  /* "View.MemoryView":528
30284  *
30285  * if flags & PyBUF_STRIDES:
30286  * info.strides = self.view.strides # <<<<<<<<<<<<<<
30287  * else:
30288  * info.strides = NULL
30289  */
30290  __pyx_t_4 = __pyx_v_self->view.strides;
30291  __pyx_v_info->strides = __pyx_t_4;
30292 
30293  /* "View.MemoryView":527
30294  * info.shape = NULL
30295  *
30296  * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
30297  * info.strides = self.view.strides
30298  * else:
30299  */
30300  goto __pyx_L7;
30301  }
30302 
30303  /* "View.MemoryView":530
30304  * info.strides = self.view.strides
30305  * else:
30306  * info.strides = NULL # <<<<<<<<<<<<<<
30307  *
30308  * if flags & PyBUF_INDIRECT:
30309  */
30310  /*else*/ {
30311  __pyx_v_info->strides = NULL;
30312  }
30313  __pyx_L7:;
30314 
30315  /* "View.MemoryView":532
30316  * info.strides = NULL
30317  *
30318  * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
30319  * info.suboffsets = self.view.suboffsets
30320  * else:
30321  */
30322  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
30323  if (__pyx_t_1) {
30324 
30325  /* "View.MemoryView":533
30326  *
30327  * if flags & PyBUF_INDIRECT:
30328  * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
30329  * else:
30330  * info.suboffsets = NULL
30331  */
30332  __pyx_t_4 = __pyx_v_self->view.suboffsets;
30333  __pyx_v_info->suboffsets = __pyx_t_4;
30334 
30335  /* "View.MemoryView":532
30336  * info.strides = NULL
30337  *
30338  * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
30339  * info.suboffsets = self.view.suboffsets
30340  * else:
30341  */
30342  goto __pyx_L8;
30343  }
30344 
30345  /* "View.MemoryView":535
30346  * info.suboffsets = self.view.suboffsets
30347  * else:
30348  * info.suboffsets = NULL # <<<<<<<<<<<<<<
30349  *
30350  * if flags & PyBUF_FORMAT:
30351  */
30352  /*else*/ {
30353  __pyx_v_info->suboffsets = NULL;
30354  }
30355  __pyx_L8:;
30356 
30357  /* "View.MemoryView":537
30358  * info.suboffsets = NULL
30359  *
30360  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
30361  * info.format = self.view.format
30362  * else:
30363  */
30364  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
30365  if (__pyx_t_1) {
30366 
30367  /* "View.MemoryView":538
30368  *
30369  * if flags & PyBUF_FORMAT:
30370  * info.format = self.view.format # <<<<<<<<<<<<<<
30371  * else:
30372  * info.format = NULL
30373  */
30374  __pyx_t_5 = __pyx_v_self->view.format;
30375  __pyx_v_info->format = __pyx_t_5;
30376 
30377  /* "View.MemoryView":537
30378  * info.suboffsets = NULL
30379  *
30380  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
30381  * info.format = self.view.format
30382  * else:
30383  */
30384  goto __pyx_L9;
30385  }
30386 
30387  /* "View.MemoryView":540
30388  * info.format = self.view.format
30389  * else:
30390  * info.format = NULL # <<<<<<<<<<<<<<
30391  *
30392  * info.buf = self.view.buf
30393  */
30394  /*else*/ {
30395  __pyx_v_info->format = NULL;
30396  }
30397  __pyx_L9:;
30398 
30399  /* "View.MemoryView":542
30400  * info.format = NULL
30401  *
30402  * info.buf = self.view.buf # <<<<<<<<<<<<<<
30403  * info.ndim = self.view.ndim
30404  * info.itemsize = self.view.itemsize
30405  */
30406  __pyx_t_6 = __pyx_v_self->view.buf;
30407  __pyx_v_info->buf = __pyx_t_6;
30408 
30409  /* "View.MemoryView":543
30410  *
30411  * info.buf = self.view.buf
30412  * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
30413  * info.itemsize = self.view.itemsize
30414  * info.len = self.view.len
30415  */
30416  __pyx_t_7 = __pyx_v_self->view.ndim;
30417  __pyx_v_info->ndim = __pyx_t_7;
30418 
30419  /* "View.MemoryView":544
30420  * info.buf = self.view.buf
30421  * info.ndim = self.view.ndim
30422  * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
30423  * info.len = self.view.len
30424  * info.readonly = self.view.readonly
30425  */
30426  __pyx_t_8 = __pyx_v_self->view.itemsize;
30427  __pyx_v_info->itemsize = __pyx_t_8;
30428 
30429  /* "View.MemoryView":545
30430  * info.ndim = self.view.ndim
30431  * info.itemsize = self.view.itemsize
30432  * info.len = self.view.len # <<<<<<<<<<<<<<
30433  * info.readonly = self.view.readonly
30434  * info.obj = self
30435  */
30436  __pyx_t_8 = __pyx_v_self->view.len;
30437  __pyx_v_info->len = __pyx_t_8;
30438 
30439  /* "View.MemoryView":546
30440  * info.itemsize = self.view.itemsize
30441  * info.len = self.view.len
30442  * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
30443  * info.obj = self
30444  *
30445  */
30446  __pyx_t_1 = __pyx_v_self->view.readonly;
30447  __pyx_v_info->readonly = __pyx_t_1;
30448 
30449  /* "View.MemoryView":547
30450  * info.len = self.view.len
30451  * info.readonly = self.view.readonly
30452  * info.obj = self # <<<<<<<<<<<<<<
30453  *
30454  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
30455  */
30456  __Pyx_INCREF(((PyObject *)__pyx_v_self));
30457  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
30458  __Pyx_GOTREF(__pyx_v_info->obj);
30459  __Pyx_DECREF(__pyx_v_info->obj);
30460  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
30461 
30462  /* "View.MemoryView":518
30463  *
30464  * @cname('getbuffer')
30465  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
30466  * if flags & PyBUF_WRITABLE and self.view.readonly:
30467  * raise ValueError("Cannot create writable memory view from read-only memoryview")
30468  */
30469 
30470  /* function exit code */
30471  __pyx_r = 0;
30472  goto __pyx_L0;
30473  __pyx_L1_error:;
30474  __Pyx_XDECREF(__pyx_t_3);
30475  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30476  __pyx_r = -1;
30477  if (__pyx_v_info->obj != NULL) {
30478  __Pyx_GOTREF(__pyx_v_info->obj);
30479  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
30480  }
30481  goto __pyx_L2;
30482  __pyx_L0:;
30483  if (__pyx_v_info->obj == Py_None) {
30484  __Pyx_GOTREF(__pyx_v_info->obj);
30485  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
30486  }
30487  __pyx_L2:;
30488  __Pyx_RefNannyFinishContext();
30489  return __pyx_r;
30490 }
30491 
30492 /* "View.MemoryView":553
30493  *
30494  * @property
30495  * def T(self): # <<<<<<<<<<<<<<
30496  * cdef _memoryviewslice result = memoryview_copy(self)
30497  * transpose_memslice(&result.from_slice)
30498  */
30499 
30500 /* Python wrapper */
30501 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
30502 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
30503  PyObject *__pyx_r = 0;
30504  __Pyx_RefNannyDeclarations
30505  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30506  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
30507 
30508  /* function exit code */
30509  __Pyx_RefNannyFinishContext();
30510  return __pyx_r;
30511 }
30512 
30513 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
30514  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
30515  PyObject *__pyx_r = NULL;
30516  __Pyx_RefNannyDeclarations
30517  PyObject *__pyx_t_1 = NULL;
30518  int __pyx_t_2;
30519  int __pyx_lineno = 0;
30520  const char *__pyx_filename = NULL;
30521  int __pyx_clineno = 0;
30522  __Pyx_RefNannySetupContext("__get__", 0);
30523 
30524  /* "View.MemoryView":554
30525  * @property
30526  * def T(self):
30527  * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
30528  * transpose_memslice(&result.from_slice)
30529  * return result
30530  */
30531  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
30532  __Pyx_GOTREF(__pyx_t_1);
30533  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
30534  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
30535  __pyx_t_1 = 0;
30536 
30537  /* "View.MemoryView":555
30538  * def T(self):
30539  * cdef _memoryviewslice result = memoryview_copy(self)
30540  * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
30541  * return result
30542  *
30543  */
30544  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
30545 
30546  /* "View.MemoryView":556
30547  * cdef _memoryviewslice result = memoryview_copy(self)
30548  * transpose_memslice(&result.from_slice)
30549  * return result # <<<<<<<<<<<<<<
30550  *
30551  * @property
30552  */
30553  __Pyx_XDECREF(__pyx_r);
30554  __Pyx_INCREF(((PyObject *)__pyx_v_result));
30555  __pyx_r = ((PyObject *)__pyx_v_result);
30556  goto __pyx_L0;
30557 
30558  /* "View.MemoryView":553
30559  *
30560  * @property
30561  * def T(self): # <<<<<<<<<<<<<<
30562  * cdef _memoryviewslice result = memoryview_copy(self)
30563  * transpose_memslice(&result.from_slice)
30564  */
30565 
30566  /* function exit code */
30567  __pyx_L1_error:;
30568  __Pyx_XDECREF(__pyx_t_1);
30569  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30570  __pyx_r = NULL;
30571  __pyx_L0:;
30572  __Pyx_XDECREF((PyObject *)__pyx_v_result);
30573  __Pyx_XGIVEREF(__pyx_r);
30574  __Pyx_RefNannyFinishContext();
30575  return __pyx_r;
30576 }
30577 
30578 /* "View.MemoryView":559
30579  *
30580  * @property
30581  * def base(self): # <<<<<<<<<<<<<<
30582  * return self.obj
30583  *
30584  */
30585 
30586 /* Python wrapper */
30587 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
30588 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
30589  PyObject *__pyx_r = 0;
30590  __Pyx_RefNannyDeclarations
30591  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30592  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
30593 
30594  /* function exit code */
30595  __Pyx_RefNannyFinishContext();
30596  return __pyx_r;
30597 }
30598 
30599 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
30600  PyObject *__pyx_r = NULL;
30601  __Pyx_RefNannyDeclarations
30602  __Pyx_RefNannySetupContext("__get__", 0);
30603 
30604  /* "View.MemoryView":560
30605  * @property
30606  * def base(self):
30607  * return self.obj # <<<<<<<<<<<<<<
30608  *
30609  * @property
30610  */
30611  __Pyx_XDECREF(__pyx_r);
30612  __Pyx_INCREF(__pyx_v_self->obj);
30613  __pyx_r = __pyx_v_self->obj;
30614  goto __pyx_L0;
30615 
30616  /* "View.MemoryView":559
30617  *
30618  * @property
30619  * def base(self): # <<<<<<<<<<<<<<
30620  * return self.obj
30621  *
30622  */
30623 
30624  /* function exit code */
30625  __pyx_L0:;
30626  __Pyx_XGIVEREF(__pyx_r);
30627  __Pyx_RefNannyFinishContext();
30628  return __pyx_r;
30629 }
30630 
30631 /* "View.MemoryView":563
30632  *
30633  * @property
30634  * def shape(self): # <<<<<<<<<<<<<<
30635  * return tuple([length for length in self.view.shape[:self.view.ndim]])
30636  *
30637  */
30638 
30639 /* Python wrapper */
30640 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
30641 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
30642  PyObject *__pyx_r = 0;
30643  __Pyx_RefNannyDeclarations
30644  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30645  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
30646 
30647  /* function exit code */
30648  __Pyx_RefNannyFinishContext();
30649  return __pyx_r;
30650 }
30651 
30652 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
30653  Py_ssize_t __pyx_v_length;
30654  PyObject *__pyx_r = NULL;
30655  __Pyx_RefNannyDeclarations
30656  PyObject *__pyx_t_1 = NULL;
30657  Py_ssize_t *__pyx_t_2;
30658  Py_ssize_t *__pyx_t_3;
30659  Py_ssize_t *__pyx_t_4;
30660  PyObject *__pyx_t_5 = NULL;
30661  int __pyx_lineno = 0;
30662  const char *__pyx_filename = NULL;
30663  int __pyx_clineno = 0;
30664  __Pyx_RefNannySetupContext("__get__", 0);
30665 
30666  /* "View.MemoryView":564
30667  * @property
30668  * def shape(self):
30669  * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
30670  *
30671  * @property
30672  */
30673  __Pyx_XDECREF(__pyx_r);
30674  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
30675  __Pyx_GOTREF(__pyx_t_1);
30676  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
30677  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
30678  __pyx_t_2 = __pyx_t_4;
30679  __pyx_v_length = (__pyx_t_2[0]);
30680  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
30681  __Pyx_GOTREF(__pyx_t_5);
30682  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
30683  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
30684  }
30685  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
30686  __Pyx_GOTREF(__pyx_t_5);
30687  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
30688  __pyx_r = __pyx_t_5;
30689  __pyx_t_5 = 0;
30690  goto __pyx_L0;
30691 
30692  /* "View.MemoryView":563
30693  *
30694  * @property
30695  * def shape(self): # <<<<<<<<<<<<<<
30696  * return tuple([length for length in self.view.shape[:self.view.ndim]])
30697  *
30698  */
30699 
30700  /* function exit code */
30701  __pyx_L1_error:;
30702  __Pyx_XDECREF(__pyx_t_1);
30703  __Pyx_XDECREF(__pyx_t_5);
30704  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30705  __pyx_r = NULL;
30706  __pyx_L0:;
30707  __Pyx_XGIVEREF(__pyx_r);
30708  __Pyx_RefNannyFinishContext();
30709  return __pyx_r;
30710 }
30711 
30712 /* "View.MemoryView":567
30713  *
30714  * @property
30715  * def strides(self): # <<<<<<<<<<<<<<
30716  * if self.view.strides == NULL:
30717  *
30718  */
30719 
30720 /* Python wrapper */
30721 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
30722 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
30723  PyObject *__pyx_r = 0;
30724  __Pyx_RefNannyDeclarations
30725  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30726  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
30727 
30728  /* function exit code */
30729  __Pyx_RefNannyFinishContext();
30730  return __pyx_r;
30731 }
30732 
30733 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
30734  Py_ssize_t __pyx_v_stride;
30735  PyObject *__pyx_r = NULL;
30736  __Pyx_RefNannyDeclarations
30737  int __pyx_t_1;
30738  PyObject *__pyx_t_2 = NULL;
30739  Py_ssize_t *__pyx_t_3;
30740  Py_ssize_t *__pyx_t_4;
30741  Py_ssize_t *__pyx_t_5;
30742  PyObject *__pyx_t_6 = NULL;
30743  int __pyx_lineno = 0;
30744  const char *__pyx_filename = NULL;
30745  int __pyx_clineno = 0;
30746  __Pyx_RefNannySetupContext("__get__", 0);
30747 
30748  /* "View.MemoryView":568
30749  * @property
30750  * def strides(self):
30751  * if self.view.strides == NULL: # <<<<<<<<<<<<<<
30752  *
30753  * raise ValueError("Buffer view does not expose strides")
30754  */
30755  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
30756  if (unlikely(__pyx_t_1)) {
30757 
30758  /* "View.MemoryView":570
30759  * if self.view.strides == NULL:
30760  *
30761  * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
30762  *
30763  * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
30764  */
30765  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
30766  __Pyx_GOTREF(__pyx_t_2);
30767  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
30768  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30769  __PYX_ERR(2, 570, __pyx_L1_error)
30770 
30771  /* "View.MemoryView":568
30772  * @property
30773  * def strides(self):
30774  * if self.view.strides == NULL: # <<<<<<<<<<<<<<
30775  *
30776  * raise ValueError("Buffer view does not expose strides")
30777  */
30778  }
30779 
30780  /* "View.MemoryView":572
30781  * raise ValueError("Buffer view does not expose strides")
30782  *
30783  * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
30784  *
30785  * @property
30786  */
30787  __Pyx_XDECREF(__pyx_r);
30788  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
30789  __Pyx_GOTREF(__pyx_t_2);
30790  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
30791  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
30792  __pyx_t_3 = __pyx_t_5;
30793  __pyx_v_stride = (__pyx_t_3[0]);
30794  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
30795  __Pyx_GOTREF(__pyx_t_6);
30796  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
30797  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
30798  }
30799  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
30800  __Pyx_GOTREF(__pyx_t_6);
30801  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30802  __pyx_r = __pyx_t_6;
30803  __pyx_t_6 = 0;
30804  goto __pyx_L0;
30805 
30806  /* "View.MemoryView":567
30807  *
30808  * @property
30809  * def strides(self): # <<<<<<<<<<<<<<
30810  * if self.view.strides == NULL:
30811  *
30812  */
30813 
30814  /* function exit code */
30815  __pyx_L1_error:;
30816  __Pyx_XDECREF(__pyx_t_2);
30817  __Pyx_XDECREF(__pyx_t_6);
30818  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30819  __pyx_r = NULL;
30820  __pyx_L0:;
30821  __Pyx_XGIVEREF(__pyx_r);
30822  __Pyx_RefNannyFinishContext();
30823  return __pyx_r;
30824 }
30825 
30826 /* "View.MemoryView":575
30827  *
30828  * @property
30829  * def suboffsets(self): # <<<<<<<<<<<<<<
30830  * if self.view.suboffsets == NULL:
30831  * return (-1,) * self.view.ndim
30832  */
30833 
30834 /* Python wrapper */
30835 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
30836 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
30837  PyObject *__pyx_r = 0;
30838  __Pyx_RefNannyDeclarations
30839  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30840  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
30841 
30842  /* function exit code */
30843  __Pyx_RefNannyFinishContext();
30844  return __pyx_r;
30845 }
30846 
30847 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
30848  Py_ssize_t __pyx_v_suboffset;
30849  PyObject *__pyx_r = NULL;
30850  __Pyx_RefNannyDeclarations
30851  int __pyx_t_1;
30852  PyObject *__pyx_t_2 = NULL;
30853  PyObject *__pyx_t_3 = NULL;
30854  Py_ssize_t *__pyx_t_4;
30855  Py_ssize_t *__pyx_t_5;
30856  Py_ssize_t *__pyx_t_6;
30857  int __pyx_lineno = 0;
30858  const char *__pyx_filename = NULL;
30859  int __pyx_clineno = 0;
30860  __Pyx_RefNannySetupContext("__get__", 0);
30861 
30862  /* "View.MemoryView":576
30863  * @property
30864  * def suboffsets(self):
30865  * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
30866  * return (-1,) * self.view.ndim
30867  *
30868  */
30869  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
30870  if (__pyx_t_1) {
30871 
30872  /* "View.MemoryView":577
30873  * def suboffsets(self):
30874  * if self.view.suboffsets == NULL:
30875  * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
30876  *
30877  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
30878  */
30879  __Pyx_XDECREF(__pyx_r);
30880  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
30881  __Pyx_GOTREF(__pyx_t_2);
30882  __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__20, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
30883  __Pyx_GOTREF(__pyx_t_3);
30884  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30885  __pyx_r = __pyx_t_3;
30886  __pyx_t_3 = 0;
30887  goto __pyx_L0;
30888 
30889  /* "View.MemoryView":576
30890  * @property
30891  * def suboffsets(self):
30892  * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
30893  * return (-1,) * self.view.ndim
30894  *
30895  */
30896  }
30897 
30898  /* "View.MemoryView":579
30899  * return (-1,) * self.view.ndim
30900  *
30901  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
30902  *
30903  * @property
30904  */
30905  __Pyx_XDECREF(__pyx_r);
30906  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
30907  __Pyx_GOTREF(__pyx_t_3);
30908  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
30909  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
30910  __pyx_t_4 = __pyx_t_6;
30911  __pyx_v_suboffset = (__pyx_t_4[0]);
30912  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
30913  __Pyx_GOTREF(__pyx_t_2);
30914  if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
30915  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
30916  }
30917  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
30918  __Pyx_GOTREF(__pyx_t_2);
30919  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
30920  __pyx_r = __pyx_t_2;
30921  __pyx_t_2 = 0;
30922  goto __pyx_L0;
30923 
30924  /* "View.MemoryView":575
30925  *
30926  * @property
30927  * def suboffsets(self): # <<<<<<<<<<<<<<
30928  * if self.view.suboffsets == NULL:
30929  * return (-1,) * self.view.ndim
30930  */
30931 
30932  /* function exit code */
30933  __pyx_L1_error:;
30934  __Pyx_XDECREF(__pyx_t_2);
30935  __Pyx_XDECREF(__pyx_t_3);
30936  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
30937  __pyx_r = NULL;
30938  __pyx_L0:;
30939  __Pyx_XGIVEREF(__pyx_r);
30940  __Pyx_RefNannyFinishContext();
30941  return __pyx_r;
30942 }
30943 
30944 /* "View.MemoryView":582
30945  *
30946  * @property
30947  * def ndim(self): # <<<<<<<<<<<<<<
30948  * return self.view.ndim
30949  *
30950  */
30951 
30952 /* Python wrapper */
30953 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
30954 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
30955  PyObject *__pyx_r = 0;
30956  __Pyx_RefNannyDeclarations
30957  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
30958  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
30959 
30960  /* function exit code */
30961  __Pyx_RefNannyFinishContext();
30962  return __pyx_r;
30963 }
30964 
30965 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
30966  PyObject *__pyx_r = NULL;
30967  __Pyx_RefNannyDeclarations
30968  PyObject *__pyx_t_1 = NULL;
30969  int __pyx_lineno = 0;
30970  const char *__pyx_filename = NULL;
30971  int __pyx_clineno = 0;
30972  __Pyx_RefNannySetupContext("__get__", 0);
30973 
30974  /* "View.MemoryView":583
30975  * @property
30976  * def ndim(self):
30977  * return self.view.ndim # <<<<<<<<<<<<<<
30978  *
30979  * @property
30980  */
30981  __Pyx_XDECREF(__pyx_r);
30982  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
30983  __Pyx_GOTREF(__pyx_t_1);
30984  __pyx_r = __pyx_t_1;
30985  __pyx_t_1 = 0;
30986  goto __pyx_L0;
30987 
30988  /* "View.MemoryView":582
30989  *
30990  * @property
30991  * def ndim(self): # <<<<<<<<<<<<<<
30992  * return self.view.ndim
30993  *
30994  */
30995 
30996  /* function exit code */
30997  __pyx_L1_error:;
30998  __Pyx_XDECREF(__pyx_t_1);
30999  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31000  __pyx_r = NULL;
31001  __pyx_L0:;
31002  __Pyx_XGIVEREF(__pyx_r);
31003  __Pyx_RefNannyFinishContext();
31004  return __pyx_r;
31005 }
31006 
31007 /* "View.MemoryView":586
31008  *
31009  * @property
31010  * def itemsize(self): # <<<<<<<<<<<<<<
31011  * return self.view.itemsize
31012  *
31013  */
31014 
31015 /* Python wrapper */
31016 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
31017 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
31018  PyObject *__pyx_r = 0;
31019  __Pyx_RefNannyDeclarations
31020  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31021  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31022 
31023  /* function exit code */
31024  __Pyx_RefNannyFinishContext();
31025  return __pyx_r;
31026 }
31027 
31028 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31029  PyObject *__pyx_r = NULL;
31030  __Pyx_RefNannyDeclarations
31031  PyObject *__pyx_t_1 = NULL;
31032  int __pyx_lineno = 0;
31033  const char *__pyx_filename = NULL;
31034  int __pyx_clineno = 0;
31035  __Pyx_RefNannySetupContext("__get__", 0);
31036 
31037  /* "View.MemoryView":587
31038  * @property
31039  * def itemsize(self):
31040  * return self.view.itemsize # <<<<<<<<<<<<<<
31041  *
31042  * @property
31043  */
31044  __Pyx_XDECREF(__pyx_r);
31045  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
31046  __Pyx_GOTREF(__pyx_t_1);
31047  __pyx_r = __pyx_t_1;
31048  __pyx_t_1 = 0;
31049  goto __pyx_L0;
31050 
31051  /* "View.MemoryView":586
31052  *
31053  * @property
31054  * def itemsize(self): # <<<<<<<<<<<<<<
31055  * return self.view.itemsize
31056  *
31057  */
31058 
31059  /* function exit code */
31060  __pyx_L1_error:;
31061  __Pyx_XDECREF(__pyx_t_1);
31062  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31063  __pyx_r = NULL;
31064  __pyx_L0:;
31065  __Pyx_XGIVEREF(__pyx_r);
31066  __Pyx_RefNannyFinishContext();
31067  return __pyx_r;
31068 }
31069 
31070 /* "View.MemoryView":590
31071  *
31072  * @property
31073  * def nbytes(self): # <<<<<<<<<<<<<<
31074  * return self.size * self.view.itemsize
31075  *
31076  */
31077 
31078 /* Python wrapper */
31079 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
31080 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
31081  PyObject *__pyx_r = 0;
31082  __Pyx_RefNannyDeclarations
31083  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31084  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31085 
31086  /* function exit code */
31087  __Pyx_RefNannyFinishContext();
31088  return __pyx_r;
31089 }
31090 
31091 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31092  PyObject *__pyx_r = NULL;
31093  __Pyx_RefNannyDeclarations
31094  PyObject *__pyx_t_1 = NULL;
31095  PyObject *__pyx_t_2 = NULL;
31096  PyObject *__pyx_t_3 = NULL;
31097  int __pyx_lineno = 0;
31098  const char *__pyx_filename = NULL;
31099  int __pyx_clineno = 0;
31100  __Pyx_RefNannySetupContext("__get__", 0);
31101 
31102  /* "View.MemoryView":591
31103  * @property
31104  * def nbytes(self):
31105  * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
31106  *
31107  * @property
31108  */
31109  __Pyx_XDECREF(__pyx_r);
31110  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
31111  __Pyx_GOTREF(__pyx_t_1);
31112  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
31113  __Pyx_GOTREF(__pyx_t_2);
31114  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
31115  __Pyx_GOTREF(__pyx_t_3);
31116  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31117  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31118  __pyx_r = __pyx_t_3;
31119  __pyx_t_3 = 0;
31120  goto __pyx_L0;
31121 
31122  /* "View.MemoryView":590
31123  *
31124  * @property
31125  * def nbytes(self): # <<<<<<<<<<<<<<
31126  * return self.size * self.view.itemsize
31127  *
31128  */
31129 
31130  /* function exit code */
31131  __pyx_L1_error:;
31132  __Pyx_XDECREF(__pyx_t_1);
31133  __Pyx_XDECREF(__pyx_t_2);
31134  __Pyx_XDECREF(__pyx_t_3);
31135  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31136  __pyx_r = NULL;
31137  __pyx_L0:;
31138  __Pyx_XGIVEREF(__pyx_r);
31139  __Pyx_RefNannyFinishContext();
31140  return __pyx_r;
31141 }
31142 
31143 /* "View.MemoryView":594
31144  *
31145  * @property
31146  * def size(self): # <<<<<<<<<<<<<<
31147  * if self._size is None:
31148  * result = 1
31149  */
31150 
31151 /* Python wrapper */
31152 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
31153 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
31154  PyObject *__pyx_r = 0;
31155  __Pyx_RefNannyDeclarations
31156  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
31157  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31158 
31159  /* function exit code */
31160  __Pyx_RefNannyFinishContext();
31161  return __pyx_r;
31162 }
31163 
31164 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
31165  PyObject *__pyx_v_result = NULL;
31166  PyObject *__pyx_v_length = NULL;
31167  PyObject *__pyx_r = NULL;
31168  __Pyx_RefNannyDeclarations
31169  int __pyx_t_1;
31170  int __pyx_t_2;
31171  Py_ssize_t *__pyx_t_3;
31172  Py_ssize_t *__pyx_t_4;
31173  Py_ssize_t *__pyx_t_5;
31174  PyObject *__pyx_t_6 = NULL;
31175  int __pyx_lineno = 0;
31176  const char *__pyx_filename = NULL;
31177  int __pyx_clineno = 0;
31178  __Pyx_RefNannySetupContext("__get__", 0);
31179 
31180  /* "View.MemoryView":595
31181  * @property
31182  * def size(self):
31183  * if self._size is None: # <<<<<<<<<<<<<<
31184  * result = 1
31185  *
31186  */
31187  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
31188  __pyx_t_2 = (__pyx_t_1 != 0);
31189  if (__pyx_t_2) {
31190 
31191  /* "View.MemoryView":596
31192  * def size(self):
31193  * if self._size is None:
31194  * result = 1 # <<<<<<<<<<<<<<
31195  *
31196  * for length in self.view.shape[:self.view.ndim]:
31197  */
31198  __Pyx_INCREF(__pyx_int_1);
31199  __pyx_v_result = __pyx_int_1;
31200 
31201  /* "View.MemoryView":598
31202  * result = 1
31203  *
31204  * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
31205  * result *= length
31206  *
31207  */
31208  __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
31209  for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
31210  __pyx_t_3 = __pyx_t_5;
31211  __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
31212  __Pyx_GOTREF(__pyx_t_6);
31213  __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
31214  __pyx_t_6 = 0;
31215 
31216  /* "View.MemoryView":599
31217  *
31218  * for length in self.view.shape[:self.view.ndim]:
31219  * result *= length # <<<<<<<<<<<<<<
31220  *
31221  * self._size = result
31222  */
31223  __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
31224  __Pyx_GOTREF(__pyx_t_6);
31225  __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
31226  __pyx_t_6 = 0;
31227  }
31228 
31229  /* "View.MemoryView":601
31230  * result *= length
31231  *
31232  * self._size = result # <<<<<<<<<<<<<<
31233  *
31234  * return self._size
31235  */
31236  __Pyx_INCREF(__pyx_v_result);
31237  __Pyx_GIVEREF(__pyx_v_result);
31238  __Pyx_GOTREF(__pyx_v_self->_size);
31239  __Pyx_DECREF(__pyx_v_self->_size);
31240  __pyx_v_self->_size = __pyx_v_result;
31241 
31242  /* "View.MemoryView":595
31243  * @property
31244  * def size(self):
31245  * if self._size is None: # <<<<<<<<<<<<<<
31246  * result = 1
31247  *
31248  */
31249  }
31250 
31251  /* "View.MemoryView":603
31252  * self._size = result
31253  *
31254  * return self._size # <<<<<<<<<<<<<<
31255  *
31256  * def __len__(self):
31257  */
31258  __Pyx_XDECREF(__pyx_r);
31259  __Pyx_INCREF(__pyx_v_self->_size);
31260  __pyx_r = __pyx_v_self->_size;
31261  goto __pyx_L0;
31262 
31263  /* "View.MemoryView":594
31264  *
31265  * @property
31266  * def size(self): # <<<<<<<<<<<<<<
31267  * if self._size is None:
31268  * result = 1
31269  */
31270 
31271  /* function exit code */
31272  __pyx_L1_error:;
31273  __Pyx_XDECREF(__pyx_t_6);
31274  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31275  __pyx_r = NULL;
31276  __pyx_L0:;
31277  __Pyx_XDECREF(__pyx_v_result);
31278  __Pyx_XDECREF(__pyx_v_length);
31279  __Pyx_XGIVEREF(__pyx_r);
31280  __Pyx_RefNannyFinishContext();
31281  return __pyx_r;
31282 }
31283 
31284 /* "View.MemoryView":605
31285  * return self._size
31286  *
31287  * def __len__(self): # <<<<<<<<<<<<<<
31288  * if self.view.ndim >= 1:
31289  * return self.view.shape[0]
31290  */
31291 
31292 /* Python wrapper */
31293 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
31294 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
31295  Py_ssize_t __pyx_r;
31296  __Pyx_RefNannyDeclarations
31297  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
31298  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31299 
31300  /* function exit code */
31301  __Pyx_RefNannyFinishContext();
31302  return __pyx_r;
31303 }
31304 
31305 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
31306  Py_ssize_t __pyx_r;
31307  __Pyx_RefNannyDeclarations
31308  int __pyx_t_1;
31309  __Pyx_RefNannySetupContext("__len__", 0);
31310 
31311  /* "View.MemoryView":606
31312  *
31313  * def __len__(self):
31314  * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
31315  * return self.view.shape[0]
31316  *
31317  */
31318  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
31319  if (__pyx_t_1) {
31320 
31321  /* "View.MemoryView":607
31322  * def __len__(self):
31323  * if self.view.ndim >= 1:
31324  * return self.view.shape[0] # <<<<<<<<<<<<<<
31325  *
31326  * return 0
31327  */
31328  __pyx_r = (__pyx_v_self->view.shape[0]);
31329  goto __pyx_L0;
31330 
31331  /* "View.MemoryView":606
31332  *
31333  * def __len__(self):
31334  * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
31335  * return self.view.shape[0]
31336  *
31337  */
31338  }
31339 
31340  /* "View.MemoryView":609
31341  * return self.view.shape[0]
31342  *
31343  * return 0 # <<<<<<<<<<<<<<
31344  *
31345  * def __repr__(self):
31346  */
31347  __pyx_r = 0;
31348  goto __pyx_L0;
31349 
31350  /* "View.MemoryView":605
31351  * return self._size
31352  *
31353  * def __len__(self): # <<<<<<<<<<<<<<
31354  * if self.view.ndim >= 1:
31355  * return self.view.shape[0]
31356  */
31357 
31358  /* function exit code */
31359  __pyx_L0:;
31360  __Pyx_RefNannyFinishContext();
31361  return __pyx_r;
31362 }
31363 
31364 /* "View.MemoryView":611
31365  * return 0
31366  *
31367  * def __repr__(self): # <<<<<<<<<<<<<<
31368  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
31369  * id(self))
31370  */
31371 
31372 /* Python wrapper */
31373 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
31374 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
31375  PyObject *__pyx_r = 0;
31376  __Pyx_RefNannyDeclarations
31377  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
31378  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31379 
31380  /* function exit code */
31381  __Pyx_RefNannyFinishContext();
31382  return __pyx_r;
31383 }
31384 
31385 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
31386  PyObject *__pyx_r = NULL;
31387  __Pyx_RefNannyDeclarations
31388  PyObject *__pyx_t_1 = NULL;
31389  PyObject *__pyx_t_2 = NULL;
31390  PyObject *__pyx_t_3 = NULL;
31391  int __pyx_lineno = 0;
31392  const char *__pyx_filename = NULL;
31393  int __pyx_clineno = 0;
31394  __Pyx_RefNannySetupContext("__repr__", 0);
31395 
31396  /* "View.MemoryView":612
31397  *
31398  * def __repr__(self):
31399  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
31400  * id(self))
31401  *
31402  */
31403  __Pyx_XDECREF(__pyx_r);
31404  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
31405  __Pyx_GOTREF(__pyx_t_1);
31406  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
31407  __Pyx_GOTREF(__pyx_t_2);
31408  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31409  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
31410  __Pyx_GOTREF(__pyx_t_1);
31411  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31412 
31413  /* "View.MemoryView":613
31414  * def __repr__(self):
31415  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
31416  * id(self)) # <<<<<<<<<<<<<<
31417  *
31418  * def __str__(self):
31419  */
31420  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
31421  __Pyx_GOTREF(__pyx_t_2);
31422 
31423  /* "View.MemoryView":612
31424  *
31425  * def __repr__(self):
31426  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
31427  * id(self))
31428  *
31429  */
31430  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
31431  __Pyx_GOTREF(__pyx_t_3);
31432  __Pyx_GIVEREF(__pyx_t_1);
31433  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
31434  __Pyx_GIVEREF(__pyx_t_2);
31435  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
31436  __pyx_t_1 = 0;
31437  __pyx_t_2 = 0;
31438  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
31439  __Pyx_GOTREF(__pyx_t_2);
31440  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
31441  __pyx_r = __pyx_t_2;
31442  __pyx_t_2 = 0;
31443  goto __pyx_L0;
31444 
31445  /* "View.MemoryView":611
31446  * return 0
31447  *
31448  * def __repr__(self): # <<<<<<<<<<<<<<
31449  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
31450  * id(self))
31451  */
31452 
31453  /* function exit code */
31454  __pyx_L1_error:;
31455  __Pyx_XDECREF(__pyx_t_1);
31456  __Pyx_XDECREF(__pyx_t_2);
31457  __Pyx_XDECREF(__pyx_t_3);
31458  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31459  __pyx_r = NULL;
31460  __pyx_L0:;
31461  __Pyx_XGIVEREF(__pyx_r);
31462  __Pyx_RefNannyFinishContext();
31463  return __pyx_r;
31464 }
31465 
31466 /* "View.MemoryView":615
31467  * id(self))
31468  *
31469  * def __str__(self): # <<<<<<<<<<<<<<
31470  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
31471  *
31472  */
31473 
31474 /* Python wrapper */
31475 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
31476 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
31477  PyObject *__pyx_r = 0;
31478  __Pyx_RefNannyDeclarations
31479  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
31480  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31481 
31482  /* function exit code */
31483  __Pyx_RefNannyFinishContext();
31484  return __pyx_r;
31485 }
31486 
31487 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
31488  PyObject *__pyx_r = NULL;
31489  __Pyx_RefNannyDeclarations
31490  PyObject *__pyx_t_1 = NULL;
31491  PyObject *__pyx_t_2 = NULL;
31492  int __pyx_lineno = 0;
31493  const char *__pyx_filename = NULL;
31494  int __pyx_clineno = 0;
31495  __Pyx_RefNannySetupContext("__str__", 0);
31496 
31497  /* "View.MemoryView":616
31498  *
31499  * def __str__(self):
31500  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
31501  *
31502  *
31503  */
31504  __Pyx_XDECREF(__pyx_r);
31505  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
31506  __Pyx_GOTREF(__pyx_t_1);
31507  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
31508  __Pyx_GOTREF(__pyx_t_2);
31509  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31510  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
31511  __Pyx_GOTREF(__pyx_t_1);
31512  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31513  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
31514  __Pyx_GOTREF(__pyx_t_2);
31515  __Pyx_GIVEREF(__pyx_t_1);
31516  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
31517  __pyx_t_1 = 0;
31518  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
31519  __Pyx_GOTREF(__pyx_t_1);
31520  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
31521  __pyx_r = __pyx_t_1;
31522  __pyx_t_1 = 0;
31523  goto __pyx_L0;
31524 
31525  /* "View.MemoryView":615
31526  * id(self))
31527  *
31528  * def __str__(self): # <<<<<<<<<<<<<<
31529  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
31530  *
31531  */
31532 
31533  /* function exit code */
31534  __pyx_L1_error:;
31535  __Pyx_XDECREF(__pyx_t_1);
31536  __Pyx_XDECREF(__pyx_t_2);
31537  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31538  __pyx_r = NULL;
31539  __pyx_L0:;
31540  __Pyx_XGIVEREF(__pyx_r);
31541  __Pyx_RefNannyFinishContext();
31542  return __pyx_r;
31543 }
31544 
31545 /* "View.MemoryView":619
31546  *
31547  *
31548  * def is_c_contig(self): # <<<<<<<<<<<<<<
31549  * cdef __Pyx_memviewslice *mslice
31550  * cdef __Pyx_memviewslice tmp
31551  */
31552 
31553 /* Python wrapper */
31554 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
31555 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
31556  PyObject *__pyx_r = 0;
31557  __Pyx_RefNannyDeclarations
31558  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
31559  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
31560 
31561  /* function exit code */
31562  __Pyx_RefNannyFinishContext();
31563  return __pyx_r;
31564 }
31565 
31566 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
31567  __Pyx_memviewslice *__pyx_v_mslice;
31568  __Pyx_memviewslice __pyx_v_tmp;
31569  PyObject *__pyx_r = NULL;
31570  __Pyx_RefNannyDeclarations
31571  __Pyx_memviewslice *__pyx_t_1;
31572  PyObject *__pyx_t_2 = NULL;
31573  int __pyx_lineno = 0;
31574  const char *__pyx_filename = NULL;
31575  int __pyx_clineno = 0;
31576  __Pyx_RefNannySetupContext("is_c_contig", 0);
31577 
31578  /* "View.MemoryView":622
31579  * cdef __Pyx_memviewslice *mslice
31580  * cdef __Pyx_memviewslice tmp
31581  * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
31582  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
31583  *
31584  */
31585  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 622, __pyx_L1_error)
31586  __pyx_v_mslice = __pyx_t_1;
31587 
31588  /* "View.MemoryView":623
31589  * cdef __Pyx_memviewslice tmp
31590  * mslice = get_slice_from_memview(self, &tmp)
31591  * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
31592  *
31593  * def is_f_contig(self):
31594  */
31595  __Pyx_XDECREF(__pyx_r);
31596  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 623, __pyx_L1_error)
31597  __Pyx_GOTREF(__pyx_t_2);
31598  __pyx_r = __pyx_t_2;
31599  __pyx_t_2 = 0;
31600  goto __pyx_L0;
31601 
31602  /* "View.MemoryView":619
31603  *
31604  *
31605  * def is_c_contig(self): # <<<<<<<<<<<<<<
31606  * cdef __Pyx_memviewslice *mslice
31607  * cdef __Pyx_memviewslice tmp
31608  */
31609 
31610  /* function exit code */
31611  __pyx_L1_error:;
31612  __Pyx_XDECREF(__pyx_t_2);
31613  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
31614  __pyx_r = NULL;
31615  __pyx_L0:;
31616  __Pyx_XGIVEREF(__pyx_r);
31617  __Pyx_RefNannyFinishContext();
31618  return __pyx_r;
31619 }
31620 
31621 /* "View.MemoryView":625
31622  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
31623  *
31624  * def is_f_contig(self): # <<<<<<<<<<<<<<
31625  * cdef __Pyx_memviewslice *mslice
31626  * cdef __Pyx_memviewslice tmp
31627  */
31628 
31629 /* Python wrapper */
31630 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
31631 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
31632  PyObject *__pyx_r = 0;
31633  __Pyx_RefNannyDeclarations
31634  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
31635  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
31636 
31637  /* function exit code */
31638  __Pyx_RefNannyFinishContext();
31639  return __pyx_r;
31640 }
31641 
31642 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
31643  __Pyx_memviewslice *__pyx_v_mslice;
31644  __Pyx_memviewslice __pyx_v_tmp;
31645  PyObject *__pyx_r = NULL;
31646  __Pyx_RefNannyDeclarations
31647  __Pyx_memviewslice *__pyx_t_1;
31648  PyObject *__pyx_t_2 = NULL;
31649  int __pyx_lineno = 0;
31650  const char *__pyx_filename = NULL;
31651  int __pyx_clineno = 0;
31652  __Pyx_RefNannySetupContext("is_f_contig", 0);
31653 
31654  /* "View.MemoryView":628
31655  * cdef __Pyx_memviewslice *mslice
31656  * cdef __Pyx_memviewslice tmp
31657  * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
31658  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
31659  *
31660  */
31661  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 628, __pyx_L1_error)
31662  __pyx_v_mslice = __pyx_t_1;
31663 
31664  /* "View.MemoryView":629
31665  * cdef __Pyx_memviewslice tmp
31666  * mslice = get_slice_from_memview(self, &tmp)
31667  * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
31668  *
31669  * def copy(self):
31670  */
31671  __Pyx_XDECREF(__pyx_r);
31672  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
31673  __Pyx_GOTREF(__pyx_t_2);
31674  __pyx_r = __pyx_t_2;
31675  __pyx_t_2 = 0;
31676  goto __pyx_L0;
31677 
31678  /* "View.MemoryView":625
31679  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
31680  *
31681  * def is_f_contig(self): # <<<<<<<<<<<<<<
31682  * cdef __Pyx_memviewslice *mslice
31683  * cdef __Pyx_memviewslice tmp
31684  */
31685 
31686  /* function exit code */
31687  __pyx_L1_error:;
31688  __Pyx_XDECREF(__pyx_t_2);
31689  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
31690  __pyx_r = NULL;
31691  __pyx_L0:;
31692  __Pyx_XGIVEREF(__pyx_r);
31693  __Pyx_RefNannyFinishContext();
31694  return __pyx_r;
31695 }
31696 
31697 /* "View.MemoryView":631
31698  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
31699  *
31700  * def copy(self): # <<<<<<<<<<<<<<
31701  * cdef __Pyx_memviewslice mslice
31702  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
31703  */
31704 
31705 /* Python wrapper */
31706 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
31707 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
31708  PyObject *__pyx_r = 0;
31709  __Pyx_RefNannyDeclarations
31710  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
31711  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
31712 
31713  /* function exit code */
31714  __Pyx_RefNannyFinishContext();
31715  return __pyx_r;
31716 }
31717 
31718 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
31719  __Pyx_memviewslice __pyx_v_mslice;
31720  int __pyx_v_flags;
31721  PyObject *__pyx_r = NULL;
31722  __Pyx_RefNannyDeclarations
31723  __Pyx_memviewslice __pyx_t_1;
31724  PyObject *__pyx_t_2 = NULL;
31725  int __pyx_lineno = 0;
31726  const char *__pyx_filename = NULL;
31727  int __pyx_clineno = 0;
31728  __Pyx_RefNannySetupContext("copy", 0);
31729 
31730  /* "View.MemoryView":633
31731  * def copy(self):
31732  * cdef __Pyx_memviewslice mslice
31733  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
31734  *
31735  * slice_copy(self, &mslice)
31736  */
31737  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
31738 
31739  /* "View.MemoryView":635
31740  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
31741  *
31742  * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
31743  * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
31744  * self.view.itemsize,
31745  */
31746  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
31747 
31748  /* "View.MemoryView":636
31749  *
31750  * slice_copy(self, &mslice)
31751  * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
31752  * self.view.itemsize,
31753  * flags|PyBUF_C_CONTIGUOUS,
31754  */
31755  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error)
31756  __pyx_v_mslice = __pyx_t_1;
31757 
31758  /* "View.MemoryView":641
31759  * self.dtype_is_object)
31760  *
31761  * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
31762  *
31763  * def copy_fortran(self):
31764  */
31765  __Pyx_XDECREF(__pyx_r);
31766  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
31767  __Pyx_GOTREF(__pyx_t_2);
31768  __pyx_r = __pyx_t_2;
31769  __pyx_t_2 = 0;
31770  goto __pyx_L0;
31771 
31772  /* "View.MemoryView":631
31773  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
31774  *
31775  * def copy(self): # <<<<<<<<<<<<<<
31776  * cdef __Pyx_memviewslice mslice
31777  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
31778  */
31779 
31780  /* function exit code */
31781  __pyx_L1_error:;
31782  __Pyx_XDECREF(__pyx_t_2);
31783  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
31784  __pyx_r = NULL;
31785  __pyx_L0:;
31786  __Pyx_XGIVEREF(__pyx_r);
31787  __Pyx_RefNannyFinishContext();
31788  return __pyx_r;
31789 }
31790 
31791 /* "View.MemoryView":643
31792  * return memoryview_copy_from_slice(self, &mslice)
31793  *
31794  * def copy_fortran(self): # <<<<<<<<<<<<<<
31795  * cdef __Pyx_memviewslice src, dst
31796  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
31797  */
31798 
31799 /* Python wrapper */
31800 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
31801 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
31802  PyObject *__pyx_r = 0;
31803  __Pyx_RefNannyDeclarations
31804  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
31805  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
31806 
31807  /* function exit code */
31808  __Pyx_RefNannyFinishContext();
31809  return __pyx_r;
31810 }
31811 
31812 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
31813  __Pyx_memviewslice __pyx_v_src;
31814  __Pyx_memviewslice __pyx_v_dst;
31815  int __pyx_v_flags;
31816  PyObject *__pyx_r = NULL;
31817  __Pyx_RefNannyDeclarations
31818  __Pyx_memviewslice __pyx_t_1;
31819  PyObject *__pyx_t_2 = NULL;
31820  int __pyx_lineno = 0;
31821  const char *__pyx_filename = NULL;
31822  int __pyx_clineno = 0;
31823  __Pyx_RefNannySetupContext("copy_fortran", 0);
31824 
31825  /* "View.MemoryView":645
31826  * def copy_fortran(self):
31827  * cdef __Pyx_memviewslice src, dst
31828  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
31829  *
31830  * slice_copy(self, &src)
31831  */
31832  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
31833 
31834  /* "View.MemoryView":647
31835  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
31836  *
31837  * slice_copy(self, &src) # <<<<<<<<<<<<<<
31838  * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
31839  * self.view.itemsize,
31840  */
31841  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
31842 
31843  /* "View.MemoryView":648
31844  *
31845  * slice_copy(self, &src)
31846  * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
31847  * self.view.itemsize,
31848  * flags|PyBUF_F_CONTIGUOUS,
31849  */
31850  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error)
31851  __pyx_v_dst = __pyx_t_1;
31852 
31853  /* "View.MemoryView":653
31854  * self.dtype_is_object)
31855  *
31856  * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
31857  *
31858  *
31859  */
31860  __Pyx_XDECREF(__pyx_r);
31861  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
31862  __Pyx_GOTREF(__pyx_t_2);
31863  __pyx_r = __pyx_t_2;
31864  __pyx_t_2 = 0;
31865  goto __pyx_L0;
31866 
31867  /* "View.MemoryView":643
31868  * return memoryview_copy_from_slice(self, &mslice)
31869  *
31870  * def copy_fortran(self): # <<<<<<<<<<<<<<
31871  * cdef __Pyx_memviewslice src, dst
31872  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
31873  */
31874 
31875  /* function exit code */
31876  __pyx_L1_error:;
31877  __Pyx_XDECREF(__pyx_t_2);
31878  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
31879  __pyx_r = NULL;
31880  __pyx_L0:;
31881  __Pyx_XGIVEREF(__pyx_r);
31882  __Pyx_RefNannyFinishContext();
31883  return __pyx_r;
31884 }
31885 
31886 /* "(tree fragment)":1
31887  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
31888  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31889  * def __setstate_cython__(self, __pyx_state):
31890  */
31891 
31892 /* Python wrapper */
31893 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
31894 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
31895  PyObject *__pyx_r = 0;
31896  __Pyx_RefNannyDeclarations
31897  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
31898  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
31899 
31900  /* function exit code */
31901  __Pyx_RefNannyFinishContext();
31902  return __pyx_r;
31903 }
31904 
31905 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
31906  PyObject *__pyx_r = NULL;
31907  __Pyx_RefNannyDeclarations
31908  PyObject *__pyx_t_1 = NULL;
31909  int __pyx_lineno = 0;
31910  const char *__pyx_filename = NULL;
31911  int __pyx_clineno = 0;
31912  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
31913 
31914  /* "(tree fragment)":2
31915  * def __reduce_cython__(self):
31916  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
31917  * def __setstate_cython__(self, __pyx_state):
31918  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31919  */
31920  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
31921  __Pyx_GOTREF(__pyx_t_1);
31922  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
31923  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31924  __PYX_ERR(2, 2, __pyx_L1_error)
31925 
31926  /* "(tree fragment)":1
31927  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
31928  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31929  * def __setstate_cython__(self, __pyx_state):
31930  */
31931 
31932  /* function exit code */
31933  __pyx_L1_error:;
31934  __Pyx_XDECREF(__pyx_t_1);
31935  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31936  __pyx_r = NULL;
31937  __Pyx_XGIVEREF(__pyx_r);
31938  __Pyx_RefNannyFinishContext();
31939  return __pyx_r;
31940 }
31941 
31942 /* "(tree fragment)":3
31943  * def __reduce_cython__(self):
31944  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31945  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
31946  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31947  */
31948 
31949 /* Python wrapper */
31950 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
31951 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
31952  PyObject *__pyx_r = 0;
31953  __Pyx_RefNannyDeclarations
31954  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
31955  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
31956 
31957  /* function exit code */
31958  __Pyx_RefNannyFinishContext();
31959  return __pyx_r;
31960 }
31961 
31962 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
31963  PyObject *__pyx_r = NULL;
31964  __Pyx_RefNannyDeclarations
31965  PyObject *__pyx_t_1 = NULL;
31966  int __pyx_lineno = 0;
31967  const char *__pyx_filename = NULL;
31968  int __pyx_clineno = 0;
31969  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
31970 
31971  /* "(tree fragment)":4
31972  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31973  * def __setstate_cython__(self, __pyx_state):
31974  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
31975  */
31976  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
31977  __Pyx_GOTREF(__pyx_t_1);
31978  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
31979  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
31980  __PYX_ERR(2, 4, __pyx_L1_error)
31981 
31982  /* "(tree fragment)":3
31983  * def __reduce_cython__(self):
31984  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31985  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
31986  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
31987  */
31988 
31989  /* function exit code */
31990  __pyx_L1_error:;
31991  __Pyx_XDECREF(__pyx_t_1);
31992  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
31993  __pyx_r = NULL;
31994  __Pyx_XGIVEREF(__pyx_r);
31995  __Pyx_RefNannyFinishContext();
31996  return __pyx_r;
31997 }
31998 
31999 /* "View.MemoryView":657
32000  *
32001  * @cname('__pyx_memoryview_new')
32002  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
32003  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
32004  * result.typeinfo = typeinfo
32005  */
32006 
32007 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
32008  struct __pyx_memoryview_obj *__pyx_v_result = 0;
32009  PyObject *__pyx_r = NULL;
32010  __Pyx_RefNannyDeclarations
32011  PyObject *__pyx_t_1 = NULL;
32012  PyObject *__pyx_t_2 = NULL;
32013  PyObject *__pyx_t_3 = NULL;
32014  int __pyx_lineno = 0;
32015  const char *__pyx_filename = NULL;
32016  int __pyx_clineno = 0;
32017  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
32018 
32019  /* "View.MemoryView":658
32020  * @cname('__pyx_memoryview_new')
32021  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
32022  * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
32023  * result.typeinfo = typeinfo
32024  * return result
32025  */
32026  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
32027  __Pyx_GOTREF(__pyx_t_1);
32028  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
32029  __Pyx_GOTREF(__pyx_t_2);
32030  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
32031  __Pyx_GOTREF(__pyx_t_3);
32032  __Pyx_INCREF(__pyx_v_o);
32033  __Pyx_GIVEREF(__pyx_v_o);
32034  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
32035  __Pyx_GIVEREF(__pyx_t_1);
32036  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
32037  __Pyx_GIVEREF(__pyx_t_2);
32038  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
32039  __pyx_t_1 = 0;
32040  __pyx_t_2 = 0;
32041  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
32042  __Pyx_GOTREF(__pyx_t_2);
32043  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32044  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
32045  __pyx_t_2 = 0;
32046 
32047  /* "View.MemoryView":659
32048  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
32049  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
32050  * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
32051  * return result
32052  *
32053  */
32054  __pyx_v_result->typeinfo = __pyx_v_typeinfo;
32055 
32056  /* "View.MemoryView":660
32057  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
32058  * result.typeinfo = typeinfo
32059  * return result # <<<<<<<<<<<<<<
32060  *
32061  * @cname('__pyx_memoryview_check')
32062  */
32063  __Pyx_XDECREF(__pyx_r);
32064  __Pyx_INCREF(((PyObject *)__pyx_v_result));
32065  __pyx_r = ((PyObject *)__pyx_v_result);
32066  goto __pyx_L0;
32067 
32068  /* "View.MemoryView":657
32069  *
32070  * @cname('__pyx_memoryview_new')
32071  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
32072  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
32073  * result.typeinfo = typeinfo
32074  */
32075 
32076  /* function exit code */
32077  __pyx_L1_error:;
32078  __Pyx_XDECREF(__pyx_t_1);
32079  __Pyx_XDECREF(__pyx_t_2);
32080  __Pyx_XDECREF(__pyx_t_3);
32081  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
32082  __pyx_r = 0;
32083  __pyx_L0:;
32084  __Pyx_XDECREF((PyObject *)__pyx_v_result);
32085  __Pyx_XGIVEREF(__pyx_r);
32086  __Pyx_RefNannyFinishContext();
32087  return __pyx_r;
32088 }
32089 
32090 /* "View.MemoryView":663
32091  *
32092  * @cname('__pyx_memoryview_check')
32093  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
32094  * return isinstance(o, memoryview)
32095  *
32096  */
32097 
32098 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
32099  int __pyx_r;
32100  __Pyx_RefNannyDeclarations
32101  int __pyx_t_1;
32102  __Pyx_RefNannySetupContext("memoryview_check", 0);
32103 
32104  /* "View.MemoryView":664
32105  * @cname('__pyx_memoryview_check')
32106  * cdef inline bint memoryview_check(object o):
32107  * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
32108  *
32109  * cdef tuple _unellipsify(object index, int ndim):
32110  */
32111  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
32112  __pyx_r = __pyx_t_1;
32113  goto __pyx_L0;
32114 
32115  /* "View.MemoryView":663
32116  *
32117  * @cname('__pyx_memoryview_check')
32118  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
32119  * return isinstance(o, memoryview)
32120  *
32121  */
32122 
32123  /* function exit code */
32124  __pyx_L0:;
32125  __Pyx_RefNannyFinishContext();
32126  return __pyx_r;
32127 }
32128 
32129 /* "View.MemoryView":666
32130  * return isinstance(o, memoryview)
32131  *
32132  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
32133  * """
32134  * Replace all ellipses with full slices and fill incomplete indices with
32135  */
32136 
32137 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
32138  PyObject *__pyx_v_tup = NULL;
32139  PyObject *__pyx_v_result = NULL;
32140  int __pyx_v_have_slices;
32141  int __pyx_v_seen_ellipsis;
32142  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
32143  PyObject *__pyx_v_item = NULL;
32144  Py_ssize_t __pyx_v_nslices;
32145  PyObject *__pyx_r = NULL;
32146  __Pyx_RefNannyDeclarations
32147  int __pyx_t_1;
32148  int __pyx_t_2;
32149  PyObject *__pyx_t_3 = NULL;
32150  PyObject *__pyx_t_4 = NULL;
32151  Py_ssize_t __pyx_t_5;
32152  PyObject *(*__pyx_t_6)(PyObject *);
32153  PyObject *__pyx_t_7 = NULL;
32154  Py_ssize_t __pyx_t_8;
32155  int __pyx_t_9;
32156  int __pyx_t_10;
32157  PyObject *__pyx_t_11 = NULL;
32158  int __pyx_lineno = 0;
32159  const char *__pyx_filename = NULL;
32160  int __pyx_clineno = 0;
32161  __Pyx_RefNannySetupContext("_unellipsify", 0);
32162 
32163  /* "View.MemoryView":671
32164  * full slices.
32165  * """
32166  * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
32167  * tup = (index,)
32168  * else:
32169  */
32170  __pyx_t_1 = PyTuple_Check(__pyx_v_index);
32171  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
32172  if (__pyx_t_2) {
32173 
32174  /* "View.MemoryView":672
32175  * """
32176  * if not isinstance(index, tuple):
32177  * tup = (index,) # <<<<<<<<<<<<<<
32178  * else:
32179  * tup = index
32180  */
32181  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
32182  __Pyx_GOTREF(__pyx_t_3);
32183  __Pyx_INCREF(__pyx_v_index);
32184  __Pyx_GIVEREF(__pyx_v_index);
32185  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
32186  __pyx_v_tup = __pyx_t_3;
32187  __pyx_t_3 = 0;
32188 
32189  /* "View.MemoryView":671
32190  * full slices.
32191  * """
32192  * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
32193  * tup = (index,)
32194  * else:
32195  */
32196  goto __pyx_L3;
32197  }
32198 
32199  /* "View.MemoryView":674
32200  * tup = (index,)
32201  * else:
32202  * tup = index # <<<<<<<<<<<<<<
32203  *
32204  * result = []
32205  */
32206  /*else*/ {
32207  __Pyx_INCREF(__pyx_v_index);
32208  __pyx_v_tup = __pyx_v_index;
32209  }
32210  __pyx_L3:;
32211 
32212  /* "View.MemoryView":676
32213  * tup = index
32214  *
32215  * result = [] # <<<<<<<<<<<<<<
32216  * have_slices = False
32217  * seen_ellipsis = False
32218  */
32219  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
32220  __Pyx_GOTREF(__pyx_t_3);
32221  __pyx_v_result = ((PyObject*)__pyx_t_3);
32222  __pyx_t_3 = 0;
32223 
32224  /* "View.MemoryView":677
32225  *
32226  * result = []
32227  * have_slices = False # <<<<<<<<<<<<<<
32228  * seen_ellipsis = False
32229  * for idx, item in enumerate(tup):
32230  */
32231  __pyx_v_have_slices = 0;
32232 
32233  /* "View.MemoryView":678
32234  * result = []
32235  * have_slices = False
32236  * seen_ellipsis = False # <<<<<<<<<<<<<<
32237  * for idx, item in enumerate(tup):
32238  * if item is Ellipsis:
32239  */
32240  __pyx_v_seen_ellipsis = 0;
32241 
32242  /* "View.MemoryView":679
32243  * have_slices = False
32244  * seen_ellipsis = False
32245  * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
32246  * if item is Ellipsis:
32247  * if not seen_ellipsis:
32248  */
32249  __Pyx_INCREF(__pyx_int_0);
32250  __pyx_t_3 = __pyx_int_0;
32251  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
32252  __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
32253  __pyx_t_6 = NULL;
32254  } else {
32255  __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
32256  __Pyx_GOTREF(__pyx_t_4);
32257  __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
32258  }
32259  for (;;) {
32260  if (likely(!__pyx_t_6)) {
32261  if (likely(PyList_CheckExact(__pyx_t_4))) {
32262  if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
32263  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
32264  __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
32265  #else
32266  __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
32267  __Pyx_GOTREF(__pyx_t_7);
32268  #endif
32269  } else {
32270  if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
32271  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
32272  __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error)
32273  #else
32274  __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
32275  __Pyx_GOTREF(__pyx_t_7);
32276  #endif
32277  }
32278  } else {
32279  __pyx_t_7 = __pyx_t_6(__pyx_t_4);
32280  if (unlikely(!__pyx_t_7)) {
32281  PyObject* exc_type = PyErr_Occurred();
32282  if (exc_type) {
32283  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
32284  else __PYX_ERR(2, 679, __pyx_L1_error)
32285  }
32286  break;
32287  }
32288  __Pyx_GOTREF(__pyx_t_7);
32289  }
32290  __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
32291  __pyx_t_7 = 0;
32292  __Pyx_INCREF(__pyx_t_3);
32293  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
32294  __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
32295  __Pyx_GOTREF(__pyx_t_7);
32296  __Pyx_DECREF(__pyx_t_3);
32297  __pyx_t_3 = __pyx_t_7;
32298  __pyx_t_7 = 0;
32299 
32300  /* "View.MemoryView":680
32301  * seen_ellipsis = False
32302  * for idx, item in enumerate(tup):
32303  * if item is Ellipsis: # <<<<<<<<<<<<<<
32304  * if not seen_ellipsis:
32305  * result.extend([slice(None)] * (ndim - len(tup) + 1))
32306  */
32307  __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
32308  __pyx_t_1 = (__pyx_t_2 != 0);
32309  if (__pyx_t_1) {
32310 
32311  /* "View.MemoryView":681
32312  * for idx, item in enumerate(tup):
32313  * if item is Ellipsis:
32314  * if not seen_ellipsis: # <<<<<<<<<<<<<<
32315  * result.extend([slice(None)] * (ndim - len(tup) + 1))
32316  * seen_ellipsis = True
32317  */
32318  __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
32319  if (__pyx_t_1) {
32320 
32321  /* "View.MemoryView":682
32322  * if item is Ellipsis:
32323  * if not seen_ellipsis:
32324  * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
32325  * seen_ellipsis = True
32326  * else:
32327  */
32328  __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
32329  __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error)
32330  __Pyx_GOTREF(__pyx_t_7);
32331  { Py_ssize_t __pyx_temp;
32332  for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
32333  __Pyx_INCREF(__pyx_slice__4);
32334  __Pyx_GIVEREF(__pyx_slice__4);
32335  PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__4);
32336  }
32337  }
32338  __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
32339  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
32340 
32341  /* "View.MemoryView":683
32342  * if not seen_ellipsis:
32343  * result.extend([slice(None)] * (ndim - len(tup) + 1))
32344  * seen_ellipsis = True # <<<<<<<<<<<<<<
32345  * else:
32346  * result.append(slice(None))
32347  */
32348  __pyx_v_seen_ellipsis = 1;
32349 
32350  /* "View.MemoryView":681
32351  * for idx, item in enumerate(tup):
32352  * if item is Ellipsis:
32353  * if not seen_ellipsis: # <<<<<<<<<<<<<<
32354  * result.extend([slice(None)] * (ndim - len(tup) + 1))
32355  * seen_ellipsis = True
32356  */
32357  goto __pyx_L7;
32358  }
32359 
32360  /* "View.MemoryView":685
32361  * seen_ellipsis = True
32362  * else:
32363  * result.append(slice(None)) # <<<<<<<<<<<<<<
32364  * have_slices = True
32365  * else:
32366  */
32367  /*else*/ {
32368  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__4); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
32369  }
32370  __pyx_L7:;
32371 
32372  /* "View.MemoryView":686
32373  * else:
32374  * result.append(slice(None))
32375  * have_slices = True # <<<<<<<<<<<<<<
32376  * else:
32377  * if not isinstance(item, slice) and not PyIndex_Check(item):
32378  */
32379  __pyx_v_have_slices = 1;
32380 
32381  /* "View.MemoryView":680
32382  * seen_ellipsis = False
32383  * for idx, item in enumerate(tup):
32384  * if item is Ellipsis: # <<<<<<<<<<<<<<
32385  * if not seen_ellipsis:
32386  * result.extend([slice(None)] * (ndim - len(tup) + 1))
32387  */
32388  goto __pyx_L6;
32389  }
32390 
32391  /* "View.MemoryView":688
32392  * have_slices = True
32393  * else:
32394  * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
32395  * raise TypeError("Cannot index with type '%s'" % type(item))
32396  *
32397  */
32398  /*else*/ {
32399  __pyx_t_2 = PySlice_Check(__pyx_v_item);
32400  __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
32401  if (__pyx_t_10) {
32402  } else {
32403  __pyx_t_1 = __pyx_t_10;
32404  goto __pyx_L9_bool_binop_done;
32405  }
32406  __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
32407  __pyx_t_1 = __pyx_t_10;
32408  __pyx_L9_bool_binop_done:;
32409  if (unlikely(__pyx_t_1)) {
32410 
32411  /* "View.MemoryView":689
32412  * else:
32413  * if not isinstance(item, slice) and not PyIndex_Check(item):
32414  * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
32415  *
32416  * have_slices = have_slices or isinstance(item, slice)
32417  */
32418  __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error)
32419  __Pyx_GOTREF(__pyx_t_7);
32420  __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
32421  __Pyx_GOTREF(__pyx_t_11);
32422  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
32423  __Pyx_Raise(__pyx_t_11, 0, 0, 0);
32424  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
32425  __PYX_ERR(2, 689, __pyx_L1_error)
32426 
32427  /* "View.MemoryView":688
32428  * have_slices = True
32429  * else:
32430  * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
32431  * raise TypeError("Cannot index with type '%s'" % type(item))
32432  *
32433  */
32434  }
32435 
32436  /* "View.MemoryView":691
32437  * raise TypeError("Cannot index with type '%s'" % type(item))
32438  *
32439  * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
32440  * result.append(item)
32441  *
32442  */
32443  __pyx_t_10 = (__pyx_v_have_slices != 0);
32444  if (!__pyx_t_10) {
32445  } else {
32446  __pyx_t_1 = __pyx_t_10;
32447  goto __pyx_L11_bool_binop_done;
32448  }
32449  __pyx_t_10 = PySlice_Check(__pyx_v_item);
32450  __pyx_t_2 = (__pyx_t_10 != 0);
32451  __pyx_t_1 = __pyx_t_2;
32452  __pyx_L11_bool_binop_done:;
32453  __pyx_v_have_slices = __pyx_t_1;
32454 
32455  /* "View.MemoryView":692
32456  *
32457  * have_slices = have_slices or isinstance(item, slice)
32458  * result.append(item) # <<<<<<<<<<<<<<
32459  *
32460  * nslices = ndim - len(result)
32461  */
32462  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
32463  }
32464  __pyx_L6:;
32465 
32466  /* "View.MemoryView":679
32467  * have_slices = False
32468  * seen_ellipsis = False
32469  * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
32470  * if item is Ellipsis:
32471  * if not seen_ellipsis:
32472  */
32473  }
32474  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
32475  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32476 
32477  /* "View.MemoryView":694
32478  * result.append(item)
32479  *
32480  * nslices = ndim - len(result) # <<<<<<<<<<<<<<
32481  * if nslices:
32482  * result.extend([slice(None)] * nslices)
32483  */
32484  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
32485  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
32486 
32487  /* "View.MemoryView":695
32488  *
32489  * nslices = ndim - len(result)
32490  * if nslices: # <<<<<<<<<<<<<<
32491  * result.extend([slice(None)] * nslices)
32492  *
32493  */
32494  __pyx_t_1 = (__pyx_v_nslices != 0);
32495  if (__pyx_t_1) {
32496 
32497  /* "View.MemoryView":696
32498  * nslices = ndim - len(result)
32499  * if nslices:
32500  * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
32501  *
32502  * return have_slices or nslices, tuple(result)
32503  */
32504  __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
32505  __Pyx_GOTREF(__pyx_t_3);
32506  { Py_ssize_t __pyx_temp;
32507  for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
32508  __Pyx_INCREF(__pyx_slice__4);
32509  __Pyx_GIVEREF(__pyx_slice__4);
32510  PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__4);
32511  }
32512  }
32513  __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
32514  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
32515 
32516  /* "View.MemoryView":695
32517  *
32518  * nslices = ndim - len(result)
32519  * if nslices: # <<<<<<<<<<<<<<
32520  * result.extend([slice(None)] * nslices)
32521  *
32522  */
32523  }
32524 
32525  /* "View.MemoryView":698
32526  * result.extend([slice(None)] * nslices)
32527  *
32528  * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
32529  *
32530  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
32531  */
32532  __Pyx_XDECREF(__pyx_r);
32533  if (!__pyx_v_have_slices) {
32534  } else {
32535  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
32536  __Pyx_GOTREF(__pyx_t_4);
32537  __pyx_t_3 = __pyx_t_4;
32538  __pyx_t_4 = 0;
32539  goto __pyx_L14_bool_binop_done;
32540  }
32541  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
32542  __Pyx_GOTREF(__pyx_t_4);
32543  __pyx_t_3 = __pyx_t_4;
32544  __pyx_t_4 = 0;
32545  __pyx_L14_bool_binop_done:;
32546  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
32547  __Pyx_GOTREF(__pyx_t_4);
32548  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
32549  __Pyx_GOTREF(__pyx_t_11);
32550  __Pyx_GIVEREF(__pyx_t_3);
32551  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
32552  __Pyx_GIVEREF(__pyx_t_4);
32553  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
32554  __pyx_t_3 = 0;
32555  __pyx_t_4 = 0;
32556  __pyx_r = ((PyObject*)__pyx_t_11);
32557  __pyx_t_11 = 0;
32558  goto __pyx_L0;
32559 
32560  /* "View.MemoryView":666
32561  * return isinstance(o, memoryview)
32562  *
32563  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
32564  * """
32565  * Replace all ellipses with full slices and fill incomplete indices with
32566  */
32567 
32568  /* function exit code */
32569  __pyx_L1_error:;
32570  __Pyx_XDECREF(__pyx_t_3);
32571  __Pyx_XDECREF(__pyx_t_4);
32572  __Pyx_XDECREF(__pyx_t_7);
32573  __Pyx_XDECREF(__pyx_t_11);
32574  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
32575  __pyx_r = 0;
32576  __pyx_L0:;
32577  __Pyx_XDECREF(__pyx_v_tup);
32578  __Pyx_XDECREF(__pyx_v_result);
32579  __Pyx_XDECREF(__pyx_v_idx);
32580  __Pyx_XDECREF(__pyx_v_item);
32581  __Pyx_XGIVEREF(__pyx_r);
32582  __Pyx_RefNannyFinishContext();
32583  return __pyx_r;
32584 }
32585 
32586 /* "View.MemoryView":700
32587  * return have_slices or nslices, tuple(result)
32588  *
32589  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
32590  * for suboffset in suboffsets[:ndim]:
32591  * if suboffset >= 0:
32592  */
32593 
32594 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
32595  Py_ssize_t __pyx_v_suboffset;
32596  PyObject *__pyx_r = NULL;
32597  __Pyx_RefNannyDeclarations
32598  Py_ssize_t *__pyx_t_1;
32599  Py_ssize_t *__pyx_t_2;
32600  Py_ssize_t *__pyx_t_3;
32601  int __pyx_t_4;
32602  PyObject *__pyx_t_5 = NULL;
32603  int __pyx_lineno = 0;
32604  const char *__pyx_filename = NULL;
32605  int __pyx_clineno = 0;
32606  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
32607 
32608  /* "View.MemoryView":701
32609  *
32610  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
32611  * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
32612  * if suboffset >= 0:
32613  * raise ValueError("Indirect dimensions not supported")
32614  */
32615  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
32616  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
32617  __pyx_t_1 = __pyx_t_3;
32618  __pyx_v_suboffset = (__pyx_t_1[0]);
32619 
32620  /* "View.MemoryView":702
32621  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
32622  * for suboffset in suboffsets[:ndim]:
32623  * if suboffset >= 0: # <<<<<<<<<<<<<<
32624  * raise ValueError("Indirect dimensions not supported")
32625  *
32626  */
32627  __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
32628  if (unlikely(__pyx_t_4)) {
32629 
32630  /* "View.MemoryView":703
32631  * for suboffset in suboffsets[:ndim]:
32632  * if suboffset >= 0:
32633  * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
32634  *
32635  *
32636  */
32637  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
32638  __Pyx_GOTREF(__pyx_t_5);
32639  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
32640  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
32641  __PYX_ERR(2, 703, __pyx_L1_error)
32642 
32643  /* "View.MemoryView":702
32644  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
32645  * for suboffset in suboffsets[:ndim]:
32646  * if suboffset >= 0: # <<<<<<<<<<<<<<
32647  * raise ValueError("Indirect dimensions not supported")
32648  *
32649  */
32650  }
32651  }
32652 
32653  /* "View.MemoryView":700
32654  * return have_slices or nslices, tuple(result)
32655  *
32656  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
32657  * for suboffset in suboffsets[:ndim]:
32658  * if suboffset >= 0:
32659  */
32660 
32661  /* function exit code */
32662  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
32663  goto __pyx_L0;
32664  __pyx_L1_error:;
32665  __Pyx_XDECREF(__pyx_t_5);
32666  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
32667  __pyx_r = 0;
32668  __pyx_L0:;
32669  __Pyx_XGIVEREF(__pyx_r);
32670  __Pyx_RefNannyFinishContext();
32671  return __pyx_r;
32672 }
32673 
32674 /* "View.MemoryView":710
32675  *
32676  * @cname('__pyx_memview_slice')
32677  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
32678  * cdef int new_ndim = 0, suboffset_dim = -1, dim
32679  * cdef bint negative_step
32680  */
32681 
32682 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
32683  int __pyx_v_new_ndim;
32684  int __pyx_v_suboffset_dim;
32685  int __pyx_v_dim;
32686  __Pyx_memviewslice __pyx_v_src;
32687  __Pyx_memviewslice __pyx_v_dst;
32688  __Pyx_memviewslice *__pyx_v_p_src;
32689  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
32690  __Pyx_memviewslice *__pyx_v_p_dst;
32691  int *__pyx_v_p_suboffset_dim;
32692  Py_ssize_t __pyx_v_start;
32693  Py_ssize_t __pyx_v_stop;
32694  Py_ssize_t __pyx_v_step;
32695  int __pyx_v_have_start;
32696  int __pyx_v_have_stop;
32697  int __pyx_v_have_step;
32698  PyObject *__pyx_v_index = NULL;
32699  struct __pyx_memoryview_obj *__pyx_r = NULL;
32700  __Pyx_RefNannyDeclarations
32701  int __pyx_t_1;
32702  int __pyx_t_2;
32703  PyObject *__pyx_t_3 = NULL;
32704  struct __pyx_memoryview_obj *__pyx_t_4;
32705  char *__pyx_t_5;
32706  int __pyx_t_6;
32707  Py_ssize_t __pyx_t_7;
32708  PyObject *(*__pyx_t_8)(PyObject *);
32709  PyObject *__pyx_t_9 = NULL;
32710  Py_ssize_t __pyx_t_10;
32711  int __pyx_t_11;
32712  Py_ssize_t __pyx_t_12;
32713  int __pyx_lineno = 0;
32714  const char *__pyx_filename = NULL;
32715  int __pyx_clineno = 0;
32716  __Pyx_RefNannySetupContext("memview_slice", 0);
32717 
32718  /* "View.MemoryView":711
32719  * @cname('__pyx_memview_slice')
32720  * cdef memoryview memview_slice(memoryview memview, object indices):
32721  * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
32722  * cdef bint negative_step
32723  * cdef __Pyx_memviewslice src, dst
32724  */
32725  __pyx_v_new_ndim = 0;
32726  __pyx_v_suboffset_dim = -1;
32727 
32728  /* "View.MemoryView":718
32729  *
32730  *
32731  * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
32732  *
32733  * cdef _memoryviewslice memviewsliceobj
32734  */
32735  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
32736 
32737  /* "View.MemoryView":722
32738  * cdef _memoryviewslice memviewsliceobj
32739  *
32740  * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
32741  *
32742  * if isinstance(memview, _memoryviewslice):
32743  */
32744  #ifndef CYTHON_WITHOUT_ASSERTIONS
32745  if (unlikely(!Py_OptimizeFlag)) {
32746  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
32747  PyErr_SetNone(PyExc_AssertionError);
32748  __PYX_ERR(2, 722, __pyx_L1_error)
32749  }
32750  }
32751  #endif
32752 
32753  /* "View.MemoryView":724
32754  * assert memview.view.ndim > 0
32755  *
32756  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
32757  * memviewsliceobj = memview
32758  * p_src = &memviewsliceobj.from_slice
32759  */
32760  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
32761  __pyx_t_2 = (__pyx_t_1 != 0);
32762  if (__pyx_t_2) {
32763 
32764  /* "View.MemoryView":725
32765  *
32766  * if isinstance(memview, _memoryviewslice):
32767  * memviewsliceobj = memview # <<<<<<<<<<<<<<
32768  * p_src = &memviewsliceobj.from_slice
32769  * else:
32770  */
32771  if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
32772  __pyx_t_3 = ((PyObject *)__pyx_v_memview);
32773  __Pyx_INCREF(__pyx_t_3);
32774  __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
32775  __pyx_t_3 = 0;
32776 
32777  /* "View.MemoryView":726
32778  * if isinstance(memview, _memoryviewslice):
32779  * memviewsliceobj = memview
32780  * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
32781  * else:
32782  * slice_copy(memview, &src)
32783  */
32784  __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
32785 
32786  /* "View.MemoryView":724
32787  * assert memview.view.ndim > 0
32788  *
32789  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
32790  * memviewsliceobj = memview
32791  * p_src = &memviewsliceobj.from_slice
32792  */
32793  goto __pyx_L3;
32794  }
32795 
32796  /* "View.MemoryView":728
32797  * p_src = &memviewsliceobj.from_slice
32798  * else:
32799  * slice_copy(memview, &src) # <<<<<<<<<<<<<<
32800  * p_src = &src
32801  *
32802  */
32803  /*else*/ {
32804  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
32805 
32806  /* "View.MemoryView":729
32807  * else:
32808  * slice_copy(memview, &src)
32809  * p_src = &src # <<<<<<<<<<<<<<
32810  *
32811  *
32812  */
32813  __pyx_v_p_src = (&__pyx_v_src);
32814  }
32815  __pyx_L3:;
32816 
32817  /* "View.MemoryView":735
32818  *
32819  *
32820  * dst.memview = p_src.memview # <<<<<<<<<<<<<<
32821  * dst.data = p_src.data
32822  *
32823  */
32824  __pyx_t_4 = __pyx_v_p_src->memview;
32825  __pyx_v_dst.memview = __pyx_t_4;
32826 
32827  /* "View.MemoryView":736
32828  *
32829  * dst.memview = p_src.memview
32830  * dst.data = p_src.data # <<<<<<<<<<<<<<
32831  *
32832  *
32833  */
32834  __pyx_t_5 = __pyx_v_p_src->data;
32835  __pyx_v_dst.data = __pyx_t_5;
32836 
32837  /* "View.MemoryView":741
32838  *
32839  *
32840  * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
32841  * cdef int *p_suboffset_dim = &suboffset_dim
32842  * cdef Py_ssize_t start, stop, step
32843  */
32844  __pyx_v_p_dst = (&__pyx_v_dst);
32845 
32846  /* "View.MemoryView":742
32847  *
32848  * cdef __Pyx_memviewslice *p_dst = &dst
32849  * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
32850  * cdef Py_ssize_t start, stop, step
32851  * cdef bint have_start, have_stop, have_step
32852  */
32853  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
32854 
32855  /* "View.MemoryView":746
32856  * cdef bint have_start, have_stop, have_step
32857  *
32858  * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
32859  * if PyIndex_Check(index):
32860  * slice_memviewslice(
32861  */
32862  __pyx_t_6 = 0;
32863  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
32864  __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
32865  __pyx_t_8 = NULL;
32866  } else {
32867  __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
32868  __Pyx_GOTREF(__pyx_t_3);
32869  __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
32870  }
32871  for (;;) {
32872  if (likely(!__pyx_t_8)) {
32873  if (likely(PyList_CheckExact(__pyx_t_3))) {
32874  if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
32875  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
32876  __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
32877  #else
32878  __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
32879  __Pyx_GOTREF(__pyx_t_9);
32880  #endif
32881  } else {
32882  if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
32883  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
32884  __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error)
32885  #else
32886  __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
32887  __Pyx_GOTREF(__pyx_t_9);
32888  #endif
32889  }
32890  } else {
32891  __pyx_t_9 = __pyx_t_8(__pyx_t_3);
32892  if (unlikely(!__pyx_t_9)) {
32893  PyObject* exc_type = PyErr_Occurred();
32894  if (exc_type) {
32895  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
32896  else __PYX_ERR(2, 746, __pyx_L1_error)
32897  }
32898  break;
32899  }
32900  __Pyx_GOTREF(__pyx_t_9);
32901  }
32902  __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
32903  __pyx_t_9 = 0;
32904  __pyx_v_dim = __pyx_t_6;
32905  __pyx_t_6 = (__pyx_t_6 + 1);
32906 
32907  /* "View.MemoryView":747
32908  *
32909  * for dim, index in enumerate(indices):
32910  * if PyIndex_Check(index): # <<<<<<<<<<<<<<
32911  * slice_memviewslice(
32912  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
32913  */
32914  __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
32915  if (__pyx_t_2) {
32916 
32917  /* "View.MemoryView":751
32918  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
32919  * dim, new_ndim, p_suboffset_dim,
32920  * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
32921  * 0, 0, 0, # have_{start,stop,step}
32922  * False)
32923  */
32924  __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
32925 
32926  /* "View.MemoryView":748
32927  * for dim, index in enumerate(indices):
32928  * if PyIndex_Check(index):
32929  * slice_memviewslice( # <<<<<<<<<<<<<<
32930  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
32931  * dim, new_ndim, p_suboffset_dim,
32932  */
32933  __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error)
32934 
32935  /* "View.MemoryView":747
32936  *
32937  * for dim, index in enumerate(indices):
32938  * if PyIndex_Check(index): # <<<<<<<<<<<<<<
32939  * slice_memviewslice(
32940  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
32941  */
32942  goto __pyx_L6;
32943  }
32944 
32945  /* "View.MemoryView":754
32946  * 0, 0, 0, # have_{start,stop,step}
32947  * False)
32948  * elif index is None: # <<<<<<<<<<<<<<
32949  * p_dst.shape[new_ndim] = 1
32950  * p_dst.strides[new_ndim] = 0
32951  */
32952  __pyx_t_2 = (__pyx_v_index == Py_None);
32953  __pyx_t_1 = (__pyx_t_2 != 0);
32954  if (__pyx_t_1) {
32955 
32956  /* "View.MemoryView":755
32957  * False)
32958  * elif index is None:
32959  * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
32960  * p_dst.strides[new_ndim] = 0
32961  * p_dst.suboffsets[new_ndim] = -1
32962  */
32963  (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
32964 
32965  /* "View.MemoryView":756
32966  * elif index is None:
32967  * p_dst.shape[new_ndim] = 1
32968  * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
32969  * p_dst.suboffsets[new_ndim] = -1
32970  * new_ndim += 1
32971  */
32972  (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
32973 
32974  /* "View.MemoryView":757
32975  * p_dst.shape[new_ndim] = 1
32976  * p_dst.strides[new_ndim] = 0
32977  * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
32978  * new_ndim += 1
32979  * else:
32980  */
32981  (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
32982 
32983  /* "View.MemoryView":758
32984  * p_dst.strides[new_ndim] = 0
32985  * p_dst.suboffsets[new_ndim] = -1
32986  * new_ndim += 1 # <<<<<<<<<<<<<<
32987  * else:
32988  * start = index.start or 0
32989  */
32990  __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
32991 
32992  /* "View.MemoryView":754
32993  * 0, 0, 0, # have_{start,stop,step}
32994  * False)
32995  * elif index is None: # <<<<<<<<<<<<<<
32996  * p_dst.shape[new_ndim] = 1
32997  * p_dst.strides[new_ndim] = 0
32998  */
32999  goto __pyx_L6;
33000  }
33001 
33002  /* "View.MemoryView":760
33003  * new_ndim += 1
33004  * else:
33005  * start = index.start or 0 # <<<<<<<<<<<<<<
33006  * stop = index.stop or 0
33007  * step = index.step or 0
33008  */
33009  /*else*/ {
33010  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
33011  __Pyx_GOTREF(__pyx_t_9);
33012  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
33013  if (!__pyx_t_1) {
33014  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33015  } else {
33016  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
33017  __pyx_t_10 = __pyx_t_12;
33018  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33019  goto __pyx_L7_bool_binop_done;
33020  }
33021  __pyx_t_10 = 0;
33022  __pyx_L7_bool_binop_done:;
33023  __pyx_v_start = __pyx_t_10;
33024 
33025  /* "View.MemoryView":761
33026  * else:
33027  * start = index.start or 0
33028  * stop = index.stop or 0 # <<<<<<<<<<<<<<
33029  * step = index.step or 0
33030  *
33031  */
33032  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
33033  __Pyx_GOTREF(__pyx_t_9);
33034  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
33035  if (!__pyx_t_1) {
33036  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33037  } else {
33038  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
33039  __pyx_t_10 = __pyx_t_12;
33040  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33041  goto __pyx_L9_bool_binop_done;
33042  }
33043  __pyx_t_10 = 0;
33044  __pyx_L9_bool_binop_done:;
33045  __pyx_v_stop = __pyx_t_10;
33046 
33047  /* "View.MemoryView":762
33048  * start = index.start or 0
33049  * stop = index.stop or 0
33050  * step = index.step or 0 # <<<<<<<<<<<<<<
33051  *
33052  * have_start = index.start is not None
33053  */
33054  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
33055  __Pyx_GOTREF(__pyx_t_9);
33056  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
33057  if (!__pyx_t_1) {
33058  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33059  } else {
33060  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
33061  __pyx_t_10 = __pyx_t_12;
33062  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33063  goto __pyx_L11_bool_binop_done;
33064  }
33065  __pyx_t_10 = 0;
33066  __pyx_L11_bool_binop_done:;
33067  __pyx_v_step = __pyx_t_10;
33068 
33069  /* "View.MemoryView":764
33070  * step = index.step or 0
33071  *
33072  * have_start = index.start is not None # <<<<<<<<<<<<<<
33073  * have_stop = index.stop is not None
33074  * have_step = index.step is not None
33075  */
33076  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
33077  __Pyx_GOTREF(__pyx_t_9);
33078  __pyx_t_1 = (__pyx_t_9 != Py_None);
33079  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33080  __pyx_v_have_start = __pyx_t_1;
33081 
33082  /* "View.MemoryView":765
33083  *
33084  * have_start = index.start is not None
33085  * have_stop = index.stop is not None # <<<<<<<<<<<<<<
33086  * have_step = index.step is not None
33087  *
33088  */
33089  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
33090  __Pyx_GOTREF(__pyx_t_9);
33091  __pyx_t_1 = (__pyx_t_9 != Py_None);
33092  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33093  __pyx_v_have_stop = __pyx_t_1;
33094 
33095  /* "View.MemoryView":766
33096  * have_start = index.start is not None
33097  * have_stop = index.stop is not None
33098  * have_step = index.step is not None # <<<<<<<<<<<<<<
33099  *
33100  * slice_memviewslice(
33101  */
33102  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
33103  __Pyx_GOTREF(__pyx_t_9);
33104  __pyx_t_1 = (__pyx_t_9 != Py_None);
33105  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
33106  __pyx_v_have_step = __pyx_t_1;
33107 
33108  /* "View.MemoryView":768
33109  * have_step = index.step is not None
33110  *
33111  * slice_memviewslice( # <<<<<<<<<<<<<<
33112  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
33113  * dim, new_ndim, p_suboffset_dim,
33114  */
33115  __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error)
33116 
33117  /* "View.MemoryView":774
33118  * have_start, have_stop, have_step,
33119  * True)
33120  * new_ndim += 1 # <<<<<<<<<<<<<<
33121  *
33122  * if isinstance(memview, _memoryviewslice):
33123  */
33124  __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
33125  }
33126  __pyx_L6:;
33127 
33128  /* "View.MemoryView":746
33129  * cdef bint have_start, have_stop, have_step
33130  *
33131  * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
33132  * if PyIndex_Check(index):
33133  * slice_memviewslice(
33134  */
33135  }
33136  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
33137 
33138  /* "View.MemoryView":776
33139  * new_ndim += 1
33140  *
33141  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
33142  * return memoryview_fromslice(dst, new_ndim,
33143  * memviewsliceobj.to_object_func,
33144  */
33145  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
33146  __pyx_t_2 = (__pyx_t_1 != 0);
33147  if (__pyx_t_2) {
33148 
33149  /* "View.MemoryView":777
33150  *
33151  * if isinstance(memview, _memoryviewslice):
33152  * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
33153  * memviewsliceobj.to_object_func,
33154  * memviewsliceobj.to_dtype_func,
33155  */
33156  __Pyx_XDECREF(((PyObject *)__pyx_r));
33157 
33158  /* "View.MemoryView":778
33159  * if isinstance(memview, _memoryviewslice):
33160  * return memoryview_fromslice(dst, new_ndim,
33161  * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
33162  * memviewsliceobj.to_dtype_func,
33163  * memview.dtype_is_object)
33164  */
33165  if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
33166 
33167  /* "View.MemoryView":779
33168  * return memoryview_fromslice(dst, new_ndim,
33169  * memviewsliceobj.to_object_func,
33170  * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
33171  * memview.dtype_is_object)
33172  * else:
33173  */
33174  if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
33175 
33176  /* "View.MemoryView":777
33177  *
33178  * if isinstance(memview, _memoryviewslice):
33179  * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
33180  * memviewsliceobj.to_object_func,
33181  * memviewsliceobj.to_dtype_func,
33182  */
33183  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
33184  __Pyx_GOTREF(__pyx_t_3);
33185  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
33186  __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
33187  __pyx_t_3 = 0;
33188  goto __pyx_L0;
33189 
33190  /* "View.MemoryView":776
33191  * new_ndim += 1
33192  *
33193  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
33194  * return memoryview_fromslice(dst, new_ndim,
33195  * memviewsliceobj.to_object_func,
33196  */
33197  }
33198 
33199  /* "View.MemoryView":782
33200  * memview.dtype_is_object)
33201  * else:
33202  * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
33203  * memview.dtype_is_object)
33204  *
33205  */
33206  /*else*/ {
33207  __Pyx_XDECREF(((PyObject *)__pyx_r));
33208 
33209  /* "View.MemoryView":783
33210  * else:
33211  * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
33212  * memview.dtype_is_object) # <<<<<<<<<<<<<<
33213  *
33214  *
33215  */
33216  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error)
33217  __Pyx_GOTREF(__pyx_t_3);
33218 
33219  /* "View.MemoryView":782
33220  * memview.dtype_is_object)
33221  * else:
33222  * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
33223  * memview.dtype_is_object)
33224  *
33225  */
33226  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
33227  __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
33228  __pyx_t_3 = 0;
33229  goto __pyx_L0;
33230  }
33231 
33232  /* "View.MemoryView":710
33233  *
33234  * @cname('__pyx_memview_slice')
33235  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
33236  * cdef int new_ndim = 0, suboffset_dim = -1, dim
33237  * cdef bint negative_step
33238  */
33239 
33240  /* function exit code */
33241  __pyx_L1_error:;
33242  __Pyx_XDECREF(__pyx_t_3);
33243  __Pyx_XDECREF(__pyx_t_9);
33244  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
33245  __pyx_r = 0;
33246  __pyx_L0:;
33247  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
33248  __Pyx_XDECREF(__pyx_v_index);
33249  __Pyx_XGIVEREF((PyObject *)__pyx_r);
33250  __Pyx_RefNannyFinishContext();
33251  return __pyx_r;
33252 }
33253 
33254 /* "View.MemoryView":807
33255  *
33256  * @cname('__pyx_memoryview_slice_memviewslice')
33257  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
33258  * __Pyx_memviewslice *dst,
33259  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
33260  */
33261 
33262 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
33263  Py_ssize_t __pyx_v_new_shape;
33264  int __pyx_v_negative_step;
33265  int __pyx_r;
33266  int __pyx_t_1;
33267  int __pyx_t_2;
33268  int __pyx_t_3;
33269  int __pyx_lineno = 0;
33270  const char *__pyx_filename = NULL;
33271  int __pyx_clineno = 0;
33272 
33273  /* "View.MemoryView":827
33274  * cdef bint negative_step
33275  *
33276  * if not is_slice: # <<<<<<<<<<<<<<
33277  *
33278  * if start < 0:
33279  */
33280  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
33281  if (__pyx_t_1) {
33282 
33283  /* "View.MemoryView":829
33284  * if not is_slice:
33285  *
33286  * if start < 0: # <<<<<<<<<<<<<<
33287  * start += shape
33288  * if not 0 <= start < shape:
33289  */
33290  __pyx_t_1 = ((__pyx_v_start < 0) != 0);
33291  if (__pyx_t_1) {
33292 
33293  /* "View.MemoryView":830
33294  *
33295  * if start < 0:
33296  * start += shape # <<<<<<<<<<<<<<
33297  * if not 0 <= start < shape:
33298  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
33299  */
33300  __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
33301 
33302  /* "View.MemoryView":829
33303  * if not is_slice:
33304  *
33305  * if start < 0: # <<<<<<<<<<<<<<
33306  * start += shape
33307  * if not 0 <= start < shape:
33308  */
33309  }
33310 
33311  /* "View.MemoryView":831
33312  * if start < 0:
33313  * start += shape
33314  * if not 0 <= start < shape: # <<<<<<<<<<<<<<
33315  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
33316  * else:
33317  */
33318  __pyx_t_1 = (0 <= __pyx_v_start);
33319  if (__pyx_t_1) {
33320  __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
33321  }
33322  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
33323  if (__pyx_t_2) {
33324 
33325  /* "View.MemoryView":832
33326  * start += shape
33327  * if not 0 <= start < shape:
33328  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
33329  * else:
33330  *
33331  */
33332  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error)
33333 
33334  /* "View.MemoryView":831
33335  * if start < 0:
33336  * start += shape
33337  * if not 0 <= start < shape: # <<<<<<<<<<<<<<
33338  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
33339  * else:
33340  */
33341  }
33342 
33343  /* "View.MemoryView":827
33344  * cdef bint negative_step
33345  *
33346  * if not is_slice: # <<<<<<<<<<<<<<
33347  *
33348  * if start < 0:
33349  */
33350  goto __pyx_L3;
33351  }
33352 
33353  /* "View.MemoryView":835
33354  * else:
33355  *
33356  * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
33357  *
33358  * if have_step and step == 0:
33359  */
33360  /*else*/ {
33361  __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
33362  if (__pyx_t_1) {
33363  } else {
33364  __pyx_t_2 = __pyx_t_1;
33365  goto __pyx_L6_bool_binop_done;
33366  }
33367  __pyx_t_1 = ((__pyx_v_step < 0) != 0);
33368  __pyx_t_2 = __pyx_t_1;
33369  __pyx_L6_bool_binop_done:;
33370  __pyx_v_negative_step = __pyx_t_2;
33371 
33372  /* "View.MemoryView":837
33373  * negative_step = have_step != 0 and step < 0
33374  *
33375  * if have_step and step == 0: # <<<<<<<<<<<<<<
33376  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
33377  *
33378  */
33379  __pyx_t_1 = (__pyx_v_have_step != 0);
33380  if (__pyx_t_1) {
33381  } else {
33382  __pyx_t_2 = __pyx_t_1;
33383  goto __pyx_L9_bool_binop_done;
33384  }
33385  __pyx_t_1 = ((__pyx_v_step == 0) != 0);
33386  __pyx_t_2 = __pyx_t_1;
33387  __pyx_L9_bool_binop_done:;
33388  if (__pyx_t_2) {
33389 
33390  /* "View.MemoryView":838
33391  *
33392  * if have_step and step == 0:
33393  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
33394  *
33395  *
33396  */
33397  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error)
33398 
33399  /* "View.MemoryView":837
33400  * negative_step = have_step != 0 and step < 0
33401  *
33402  * if have_step and step == 0: # <<<<<<<<<<<<<<
33403  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
33404  *
33405  */
33406  }
33407 
33408  /* "View.MemoryView":841
33409  *
33410  *
33411  * if have_start: # <<<<<<<<<<<<<<
33412  * if start < 0:
33413  * start += shape
33414  */
33415  __pyx_t_2 = (__pyx_v_have_start != 0);
33416  if (__pyx_t_2) {
33417 
33418  /* "View.MemoryView":842
33419  *
33420  * if have_start:
33421  * if start < 0: # <<<<<<<<<<<<<<
33422  * start += shape
33423  * if start < 0:
33424  */
33425  __pyx_t_2 = ((__pyx_v_start < 0) != 0);
33426  if (__pyx_t_2) {
33427 
33428  /* "View.MemoryView":843
33429  * if have_start:
33430  * if start < 0:
33431  * start += shape # <<<<<<<<<<<<<<
33432  * if start < 0:
33433  * start = 0
33434  */
33435  __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
33436 
33437  /* "View.MemoryView":844
33438  * if start < 0:
33439  * start += shape
33440  * if start < 0: # <<<<<<<<<<<<<<
33441  * start = 0
33442  * elif start >= shape:
33443  */
33444  __pyx_t_2 = ((__pyx_v_start < 0) != 0);
33445  if (__pyx_t_2) {
33446 
33447  /* "View.MemoryView":845
33448  * start += shape
33449  * if start < 0:
33450  * start = 0 # <<<<<<<<<<<<<<
33451  * elif start >= shape:
33452  * if negative_step:
33453  */
33454  __pyx_v_start = 0;
33455 
33456  /* "View.MemoryView":844
33457  * if start < 0:
33458  * start += shape
33459  * if start < 0: # <<<<<<<<<<<<<<
33460  * start = 0
33461  * elif start >= shape:
33462  */
33463  }
33464 
33465  /* "View.MemoryView":842
33466  *
33467  * if have_start:
33468  * if start < 0: # <<<<<<<<<<<<<<
33469  * start += shape
33470  * if start < 0:
33471  */
33472  goto __pyx_L12;
33473  }
33474 
33475  /* "View.MemoryView":846
33476  * if start < 0:
33477  * start = 0
33478  * elif start >= shape: # <<<<<<<<<<<<<<
33479  * if negative_step:
33480  * start = shape - 1
33481  */
33482  __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
33483  if (__pyx_t_2) {
33484 
33485  /* "View.MemoryView":847
33486  * start = 0
33487  * elif start >= shape:
33488  * if negative_step: # <<<<<<<<<<<<<<
33489  * start = shape - 1
33490  * else:
33491  */
33492  __pyx_t_2 = (__pyx_v_negative_step != 0);
33493  if (__pyx_t_2) {
33494 
33495  /* "View.MemoryView":848
33496  * elif start >= shape:
33497  * if negative_step:
33498  * start = shape - 1 # <<<<<<<<<<<<<<
33499  * else:
33500  * start = shape
33501  */
33502  __pyx_v_start = (__pyx_v_shape - 1);
33503 
33504  /* "View.MemoryView":847
33505  * start = 0
33506  * elif start >= shape:
33507  * if negative_step: # <<<<<<<<<<<<<<
33508  * start = shape - 1
33509  * else:
33510  */
33511  goto __pyx_L14;
33512  }
33513 
33514  /* "View.MemoryView":850
33515  * start = shape - 1
33516  * else:
33517  * start = shape # <<<<<<<<<<<<<<
33518  * else:
33519  * if negative_step:
33520  */
33521  /*else*/ {
33522  __pyx_v_start = __pyx_v_shape;
33523  }
33524  __pyx_L14:;
33525 
33526  /* "View.MemoryView":846
33527  * if start < 0:
33528  * start = 0
33529  * elif start >= shape: # <<<<<<<<<<<<<<
33530  * if negative_step:
33531  * start = shape - 1
33532  */
33533  }
33534  __pyx_L12:;
33535 
33536  /* "View.MemoryView":841
33537  *
33538  *
33539  * if have_start: # <<<<<<<<<<<<<<
33540  * if start < 0:
33541  * start += shape
33542  */
33543  goto __pyx_L11;
33544  }
33545 
33546  /* "View.MemoryView":852
33547  * start = shape
33548  * else:
33549  * if negative_step: # <<<<<<<<<<<<<<
33550  * start = shape - 1
33551  * else:
33552  */
33553  /*else*/ {
33554  __pyx_t_2 = (__pyx_v_negative_step != 0);
33555  if (__pyx_t_2) {
33556 
33557  /* "View.MemoryView":853
33558  * else:
33559  * if negative_step:
33560  * start = shape - 1 # <<<<<<<<<<<<<<
33561  * else:
33562  * start = 0
33563  */
33564  __pyx_v_start = (__pyx_v_shape - 1);
33565 
33566  /* "View.MemoryView":852
33567  * start = shape
33568  * else:
33569  * if negative_step: # <<<<<<<<<<<<<<
33570  * start = shape - 1
33571  * else:
33572  */
33573  goto __pyx_L15;
33574  }
33575 
33576  /* "View.MemoryView":855
33577  * start = shape - 1
33578  * else:
33579  * start = 0 # <<<<<<<<<<<<<<
33580  *
33581  * if have_stop:
33582  */
33583  /*else*/ {
33584  __pyx_v_start = 0;
33585  }
33586  __pyx_L15:;
33587  }
33588  __pyx_L11:;
33589 
33590  /* "View.MemoryView":857
33591  * start = 0
33592  *
33593  * if have_stop: # <<<<<<<<<<<<<<
33594  * if stop < 0:
33595  * stop += shape
33596  */
33597  __pyx_t_2 = (__pyx_v_have_stop != 0);
33598  if (__pyx_t_2) {
33599 
33600  /* "View.MemoryView":858
33601  *
33602  * if have_stop:
33603  * if stop < 0: # <<<<<<<<<<<<<<
33604  * stop += shape
33605  * if stop < 0:
33606  */
33607  __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
33608  if (__pyx_t_2) {
33609 
33610  /* "View.MemoryView":859
33611  * if have_stop:
33612  * if stop < 0:
33613  * stop += shape # <<<<<<<<<<<<<<
33614  * if stop < 0:
33615  * stop = 0
33616  */
33617  __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
33618 
33619  /* "View.MemoryView":860
33620  * if stop < 0:
33621  * stop += shape
33622  * if stop < 0: # <<<<<<<<<<<<<<
33623  * stop = 0
33624  * elif stop > shape:
33625  */
33626  __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
33627  if (__pyx_t_2) {
33628 
33629  /* "View.MemoryView":861
33630  * stop += shape
33631  * if stop < 0:
33632  * stop = 0 # <<<<<<<<<<<<<<
33633  * elif stop > shape:
33634  * stop = shape
33635  */
33636  __pyx_v_stop = 0;
33637 
33638  /* "View.MemoryView":860
33639  * if stop < 0:
33640  * stop += shape
33641  * if stop < 0: # <<<<<<<<<<<<<<
33642  * stop = 0
33643  * elif stop > shape:
33644  */
33645  }
33646 
33647  /* "View.MemoryView":858
33648  *
33649  * if have_stop:
33650  * if stop < 0: # <<<<<<<<<<<<<<
33651  * stop += shape
33652  * if stop < 0:
33653  */
33654  goto __pyx_L17;
33655  }
33656 
33657  /* "View.MemoryView":862
33658  * if stop < 0:
33659  * stop = 0
33660  * elif stop > shape: # <<<<<<<<<<<<<<
33661  * stop = shape
33662  * else:
33663  */
33664  __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
33665  if (__pyx_t_2) {
33666 
33667  /* "View.MemoryView":863
33668  * stop = 0
33669  * elif stop > shape:
33670  * stop = shape # <<<<<<<<<<<<<<
33671  * else:
33672  * if negative_step:
33673  */
33674  __pyx_v_stop = __pyx_v_shape;
33675 
33676  /* "View.MemoryView":862
33677  * if stop < 0:
33678  * stop = 0
33679  * elif stop > shape: # <<<<<<<<<<<<<<
33680  * stop = shape
33681  * else:
33682  */
33683  }
33684  __pyx_L17:;
33685 
33686  /* "View.MemoryView":857
33687  * start = 0
33688  *
33689  * if have_stop: # <<<<<<<<<<<<<<
33690  * if stop < 0:
33691  * stop += shape
33692  */
33693  goto __pyx_L16;
33694  }
33695 
33696  /* "View.MemoryView":865
33697  * stop = shape
33698  * else:
33699  * if negative_step: # <<<<<<<<<<<<<<
33700  * stop = -1
33701  * else:
33702  */
33703  /*else*/ {
33704  __pyx_t_2 = (__pyx_v_negative_step != 0);
33705  if (__pyx_t_2) {
33706 
33707  /* "View.MemoryView":866
33708  * else:
33709  * if negative_step:
33710  * stop = -1 # <<<<<<<<<<<<<<
33711  * else:
33712  * stop = shape
33713  */
33714  __pyx_v_stop = -1L;
33715 
33716  /* "View.MemoryView":865
33717  * stop = shape
33718  * else:
33719  * if negative_step: # <<<<<<<<<<<<<<
33720  * stop = -1
33721  * else:
33722  */
33723  goto __pyx_L19;
33724  }
33725 
33726  /* "View.MemoryView":868
33727  * stop = -1
33728  * else:
33729  * stop = shape # <<<<<<<<<<<<<<
33730  *
33731  * if not have_step:
33732  */
33733  /*else*/ {
33734  __pyx_v_stop = __pyx_v_shape;
33735  }
33736  __pyx_L19:;
33737  }
33738  __pyx_L16:;
33739 
33740  /* "View.MemoryView":870
33741  * stop = shape
33742  *
33743  * if not have_step: # <<<<<<<<<<<<<<
33744  * step = 1
33745  *
33746  */
33747  __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
33748  if (__pyx_t_2) {
33749 
33750  /* "View.MemoryView":871
33751  *
33752  * if not have_step:
33753  * step = 1 # <<<<<<<<<<<<<<
33754  *
33755  *
33756  */
33757  __pyx_v_step = 1;
33758 
33759  /* "View.MemoryView":870
33760  * stop = shape
33761  *
33762  * if not have_step: # <<<<<<<<<<<<<<
33763  * step = 1
33764  *
33765  */
33766  }
33767 
33768  /* "View.MemoryView":875
33769  *
33770  * with cython.cdivision(True):
33771  * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
33772  *
33773  * if (stop - start) - step * new_shape:
33774  */
33775  __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
33776 
33777  /* "View.MemoryView":877
33778  * new_shape = (stop - start) // step
33779  *
33780  * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
33781  * new_shape += 1
33782  *
33783  */
33784  __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
33785  if (__pyx_t_2) {
33786 
33787  /* "View.MemoryView":878
33788  *
33789  * if (stop - start) - step * new_shape:
33790  * new_shape += 1 # <<<<<<<<<<<<<<
33791  *
33792  * if new_shape < 0:
33793  */
33794  __pyx_v_new_shape = (__pyx_v_new_shape + 1);
33795 
33796  /* "View.MemoryView":877
33797  * new_shape = (stop - start) // step
33798  *
33799  * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
33800  * new_shape += 1
33801  *
33802  */
33803  }
33804 
33805  /* "View.MemoryView":880
33806  * new_shape += 1
33807  *
33808  * if new_shape < 0: # <<<<<<<<<<<<<<
33809  * new_shape = 0
33810  *
33811  */
33812  __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
33813  if (__pyx_t_2) {
33814 
33815  /* "View.MemoryView":881
33816  *
33817  * if new_shape < 0:
33818  * new_shape = 0 # <<<<<<<<<<<<<<
33819  *
33820  *
33821  */
33822  __pyx_v_new_shape = 0;
33823 
33824  /* "View.MemoryView":880
33825  * new_shape += 1
33826  *
33827  * if new_shape < 0: # <<<<<<<<<<<<<<
33828  * new_shape = 0
33829  *
33830  */
33831  }
33832 
33833  /* "View.MemoryView":884
33834  *
33835  *
33836  * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
33837  * dst.shape[new_ndim] = new_shape
33838  * dst.suboffsets[new_ndim] = suboffset
33839  */
33840  (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
33841 
33842  /* "View.MemoryView":885
33843  *
33844  * dst.strides[new_ndim] = stride * step
33845  * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
33846  * dst.suboffsets[new_ndim] = suboffset
33847  *
33848  */
33849  (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
33850 
33851  /* "View.MemoryView":886
33852  * dst.strides[new_ndim] = stride * step
33853  * dst.shape[new_ndim] = new_shape
33854  * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
33855  *
33856  *
33857  */
33858  (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
33859  }
33860  __pyx_L3:;
33861 
33862  /* "View.MemoryView":889
33863  *
33864  *
33865  * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
33866  * dst.data += start * stride
33867  * else:
33868  */
33869  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
33870  if (__pyx_t_2) {
33871 
33872  /* "View.MemoryView":890
33873  *
33874  * if suboffset_dim[0] < 0:
33875  * dst.data += start * stride # <<<<<<<<<<<<<<
33876  * else:
33877  * dst.suboffsets[suboffset_dim[0]] += start * stride
33878  */
33879  __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
33880 
33881  /* "View.MemoryView":889
33882  *
33883  *
33884  * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
33885  * dst.data += start * stride
33886  * else:
33887  */
33888  goto __pyx_L23;
33889  }
33890 
33891  /* "View.MemoryView":892
33892  * dst.data += start * stride
33893  * else:
33894  * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
33895  *
33896  * if suboffset >= 0:
33897  */
33898  /*else*/ {
33899  __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
33900  (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
33901  }
33902  __pyx_L23:;
33903 
33904  /* "View.MemoryView":894
33905  * dst.suboffsets[suboffset_dim[0]] += start * stride
33906  *
33907  * if suboffset >= 0: # <<<<<<<<<<<<<<
33908  * if not is_slice:
33909  * if new_ndim == 0:
33910  */
33911  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
33912  if (__pyx_t_2) {
33913 
33914  /* "View.MemoryView":895
33915  *
33916  * if suboffset >= 0:
33917  * if not is_slice: # <<<<<<<<<<<<<<
33918  * if new_ndim == 0:
33919  * dst.data = (<char **> dst.data)[0] + suboffset
33920  */
33921  __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
33922  if (__pyx_t_2) {
33923 
33924  /* "View.MemoryView":896
33925  * if suboffset >= 0:
33926  * if not is_slice:
33927  * if new_ndim == 0: # <<<<<<<<<<<<<<
33928  * dst.data = (<char **> dst.data)[0] + suboffset
33929  * else:
33930  */
33931  __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
33932  if (__pyx_t_2) {
33933 
33934  /* "View.MemoryView":897
33935  * if not is_slice:
33936  * if new_ndim == 0:
33937  * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
33938  * else:
33939  * _err_dim(IndexError, "All dimensions preceding dimension %d "
33940  */
33941  __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
33942 
33943  /* "View.MemoryView":896
33944  * if suboffset >= 0:
33945  * if not is_slice:
33946  * if new_ndim == 0: # <<<<<<<<<<<<<<
33947  * dst.data = (<char **> dst.data)[0] + suboffset
33948  * else:
33949  */
33950  goto __pyx_L26;
33951  }
33952 
33953  /* "View.MemoryView":899
33954  * dst.data = (<char **> dst.data)[0] + suboffset
33955  * else:
33956  * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
33957  * "must be indexed and not sliced", dim)
33958  * else:
33959  */
33960  /*else*/ {
33961 
33962  /* "View.MemoryView":900
33963  * else:
33964  * _err_dim(IndexError, "All dimensions preceding dimension %d "
33965  * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
33966  * else:
33967  * suboffset_dim[0] = new_ndim
33968  */
33969  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error)
33970  }
33971  __pyx_L26:;
33972 
33973  /* "View.MemoryView":895
33974  *
33975  * if suboffset >= 0:
33976  * if not is_slice: # <<<<<<<<<<<<<<
33977  * if new_ndim == 0:
33978  * dst.data = (<char **> dst.data)[0] + suboffset
33979  */
33980  goto __pyx_L25;
33981  }
33982 
33983  /* "View.MemoryView":902
33984  * "must be indexed and not sliced", dim)
33985  * else:
33986  * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
33987  *
33988  * return 0
33989  */
33990  /*else*/ {
33991  (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
33992  }
33993  __pyx_L25:;
33994 
33995  /* "View.MemoryView":894
33996  * dst.suboffsets[suboffset_dim[0]] += start * stride
33997  *
33998  * if suboffset >= 0: # <<<<<<<<<<<<<<
33999  * if not is_slice:
34000  * if new_ndim == 0:
34001  */
34002  }
34003 
34004  /* "View.MemoryView":904
34005  * suboffset_dim[0] = new_ndim
34006  *
34007  * return 0 # <<<<<<<<<<<<<<
34008  *
34009  *
34010  */
34011  __pyx_r = 0;
34012  goto __pyx_L0;
34013 
34014  /* "View.MemoryView":807
34015  *
34016  * @cname('__pyx_memoryview_slice_memviewslice')
34017  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
34018  * __Pyx_memviewslice *dst,
34019  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
34020  */
34021 
34022  /* function exit code */
34023  __pyx_L1_error:;
34024  {
34025  #ifdef WITH_THREAD
34026  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
34027  #endif
34028  __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
34029  #ifdef WITH_THREAD
34030  __Pyx_PyGILState_Release(__pyx_gilstate_save);
34031  #endif
34032  }
34033  __pyx_r = -1;
34034  __pyx_L0:;
34035  return __pyx_r;
34036 }
34037 
34038 /* "View.MemoryView":910
34039  *
34040  * @cname('__pyx_pybuffer_index')
34041  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
34042  * Py_ssize_t dim) except NULL:
34043  * cdef Py_ssize_t shape, stride, suboffset = -1
34044  */
34045 
34046 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
34047  Py_ssize_t __pyx_v_shape;
34048  Py_ssize_t __pyx_v_stride;
34049  Py_ssize_t __pyx_v_suboffset;
34050  Py_ssize_t __pyx_v_itemsize;
34051  char *__pyx_v_resultp;
34052  char *__pyx_r;
34053  __Pyx_RefNannyDeclarations
34054  Py_ssize_t __pyx_t_1;
34055  int __pyx_t_2;
34056  PyObject *__pyx_t_3 = NULL;
34057  PyObject *__pyx_t_4 = NULL;
34058  int __pyx_lineno = 0;
34059  const char *__pyx_filename = NULL;
34060  int __pyx_clineno = 0;
34061  __Pyx_RefNannySetupContext("pybuffer_index", 0);
34062 
34063  /* "View.MemoryView":912
34064  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
34065  * Py_ssize_t dim) except NULL:
34066  * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
34067  * cdef Py_ssize_t itemsize = view.itemsize
34068  * cdef char *resultp
34069  */
34070  __pyx_v_suboffset = -1L;
34071 
34072  /* "View.MemoryView":913
34073  * Py_ssize_t dim) except NULL:
34074  * cdef Py_ssize_t shape, stride, suboffset = -1
34075  * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
34076  * cdef char *resultp
34077  *
34078  */
34079  __pyx_t_1 = __pyx_v_view->itemsize;
34080  __pyx_v_itemsize = __pyx_t_1;
34081 
34082  /* "View.MemoryView":916
34083  * cdef char *resultp
34084  *
34085  * if view.ndim == 0: # <<<<<<<<<<<<<<
34086  * shape = view.len / itemsize
34087  * stride = itemsize
34088  */
34089  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
34090  if (__pyx_t_2) {
34091 
34092  /* "View.MemoryView":917
34093  *
34094  * if view.ndim == 0:
34095  * shape = view.len / itemsize # <<<<<<<<<<<<<<
34096  * stride = itemsize
34097  * else:
34098  */
34099  if (unlikely(__pyx_v_itemsize == 0)) {
34100  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
34101  __PYX_ERR(2, 917, __pyx_L1_error)
34102  }
34103  else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
34104  PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
34105  __PYX_ERR(2, 917, __pyx_L1_error)
34106  }
34107  __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
34108 
34109  /* "View.MemoryView":918
34110  * if view.ndim == 0:
34111  * shape = view.len / itemsize
34112  * stride = itemsize # <<<<<<<<<<<<<<
34113  * else:
34114  * shape = view.shape[dim]
34115  */
34116  __pyx_v_stride = __pyx_v_itemsize;
34117 
34118  /* "View.MemoryView":916
34119  * cdef char *resultp
34120  *
34121  * if view.ndim == 0: # <<<<<<<<<<<<<<
34122  * shape = view.len / itemsize
34123  * stride = itemsize
34124  */
34125  goto __pyx_L3;
34126  }
34127 
34128  /* "View.MemoryView":920
34129  * stride = itemsize
34130  * else:
34131  * shape = view.shape[dim] # <<<<<<<<<<<<<<
34132  * stride = view.strides[dim]
34133  * if view.suboffsets != NULL:
34134  */
34135  /*else*/ {
34136  __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
34137 
34138  /* "View.MemoryView":921
34139  * else:
34140  * shape = view.shape[dim]
34141  * stride = view.strides[dim] # <<<<<<<<<<<<<<
34142  * if view.suboffsets != NULL:
34143  * suboffset = view.suboffsets[dim]
34144  */
34145  __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
34146 
34147  /* "View.MemoryView":922
34148  * shape = view.shape[dim]
34149  * stride = view.strides[dim]
34150  * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
34151  * suboffset = view.suboffsets[dim]
34152  *
34153  */
34154  __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
34155  if (__pyx_t_2) {
34156 
34157  /* "View.MemoryView":923
34158  * stride = view.strides[dim]
34159  * if view.suboffsets != NULL:
34160  * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
34161  *
34162  * if index < 0:
34163  */
34164  __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
34165 
34166  /* "View.MemoryView":922
34167  * shape = view.shape[dim]
34168  * stride = view.strides[dim]
34169  * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
34170  * suboffset = view.suboffsets[dim]
34171  *
34172  */
34173  }
34174  }
34175  __pyx_L3:;
34176 
34177  /* "View.MemoryView":925
34178  * suboffset = view.suboffsets[dim]
34179  *
34180  * if index < 0: # <<<<<<<<<<<<<<
34181  * index += view.shape[dim]
34182  * if index < 0:
34183  */
34184  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
34185  if (__pyx_t_2) {
34186 
34187  /* "View.MemoryView":926
34188  *
34189  * if index < 0:
34190  * index += view.shape[dim] # <<<<<<<<<<<<<<
34191  * if index < 0:
34192  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34193  */
34194  __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
34195 
34196  /* "View.MemoryView":927
34197  * if index < 0:
34198  * index += view.shape[dim]
34199  * if index < 0: # <<<<<<<<<<<<<<
34200  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34201  *
34202  */
34203  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
34204  if (unlikely(__pyx_t_2)) {
34205 
34206  /* "View.MemoryView":928
34207  * index += view.shape[dim]
34208  * if index < 0:
34209  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
34210  *
34211  * if index >= shape:
34212  */
34213  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
34214  __Pyx_GOTREF(__pyx_t_3);
34215  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error)
34216  __Pyx_GOTREF(__pyx_t_4);
34217  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34218  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
34219  __Pyx_GOTREF(__pyx_t_3);
34220  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34221  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
34222  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34223  __PYX_ERR(2, 928, __pyx_L1_error)
34224 
34225  /* "View.MemoryView":927
34226  * if index < 0:
34227  * index += view.shape[dim]
34228  * if index < 0: # <<<<<<<<<<<<<<
34229  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34230  *
34231  */
34232  }
34233 
34234  /* "View.MemoryView":925
34235  * suboffset = view.suboffsets[dim]
34236  *
34237  * if index < 0: # <<<<<<<<<<<<<<
34238  * index += view.shape[dim]
34239  * if index < 0:
34240  */
34241  }
34242 
34243  /* "View.MemoryView":930
34244  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34245  *
34246  * if index >= shape: # <<<<<<<<<<<<<<
34247  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34248  *
34249  */
34250  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
34251  if (unlikely(__pyx_t_2)) {
34252 
34253  /* "View.MemoryView":931
34254  *
34255  * if index >= shape:
34256  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
34257  *
34258  * resultp = bufp + index * stride
34259  */
34260  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
34261  __Pyx_GOTREF(__pyx_t_3);
34262  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error)
34263  __Pyx_GOTREF(__pyx_t_4);
34264  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34265  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
34266  __Pyx_GOTREF(__pyx_t_3);
34267  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
34268  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
34269  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34270  __PYX_ERR(2, 931, __pyx_L1_error)
34271 
34272  /* "View.MemoryView":930
34273  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34274  *
34275  * if index >= shape: # <<<<<<<<<<<<<<
34276  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34277  *
34278  */
34279  }
34280 
34281  /* "View.MemoryView":933
34282  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
34283  *
34284  * resultp = bufp + index * stride # <<<<<<<<<<<<<<
34285  * if suboffset >= 0:
34286  * resultp = (<char **> resultp)[0] + suboffset
34287  */
34288  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
34289 
34290  /* "View.MemoryView":934
34291  *
34292  * resultp = bufp + index * stride
34293  * if suboffset >= 0: # <<<<<<<<<<<<<<
34294  * resultp = (<char **> resultp)[0] + suboffset
34295  *
34296  */
34297  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
34298  if (__pyx_t_2) {
34299 
34300  /* "View.MemoryView":935
34301  * resultp = bufp + index * stride
34302  * if suboffset >= 0:
34303  * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
34304  *
34305  * return resultp
34306  */
34307  __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
34308 
34309  /* "View.MemoryView":934
34310  *
34311  * resultp = bufp + index * stride
34312  * if suboffset >= 0: # <<<<<<<<<<<<<<
34313  * resultp = (<char **> resultp)[0] + suboffset
34314  *
34315  */
34316  }
34317 
34318  /* "View.MemoryView":937
34319  * resultp = (<char **> resultp)[0] + suboffset
34320  *
34321  * return resultp # <<<<<<<<<<<<<<
34322  *
34323  *
34324  */
34325  __pyx_r = __pyx_v_resultp;
34326  goto __pyx_L0;
34327 
34328  /* "View.MemoryView":910
34329  *
34330  * @cname('__pyx_pybuffer_index')
34331  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
34332  * Py_ssize_t dim) except NULL:
34333  * cdef Py_ssize_t shape, stride, suboffset = -1
34334  */
34335 
34336  /* function exit code */
34337  __pyx_L1_error:;
34338  __Pyx_XDECREF(__pyx_t_3);
34339  __Pyx_XDECREF(__pyx_t_4);
34340  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
34341  __pyx_r = NULL;
34342  __pyx_L0:;
34343  __Pyx_RefNannyFinishContext();
34344  return __pyx_r;
34345 }
34346 
34347 /* "View.MemoryView":943
34348  *
34349  * @cname('__pyx_memslice_transpose')
34350  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
34351  * cdef int ndim = memslice.memview.view.ndim
34352  *
34353  */
34354 
34355 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
34356  int __pyx_v_ndim;
34357  Py_ssize_t *__pyx_v_shape;
34358  Py_ssize_t *__pyx_v_strides;
34359  int __pyx_v_i;
34360  int __pyx_v_j;
34361  int __pyx_r;
34362  int __pyx_t_1;
34363  Py_ssize_t *__pyx_t_2;
34364  long __pyx_t_3;
34365  long __pyx_t_4;
34366  Py_ssize_t __pyx_t_5;
34367  Py_ssize_t __pyx_t_6;
34368  int __pyx_t_7;
34369  int __pyx_t_8;
34370  int __pyx_t_9;
34371  int __pyx_lineno = 0;
34372  const char *__pyx_filename = NULL;
34373  int __pyx_clineno = 0;
34374 
34375  /* "View.MemoryView":944
34376  * @cname('__pyx_memslice_transpose')
34377  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
34378  * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
34379  *
34380  * cdef Py_ssize_t *shape = memslice.shape
34381  */
34382  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
34383  __pyx_v_ndim = __pyx_t_1;
34384 
34385  /* "View.MemoryView":946
34386  * cdef int ndim = memslice.memview.view.ndim
34387  *
34388  * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
34389  * cdef Py_ssize_t *strides = memslice.strides
34390  *
34391  */
34392  __pyx_t_2 = __pyx_v_memslice->shape;
34393  __pyx_v_shape = __pyx_t_2;
34394 
34395  /* "View.MemoryView":947
34396  *
34397  * cdef Py_ssize_t *shape = memslice.shape
34398  * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
34399  *
34400  *
34401  */
34402  __pyx_t_2 = __pyx_v_memslice->strides;
34403  __pyx_v_strides = __pyx_t_2;
34404 
34405  /* "View.MemoryView":951
34406  *
34407  * cdef int i, j
34408  * for i in range(ndim / 2): # <<<<<<<<<<<<<<
34409  * j = ndim - 1 - i
34410  * strides[i], strides[j] = strides[j], strides[i]
34411  */
34412  __pyx_t_3 = (__pyx_v_ndim / 2);
34413  __pyx_t_4 = __pyx_t_3;
34414  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
34415  __pyx_v_i = __pyx_t_1;
34416 
34417  /* "View.MemoryView":952
34418  * cdef int i, j
34419  * for i in range(ndim / 2):
34420  * j = ndim - 1 - i # <<<<<<<<<<<<<<
34421  * strides[i], strides[j] = strides[j], strides[i]
34422  * shape[i], shape[j] = shape[j], shape[i]
34423  */
34424  __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
34425 
34426  /* "View.MemoryView":953
34427  * for i in range(ndim / 2):
34428  * j = ndim - 1 - i
34429  * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
34430  * shape[i], shape[j] = shape[j], shape[i]
34431  *
34432  */
34433  __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
34434  __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
34435  (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
34436  (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
34437 
34438  /* "View.MemoryView":954
34439  * j = ndim - 1 - i
34440  * strides[i], strides[j] = strides[j], strides[i]
34441  * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
34442  *
34443  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
34444  */
34445  __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
34446  __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
34447  (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
34448  (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
34449 
34450  /* "View.MemoryView":956
34451  * shape[i], shape[j] = shape[j], shape[i]
34452  *
34453  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
34454  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
34455  *
34456  */
34457  __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
34458  if (!__pyx_t_8) {
34459  } else {
34460  __pyx_t_7 = __pyx_t_8;
34461  goto __pyx_L6_bool_binop_done;
34462  }
34463  __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
34464  __pyx_t_7 = __pyx_t_8;
34465  __pyx_L6_bool_binop_done:;
34466  if (__pyx_t_7) {
34467 
34468  /* "View.MemoryView":957
34469  *
34470  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
34471  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
34472  *
34473  * return 1
34474  */
34475  __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error)
34476 
34477  /* "View.MemoryView":956
34478  * shape[i], shape[j] = shape[j], shape[i]
34479  *
34480  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
34481  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
34482  *
34483  */
34484  }
34485  }
34486 
34487  /* "View.MemoryView":959
34488  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
34489  *
34490  * return 1 # <<<<<<<<<<<<<<
34491  *
34492  *
34493  */
34494  __pyx_r = 1;
34495  goto __pyx_L0;
34496 
34497  /* "View.MemoryView":943
34498  *
34499  * @cname('__pyx_memslice_transpose')
34500  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
34501  * cdef int ndim = memslice.memview.view.ndim
34502  *
34503  */
34504 
34505  /* function exit code */
34506  __pyx_L1_error:;
34507  {
34508  #ifdef WITH_THREAD
34509  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
34510  #endif
34511  __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
34512  #ifdef WITH_THREAD
34513  __Pyx_PyGILState_Release(__pyx_gilstate_save);
34514  #endif
34515  }
34516  __pyx_r = 0;
34517  __pyx_L0:;
34518  return __pyx_r;
34519 }
34520 
34521 /* "View.MemoryView":976
34522  * cdef int (*to_dtype_func)(char *, object) except 0
34523  *
34524  * def __dealloc__(self): # <<<<<<<<<<<<<<
34525  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
34526  *
34527  */
34528 
34529 /* Python wrapper */
34530 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
34531 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
34532  __Pyx_RefNannyDeclarations
34533  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
34534  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
34535 
34536  /* function exit code */
34537  __Pyx_RefNannyFinishContext();
34538 }
34539 
34540 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
34541  __Pyx_RefNannyDeclarations
34542  __Pyx_RefNannySetupContext("__dealloc__", 0);
34543 
34544  /* "View.MemoryView":977
34545  *
34546  * def __dealloc__(self):
34547  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
34548  *
34549  * cdef convert_item_to_object(self, char *itemp):
34550  */
34551  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
34552 
34553  /* "View.MemoryView":976
34554  * cdef int (*to_dtype_func)(char *, object) except 0
34555  *
34556  * def __dealloc__(self): # <<<<<<<<<<<<<<
34557  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
34558  *
34559  */
34560 
34561  /* function exit code */
34562  __Pyx_RefNannyFinishContext();
34563 }
34564 
34565 /* "View.MemoryView":979
34566  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
34567  *
34568  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
34569  * if self.to_object_func != NULL:
34570  * return self.to_object_func(itemp)
34571  */
34572 
34573 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
34574  PyObject *__pyx_r = NULL;
34575  __Pyx_RefNannyDeclarations
34576  int __pyx_t_1;
34577  PyObject *__pyx_t_2 = NULL;
34578  int __pyx_lineno = 0;
34579  const char *__pyx_filename = NULL;
34580  int __pyx_clineno = 0;
34581  __Pyx_RefNannySetupContext("convert_item_to_object", 0);
34582 
34583  /* "View.MemoryView":980
34584  *
34585  * cdef convert_item_to_object(self, char *itemp):
34586  * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
34587  * return self.to_object_func(itemp)
34588  * else:
34589  */
34590  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
34591  if (__pyx_t_1) {
34592 
34593  /* "View.MemoryView":981
34594  * cdef convert_item_to_object(self, char *itemp):
34595  * if self.to_object_func != NULL:
34596  * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
34597  * else:
34598  * return memoryview.convert_item_to_object(self, itemp)
34599  */
34600  __Pyx_XDECREF(__pyx_r);
34601  __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
34602  __Pyx_GOTREF(__pyx_t_2);
34603  __pyx_r = __pyx_t_2;
34604  __pyx_t_2 = 0;
34605  goto __pyx_L0;
34606 
34607  /* "View.MemoryView":980
34608  *
34609  * cdef convert_item_to_object(self, char *itemp):
34610  * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
34611  * return self.to_object_func(itemp)
34612  * else:
34613  */
34614  }
34615 
34616  /* "View.MemoryView":983
34617  * return self.to_object_func(itemp)
34618  * else:
34619  * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
34620  *
34621  * cdef assign_item_from_object(self, char *itemp, object value):
34622  */
34623  /*else*/ {
34624  __Pyx_XDECREF(__pyx_r);
34625  __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
34626  __Pyx_GOTREF(__pyx_t_2);
34627  __pyx_r = __pyx_t_2;
34628  __pyx_t_2 = 0;
34629  goto __pyx_L0;
34630  }
34631 
34632  /* "View.MemoryView":979
34633  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
34634  *
34635  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
34636  * if self.to_object_func != NULL:
34637  * return self.to_object_func(itemp)
34638  */
34639 
34640  /* function exit code */
34641  __pyx_L1_error:;
34642  __Pyx_XDECREF(__pyx_t_2);
34643  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
34644  __pyx_r = 0;
34645  __pyx_L0:;
34646  __Pyx_XGIVEREF(__pyx_r);
34647  __Pyx_RefNannyFinishContext();
34648  return __pyx_r;
34649 }
34650 
34651 /* "View.MemoryView":985
34652  * return memoryview.convert_item_to_object(self, itemp)
34653  *
34654  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
34655  * if self.to_dtype_func != NULL:
34656  * self.to_dtype_func(itemp, value)
34657  */
34658 
34659 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
34660  PyObject *__pyx_r = NULL;
34661  __Pyx_RefNannyDeclarations
34662  int __pyx_t_1;
34663  int __pyx_t_2;
34664  PyObject *__pyx_t_3 = NULL;
34665  int __pyx_lineno = 0;
34666  const char *__pyx_filename = NULL;
34667  int __pyx_clineno = 0;
34668  __Pyx_RefNannySetupContext("assign_item_from_object", 0);
34669 
34670  /* "View.MemoryView":986
34671  *
34672  * cdef assign_item_from_object(self, char *itemp, object value):
34673  * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
34674  * self.to_dtype_func(itemp, value)
34675  * else:
34676  */
34677  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
34678  if (__pyx_t_1) {
34679 
34680  /* "View.MemoryView":987
34681  * cdef assign_item_from_object(self, char *itemp, object value):
34682  * if self.to_dtype_func != NULL:
34683  * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
34684  * else:
34685  * memoryview.assign_item_from_object(self, itemp, value)
34686  */
34687  __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
34688 
34689  /* "View.MemoryView":986
34690  *
34691  * cdef assign_item_from_object(self, char *itemp, object value):
34692  * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
34693  * self.to_dtype_func(itemp, value)
34694  * else:
34695  */
34696  goto __pyx_L3;
34697  }
34698 
34699  /* "View.MemoryView":989
34700  * self.to_dtype_func(itemp, value)
34701  * else:
34702  * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
34703  *
34704  * @property
34705  */
34706  /*else*/ {
34707  __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error)
34708  __Pyx_GOTREF(__pyx_t_3);
34709  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34710  }
34711  __pyx_L3:;
34712 
34713  /* "View.MemoryView":985
34714  * return memoryview.convert_item_to_object(self, itemp)
34715  *
34716  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
34717  * if self.to_dtype_func != NULL:
34718  * self.to_dtype_func(itemp, value)
34719  */
34720 
34721  /* function exit code */
34722  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34723  goto __pyx_L0;
34724  __pyx_L1_error:;
34725  __Pyx_XDECREF(__pyx_t_3);
34726  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
34727  __pyx_r = 0;
34728  __pyx_L0:;
34729  __Pyx_XGIVEREF(__pyx_r);
34730  __Pyx_RefNannyFinishContext();
34731  return __pyx_r;
34732 }
34733 
34734 /* "View.MemoryView":992
34735  *
34736  * @property
34737  * def base(self): # <<<<<<<<<<<<<<
34738  * return self.from_object
34739  *
34740  */
34741 
34742 /* Python wrapper */
34743 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
34744 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
34745  PyObject *__pyx_r = 0;
34746  __Pyx_RefNannyDeclarations
34747  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
34748  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
34749 
34750  /* function exit code */
34751  __Pyx_RefNannyFinishContext();
34752  return __pyx_r;
34753 }
34754 
34755 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
34756  PyObject *__pyx_r = NULL;
34757  __Pyx_RefNannyDeclarations
34758  __Pyx_RefNannySetupContext("__get__", 0);
34759 
34760  /* "View.MemoryView":993
34761  * @property
34762  * def base(self):
34763  * return self.from_object # <<<<<<<<<<<<<<
34764  *
34765  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
34766  */
34767  __Pyx_XDECREF(__pyx_r);
34768  __Pyx_INCREF(__pyx_v_self->from_object);
34769  __pyx_r = __pyx_v_self->from_object;
34770  goto __pyx_L0;
34771 
34772  /* "View.MemoryView":992
34773  *
34774  * @property
34775  * def base(self): # <<<<<<<<<<<<<<
34776  * return self.from_object
34777  *
34778  */
34779 
34780  /* function exit code */
34781  __pyx_L0:;
34782  __Pyx_XGIVEREF(__pyx_r);
34783  __Pyx_RefNannyFinishContext();
34784  return __pyx_r;
34785 }
34786 
34787 /* "(tree fragment)":1
34788  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
34789  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34790  * def __setstate_cython__(self, __pyx_state):
34791  */
34792 
34793 /* Python wrapper */
34794 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
34795 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
34796  PyObject *__pyx_r = 0;
34797  __Pyx_RefNannyDeclarations
34798  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
34799  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
34800 
34801  /* function exit code */
34802  __Pyx_RefNannyFinishContext();
34803  return __pyx_r;
34804 }
34805 
34806 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
34807  PyObject *__pyx_r = NULL;
34808  __Pyx_RefNannyDeclarations
34809  PyObject *__pyx_t_1 = NULL;
34810  int __pyx_lineno = 0;
34811  const char *__pyx_filename = NULL;
34812  int __pyx_clineno = 0;
34813  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
34814 
34815  /* "(tree fragment)":2
34816  * def __reduce_cython__(self):
34817  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
34818  * def __setstate_cython__(self, __pyx_state):
34819  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34820  */
34821  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
34822  __Pyx_GOTREF(__pyx_t_1);
34823  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
34824  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34825  __PYX_ERR(2, 2, __pyx_L1_error)
34826 
34827  /* "(tree fragment)":1
34828  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
34829  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34830  * def __setstate_cython__(self, __pyx_state):
34831  */
34832 
34833  /* function exit code */
34834  __pyx_L1_error:;
34835  __Pyx_XDECREF(__pyx_t_1);
34836  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34837  __pyx_r = NULL;
34838  __Pyx_XGIVEREF(__pyx_r);
34839  __Pyx_RefNannyFinishContext();
34840  return __pyx_r;
34841 }
34842 
34843 /* "(tree fragment)":3
34844  * def __reduce_cython__(self):
34845  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34846  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
34847  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34848  */
34849 
34850 /* Python wrapper */
34851 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
34852 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
34853  PyObject *__pyx_r = 0;
34854  __Pyx_RefNannyDeclarations
34855  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
34856  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
34857 
34858  /* function exit code */
34859  __Pyx_RefNannyFinishContext();
34860  return __pyx_r;
34861 }
34862 
34863 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
34864  PyObject *__pyx_r = NULL;
34865  __Pyx_RefNannyDeclarations
34866  PyObject *__pyx_t_1 = NULL;
34867  int __pyx_lineno = 0;
34868  const char *__pyx_filename = NULL;
34869  int __pyx_clineno = 0;
34870  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
34871 
34872  /* "(tree fragment)":4
34873  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34874  * def __setstate_cython__(self, __pyx_state):
34875  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
34876  */
34877  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
34878  __Pyx_GOTREF(__pyx_t_1);
34879  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
34880  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
34881  __PYX_ERR(2, 4, __pyx_L1_error)
34882 
34883  /* "(tree fragment)":3
34884  * def __reduce_cython__(self):
34885  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34886  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
34887  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
34888  */
34889 
34890  /* function exit code */
34891  __pyx_L1_error:;
34892  __Pyx_XDECREF(__pyx_t_1);
34893  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
34894  __pyx_r = NULL;
34895  __Pyx_XGIVEREF(__pyx_r);
34896  __Pyx_RefNannyFinishContext();
34897  return __pyx_r;
34898 }
34899 
34900 /* "View.MemoryView":999
34901  *
34902  * @cname('__pyx_memoryview_fromslice')
34903  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
34904  * int ndim,
34905  * object (*to_object_func)(char *),
34906  */
34907 
34908 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
34909  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
34910  Py_ssize_t __pyx_v_suboffset;
34911  PyObject *__pyx_v_length = NULL;
34912  PyObject *__pyx_r = NULL;
34913  __Pyx_RefNannyDeclarations
34914  int __pyx_t_1;
34915  PyObject *__pyx_t_2 = NULL;
34916  PyObject *__pyx_t_3 = NULL;
34917  __Pyx_TypeInfo *__pyx_t_4;
34918  Py_buffer __pyx_t_5;
34919  Py_ssize_t *__pyx_t_6;
34920  Py_ssize_t *__pyx_t_7;
34921  Py_ssize_t *__pyx_t_8;
34922  Py_ssize_t __pyx_t_9;
34923  int __pyx_lineno = 0;
34924  const char *__pyx_filename = NULL;
34925  int __pyx_clineno = 0;
34926  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
34927 
34928  /* "View.MemoryView":1007
34929  * cdef _memoryviewslice result
34930  *
34931  * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
34932  * return None
34933  *
34934  */
34935  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
34936  if (__pyx_t_1) {
34937 
34938  /* "View.MemoryView":1008
34939  *
34940  * if <PyObject *> memviewslice.memview == Py_None:
34941  * return None # <<<<<<<<<<<<<<
34942  *
34943  *
34944  */
34945  __Pyx_XDECREF(__pyx_r);
34946  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
34947  goto __pyx_L0;
34948 
34949  /* "View.MemoryView":1007
34950  * cdef _memoryviewslice result
34951  *
34952  * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
34953  * return None
34954  *
34955  */
34956  }
34957 
34958  /* "View.MemoryView":1013
34959  *
34960  *
34961  * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
34962  *
34963  * result.from_slice = memviewslice
34964  */
34965  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
34966  __Pyx_GOTREF(__pyx_t_2);
34967  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
34968  __Pyx_GOTREF(__pyx_t_3);
34969  __Pyx_INCREF(Py_None);
34970  __Pyx_GIVEREF(Py_None);
34971  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
34972  __Pyx_INCREF(__pyx_int_0);
34973  __Pyx_GIVEREF(__pyx_int_0);
34974  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
34975  __Pyx_GIVEREF(__pyx_t_2);
34976  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
34977  __pyx_t_2 = 0;
34978  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
34979  __Pyx_GOTREF(__pyx_t_2);
34980  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
34981  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
34982  __pyx_t_2 = 0;
34983 
34984  /* "View.MemoryView":1015
34985  * result = _memoryviewslice(None, 0, dtype_is_object)
34986  *
34987  * result.from_slice = memviewslice # <<<<<<<<<<<<<<
34988  * __PYX_INC_MEMVIEW(&memviewslice, 1)
34989  *
34990  */
34991  __pyx_v_result->from_slice = __pyx_v_memviewslice;
34992 
34993  /* "View.MemoryView":1016
34994  *
34995  * result.from_slice = memviewslice
34996  * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
34997  *
34998  * result.from_object = (<memoryview> memviewslice.memview).base
34999  */
35000  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
35001 
35002  /* "View.MemoryView":1018
35003  * __PYX_INC_MEMVIEW(&memviewslice, 1)
35004  *
35005  * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
35006  * result.typeinfo = memviewslice.memview.typeinfo
35007  *
35008  */
35009  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
35010  __Pyx_GOTREF(__pyx_t_2);
35011  __Pyx_GIVEREF(__pyx_t_2);
35012  __Pyx_GOTREF(__pyx_v_result->from_object);
35013  __Pyx_DECREF(__pyx_v_result->from_object);
35014  __pyx_v_result->from_object = __pyx_t_2;
35015  __pyx_t_2 = 0;
35016 
35017  /* "View.MemoryView":1019
35018  *
35019  * result.from_object = (<memoryview> memviewslice.memview).base
35020  * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
35021  *
35022  * result.view = memviewslice.memview.view
35023  */
35024  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
35025  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
35026 
35027  /* "View.MemoryView":1021
35028  * result.typeinfo = memviewslice.memview.typeinfo
35029  *
35030  * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
35031  * result.view.buf = <void *> memviewslice.data
35032  * result.view.ndim = ndim
35033  */
35034  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
35035  __pyx_v_result->__pyx_base.view = __pyx_t_5;
35036 
35037  /* "View.MemoryView":1022
35038  *
35039  * result.view = memviewslice.memview.view
35040  * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
35041  * result.view.ndim = ndim
35042  * (<__pyx_buffer *> &result.view).obj = Py_None
35043  */
35044  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
35045 
35046  /* "View.MemoryView":1023
35047  * result.view = memviewslice.memview.view
35048  * result.view.buf = <void *> memviewslice.data
35049  * result.view.ndim = ndim # <<<<<<<<<<<<<<
35050  * (<__pyx_buffer *> &result.view).obj = Py_None
35051  * Py_INCREF(Py_None)
35052  */
35053  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
35054 
35055  /* "View.MemoryView":1024
35056  * result.view.buf = <void *> memviewslice.data
35057  * result.view.ndim = ndim
35058  * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
35059  * Py_INCREF(Py_None)
35060  *
35061  */
35062  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
35063 
35064  /* "View.MemoryView":1025
35065  * result.view.ndim = ndim
35066  * (<__pyx_buffer *> &result.view).obj = Py_None
35067  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
35068  *
35069  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
35070  */
35071  Py_INCREF(Py_None);
35072 
35073  /* "View.MemoryView":1027
35074  * Py_INCREF(Py_None)
35075  *
35076  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
35077  * result.flags = PyBUF_RECORDS
35078  * else:
35079  */
35080  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
35081  if (__pyx_t_1) {
35082 
35083  /* "View.MemoryView":1028
35084  *
35085  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
35086  * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
35087  * else:
35088  * result.flags = PyBUF_RECORDS_RO
35089  */
35090  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
35091 
35092  /* "View.MemoryView":1027
35093  * Py_INCREF(Py_None)
35094  *
35095  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
35096  * result.flags = PyBUF_RECORDS
35097  * else:
35098  */
35099  goto __pyx_L4;
35100  }
35101 
35102  /* "View.MemoryView":1030
35103  * result.flags = PyBUF_RECORDS
35104  * else:
35105  * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
35106  *
35107  * result.view.shape = <Py_ssize_t *> result.from_slice.shape
35108  */
35109  /*else*/ {
35110  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
35111  }
35112  __pyx_L4:;
35113 
35114  /* "View.MemoryView":1032
35115  * result.flags = PyBUF_RECORDS_RO
35116  *
35117  * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
35118  * result.view.strides = <Py_ssize_t *> result.from_slice.strides
35119  *
35120  */
35121  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
35122 
35123  /* "View.MemoryView":1033
35124  *
35125  * result.view.shape = <Py_ssize_t *> result.from_slice.shape
35126  * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
35127  *
35128  *
35129  */
35130  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
35131 
35132  /* "View.MemoryView":1036
35133  *
35134  *
35135  * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
35136  * for suboffset in result.from_slice.suboffsets[:ndim]:
35137  * if suboffset >= 0:
35138  */
35139  __pyx_v_result->__pyx_base.view.suboffsets = NULL;
35140 
35141  /* "View.MemoryView":1037
35142  *
35143  * result.view.suboffsets = NULL
35144  * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
35145  * if suboffset >= 0:
35146  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35147  */
35148  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
35149  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
35150  __pyx_t_6 = __pyx_t_8;
35151  __pyx_v_suboffset = (__pyx_t_6[0]);
35152 
35153  /* "View.MemoryView":1038
35154  * result.view.suboffsets = NULL
35155  * for suboffset in result.from_slice.suboffsets[:ndim]:
35156  * if suboffset >= 0: # <<<<<<<<<<<<<<
35157  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35158  * break
35159  */
35160  __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
35161  if (__pyx_t_1) {
35162 
35163  /* "View.MemoryView":1039
35164  * for suboffset in result.from_slice.suboffsets[:ndim]:
35165  * if suboffset >= 0:
35166  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
35167  * break
35168  *
35169  */
35170  __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
35171 
35172  /* "View.MemoryView":1040
35173  * if suboffset >= 0:
35174  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35175  * break # <<<<<<<<<<<<<<
35176  *
35177  * result.view.len = result.view.itemsize
35178  */
35179  goto __pyx_L6_break;
35180 
35181  /* "View.MemoryView":1038
35182  * result.view.suboffsets = NULL
35183  * for suboffset in result.from_slice.suboffsets[:ndim]:
35184  * if suboffset >= 0: # <<<<<<<<<<<<<<
35185  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
35186  * break
35187  */
35188  }
35189  }
35190  __pyx_L6_break:;
35191 
35192  /* "View.MemoryView":1042
35193  * break
35194  *
35195  * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
35196  * for length in result.view.shape[:ndim]:
35197  * result.view.len *= length
35198  */
35199  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
35200  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
35201 
35202  /* "View.MemoryView":1043
35203  *
35204  * result.view.len = result.view.itemsize
35205  * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
35206  * result.view.len *= length
35207  *
35208  */
35209  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
35210  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
35211  __pyx_t_6 = __pyx_t_8;
35212  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
35213  __Pyx_GOTREF(__pyx_t_2);
35214  __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
35215  __pyx_t_2 = 0;
35216 
35217  /* "View.MemoryView":1044
35218  * result.view.len = result.view.itemsize
35219  * for length in result.view.shape[:ndim]:
35220  * result.view.len *= length # <<<<<<<<<<<<<<
35221  *
35222  * result.to_object_func = to_object_func
35223  */
35224  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
35225  __Pyx_GOTREF(__pyx_t_2);
35226  __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
35227  __Pyx_GOTREF(__pyx_t_3);
35228  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
35229  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
35230  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
35231  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
35232  }
35233 
35234  /* "View.MemoryView":1046
35235  * result.view.len *= length
35236  *
35237  * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
35238  * result.to_dtype_func = to_dtype_func
35239  *
35240  */
35241  __pyx_v_result->to_object_func = __pyx_v_to_object_func;
35242 
35243  /* "View.MemoryView":1047
35244  *
35245  * result.to_object_func = to_object_func
35246  * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
35247  *
35248  * return result
35249  */
35250  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
35251 
35252  /* "View.MemoryView":1049
35253  * result.to_dtype_func = to_dtype_func
35254  *
35255  * return result # <<<<<<<<<<<<<<
35256  *
35257  * @cname('__pyx_memoryview_get_slice_from_memoryview')
35258  */
35259  __Pyx_XDECREF(__pyx_r);
35260  __Pyx_INCREF(((PyObject *)__pyx_v_result));
35261  __pyx_r = ((PyObject *)__pyx_v_result);
35262  goto __pyx_L0;
35263 
35264  /* "View.MemoryView":999
35265  *
35266  * @cname('__pyx_memoryview_fromslice')
35267  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
35268  * int ndim,
35269  * object (*to_object_func)(char *),
35270  */
35271 
35272  /* function exit code */
35273  __pyx_L1_error:;
35274  __Pyx_XDECREF(__pyx_t_2);
35275  __Pyx_XDECREF(__pyx_t_3);
35276  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
35277  __pyx_r = 0;
35278  __pyx_L0:;
35279  __Pyx_XDECREF((PyObject *)__pyx_v_result);
35280  __Pyx_XDECREF(__pyx_v_length);
35281  __Pyx_XGIVEREF(__pyx_r);
35282  __Pyx_RefNannyFinishContext();
35283  return __pyx_r;
35284 }
35285 
35286 /* "View.MemoryView":1052
35287  *
35288  * @cname('__pyx_memoryview_get_slice_from_memoryview')
35289  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
35290  * __Pyx_memviewslice *mslice) except NULL:
35291  * cdef _memoryviewslice obj
35292  */
35293 
35294 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
35295  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
35296  __Pyx_memviewslice *__pyx_r;
35297  __Pyx_RefNannyDeclarations
35298  int __pyx_t_1;
35299  int __pyx_t_2;
35300  PyObject *__pyx_t_3 = NULL;
35301  int __pyx_lineno = 0;
35302  const char *__pyx_filename = NULL;
35303  int __pyx_clineno = 0;
35304  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
35305 
35306  /* "View.MemoryView":1055
35307  * __Pyx_memviewslice *mslice) except NULL:
35308  * cdef _memoryviewslice obj
35309  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
35310  * obj = memview
35311  * return &obj.from_slice
35312  */
35313  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
35314  __pyx_t_2 = (__pyx_t_1 != 0);
35315  if (__pyx_t_2) {
35316 
35317  /* "View.MemoryView":1056
35318  * cdef _memoryviewslice obj
35319  * if isinstance(memview, _memoryviewslice):
35320  * obj = memview # <<<<<<<<<<<<<<
35321  * return &obj.from_slice
35322  * else:
35323  */
35324  if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
35325  __pyx_t_3 = ((PyObject *)__pyx_v_memview);
35326  __Pyx_INCREF(__pyx_t_3);
35327  __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
35328  __pyx_t_3 = 0;
35329 
35330  /* "View.MemoryView":1057
35331  * if isinstance(memview, _memoryviewslice):
35332  * obj = memview
35333  * return &obj.from_slice # <<<<<<<<<<<<<<
35334  * else:
35335  * slice_copy(memview, mslice)
35336  */
35337  __pyx_r = (&__pyx_v_obj->from_slice);
35338  goto __pyx_L0;
35339 
35340  /* "View.MemoryView":1055
35341  * __Pyx_memviewslice *mslice) except NULL:
35342  * cdef _memoryviewslice obj
35343  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
35344  * obj = memview
35345  * return &obj.from_slice
35346  */
35347  }
35348 
35349  /* "View.MemoryView":1059
35350  * return &obj.from_slice
35351  * else:
35352  * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
35353  * return mslice
35354  *
35355  */
35356  /*else*/ {
35357  __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
35358 
35359  /* "View.MemoryView":1060
35360  * else:
35361  * slice_copy(memview, mslice)
35362  * return mslice # <<<<<<<<<<<<<<
35363  *
35364  * @cname('__pyx_memoryview_slice_copy')
35365  */
35366  __pyx_r = __pyx_v_mslice;
35367  goto __pyx_L0;
35368  }
35369 
35370  /* "View.MemoryView":1052
35371  *
35372  * @cname('__pyx_memoryview_get_slice_from_memoryview')
35373  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
35374  * __Pyx_memviewslice *mslice) except NULL:
35375  * cdef _memoryviewslice obj
35376  */
35377 
35378  /* function exit code */
35379  __pyx_L1_error:;
35380  __Pyx_XDECREF(__pyx_t_3);
35381  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
35382  __pyx_r = NULL;
35383  __pyx_L0:;
35384  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
35385  __Pyx_RefNannyFinishContext();
35386  return __pyx_r;
35387 }
35388 
35389 /* "View.MemoryView":1063
35390  *
35391  * @cname('__pyx_memoryview_slice_copy')
35392  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
35393  * cdef int dim
35394  * cdef (Py_ssize_t*) shape, strides, suboffsets
35395  */
35396 
35397 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
35398  int __pyx_v_dim;
35399  Py_ssize_t *__pyx_v_shape;
35400  Py_ssize_t *__pyx_v_strides;
35401  Py_ssize_t *__pyx_v_suboffsets;
35402  __Pyx_RefNannyDeclarations
35403  Py_ssize_t *__pyx_t_1;
35404  int __pyx_t_2;
35405  int __pyx_t_3;
35406  int __pyx_t_4;
35407  Py_ssize_t __pyx_t_5;
35408  __Pyx_RefNannySetupContext("slice_copy", 0);
35409 
35410  /* "View.MemoryView":1067
35411  * cdef (Py_ssize_t*) shape, strides, suboffsets
35412  *
35413  * shape = memview.view.shape # <<<<<<<<<<<<<<
35414  * strides = memview.view.strides
35415  * suboffsets = memview.view.suboffsets
35416  */
35417  __pyx_t_1 = __pyx_v_memview->view.shape;
35418  __pyx_v_shape = __pyx_t_1;
35419 
35420  /* "View.MemoryView":1068
35421  *
35422  * shape = memview.view.shape
35423  * strides = memview.view.strides # <<<<<<<<<<<<<<
35424  * suboffsets = memview.view.suboffsets
35425  *
35426  */
35427  __pyx_t_1 = __pyx_v_memview->view.strides;
35428  __pyx_v_strides = __pyx_t_1;
35429 
35430  /* "View.MemoryView":1069
35431  * shape = memview.view.shape
35432  * strides = memview.view.strides
35433  * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
35434  *
35435  * dst.memview = <__pyx_memoryview *> memview
35436  */
35437  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
35438  __pyx_v_suboffsets = __pyx_t_1;
35439 
35440  /* "View.MemoryView":1071
35441  * suboffsets = memview.view.suboffsets
35442  *
35443  * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
35444  * dst.data = <char *> memview.view.buf
35445  *
35446  */
35447  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
35448 
35449  /* "View.MemoryView":1072
35450  *
35451  * dst.memview = <__pyx_memoryview *> memview
35452  * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
35453  *
35454  * for dim in range(memview.view.ndim):
35455  */
35456  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
35457 
35458  /* "View.MemoryView":1074
35459  * dst.data = <char *> memview.view.buf
35460  *
35461  * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
35462  * dst.shape[dim] = shape[dim]
35463  * dst.strides[dim] = strides[dim]
35464  */
35465  __pyx_t_2 = __pyx_v_memview->view.ndim;
35466  __pyx_t_3 = __pyx_t_2;
35467  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
35468  __pyx_v_dim = __pyx_t_4;
35469 
35470  /* "View.MemoryView":1075
35471  *
35472  * for dim in range(memview.view.ndim):
35473  * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
35474  * dst.strides[dim] = strides[dim]
35475  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
35476  */
35477  (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
35478 
35479  /* "View.MemoryView":1076
35480  * for dim in range(memview.view.ndim):
35481  * dst.shape[dim] = shape[dim]
35482  * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
35483  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
35484  *
35485  */
35486  (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
35487 
35488  /* "View.MemoryView":1077
35489  * dst.shape[dim] = shape[dim]
35490  * dst.strides[dim] = strides[dim]
35491  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
35492  *
35493  * @cname('__pyx_memoryview_copy_object')
35494  */
35495  if ((__pyx_v_suboffsets != 0)) {
35496  __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
35497  } else {
35498  __pyx_t_5 = -1L;
35499  }
35500  (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
35501  }
35502 
35503  /* "View.MemoryView":1063
35504  *
35505  * @cname('__pyx_memoryview_slice_copy')
35506  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
35507  * cdef int dim
35508  * cdef (Py_ssize_t*) shape, strides, suboffsets
35509  */
35510 
35511  /* function exit code */
35512  __Pyx_RefNannyFinishContext();
35513 }
35514 
35515 /* "View.MemoryView":1080
35516  *
35517  * @cname('__pyx_memoryview_copy_object')
35518  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
35519  * "Create a new memoryview object"
35520  * cdef __Pyx_memviewslice memviewslice
35521  */
35522 
35523 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
35524  __Pyx_memviewslice __pyx_v_memviewslice;
35525  PyObject *__pyx_r = NULL;
35526  __Pyx_RefNannyDeclarations
35527  PyObject *__pyx_t_1 = NULL;
35528  int __pyx_lineno = 0;
35529  const char *__pyx_filename = NULL;
35530  int __pyx_clineno = 0;
35531  __Pyx_RefNannySetupContext("memoryview_copy", 0);
35532 
35533  /* "View.MemoryView":1083
35534  * "Create a new memoryview object"
35535  * cdef __Pyx_memviewslice memviewslice
35536  * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
35537  * return memoryview_copy_from_slice(memview, &memviewslice)
35538  *
35539  */
35540  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
35541 
35542  /* "View.MemoryView":1084
35543  * cdef __Pyx_memviewslice memviewslice
35544  * slice_copy(memview, &memviewslice)
35545  * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
35546  *
35547  * @cname('__pyx_memoryview_copy_object_from_slice')
35548  */
35549  __Pyx_XDECREF(__pyx_r);
35550  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
35551  __Pyx_GOTREF(__pyx_t_1);
35552  __pyx_r = __pyx_t_1;
35553  __pyx_t_1 = 0;
35554  goto __pyx_L0;
35555 
35556  /* "View.MemoryView":1080
35557  *
35558  * @cname('__pyx_memoryview_copy_object')
35559  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
35560  * "Create a new memoryview object"
35561  * cdef __Pyx_memviewslice memviewslice
35562  */
35563 
35564  /* function exit code */
35565  __pyx_L1_error:;
35566  __Pyx_XDECREF(__pyx_t_1);
35567  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
35568  __pyx_r = 0;
35569  __pyx_L0:;
35570  __Pyx_XGIVEREF(__pyx_r);
35571  __Pyx_RefNannyFinishContext();
35572  return __pyx_r;
35573 }
35574 
35575 /* "View.MemoryView":1087
35576  *
35577  * @cname('__pyx_memoryview_copy_object_from_slice')
35578  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
35579  * """
35580  * Create a new memoryview object from a given memoryview object and slice.
35581  */
35582 
35583 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
35584  PyObject *(*__pyx_v_to_object_func)(char *);
35585  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
35586  PyObject *__pyx_r = NULL;
35587  __Pyx_RefNannyDeclarations
35588  int __pyx_t_1;
35589  int __pyx_t_2;
35590  PyObject *(*__pyx_t_3)(char *);
35591  int (*__pyx_t_4)(char *, PyObject *);
35592  PyObject *__pyx_t_5 = NULL;
35593  int __pyx_lineno = 0;
35594  const char *__pyx_filename = NULL;
35595  int __pyx_clineno = 0;
35596  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
35597 
35598  /* "View.MemoryView":1094
35599  * cdef int (*to_dtype_func)(char *, object) except 0
35600  *
35601  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
35602  * to_object_func = (<_memoryviewslice> memview).to_object_func
35603  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
35604  */
35605  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
35606  __pyx_t_2 = (__pyx_t_1 != 0);
35607  if (__pyx_t_2) {
35608 
35609  /* "View.MemoryView":1095
35610  *
35611  * if isinstance(memview, _memoryviewslice):
35612  * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
35613  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
35614  * else:
35615  */
35616  __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
35617  __pyx_v_to_object_func = __pyx_t_3;
35618 
35619  /* "View.MemoryView":1096
35620  * if isinstance(memview, _memoryviewslice):
35621  * to_object_func = (<_memoryviewslice> memview).to_object_func
35622  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
35623  * else:
35624  * to_object_func = NULL
35625  */
35626  __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
35627  __pyx_v_to_dtype_func = __pyx_t_4;
35628 
35629  /* "View.MemoryView":1094
35630  * cdef int (*to_dtype_func)(char *, object) except 0
35631  *
35632  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
35633  * to_object_func = (<_memoryviewslice> memview).to_object_func
35634  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
35635  */
35636  goto __pyx_L3;
35637  }
35638 
35639  /* "View.MemoryView":1098
35640  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
35641  * else:
35642  * to_object_func = NULL # <<<<<<<<<<<<<<
35643  * to_dtype_func = NULL
35644  *
35645  */
35646  /*else*/ {
35647  __pyx_v_to_object_func = NULL;
35648 
35649  /* "View.MemoryView":1099
35650  * else:
35651  * to_object_func = NULL
35652  * to_dtype_func = NULL # <<<<<<<<<<<<<<
35653  *
35654  * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
35655  */
35656  __pyx_v_to_dtype_func = NULL;
35657  }
35658  __pyx_L3:;
35659 
35660  /* "View.MemoryView":1101
35661  * to_dtype_func = NULL
35662  *
35663  * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
35664  * to_object_func, to_dtype_func,
35665  * memview.dtype_is_object)
35666  */
35667  __Pyx_XDECREF(__pyx_r);
35668 
35669  /* "View.MemoryView":1103
35670  * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
35671  * to_object_func, to_dtype_func,
35672  * memview.dtype_is_object) # <<<<<<<<<<<<<<
35673  *
35674  *
35675  */
35676  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error)
35677  __Pyx_GOTREF(__pyx_t_5);
35678  __pyx_r = __pyx_t_5;
35679  __pyx_t_5 = 0;
35680  goto __pyx_L0;
35681 
35682  /* "View.MemoryView":1087
35683  *
35684  * @cname('__pyx_memoryview_copy_object_from_slice')
35685  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
35686  * """
35687  * Create a new memoryview object from a given memoryview object and slice.
35688  */
35689 
35690  /* function exit code */
35691  __pyx_L1_error:;
35692  __Pyx_XDECREF(__pyx_t_5);
35693  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
35694  __pyx_r = 0;
35695  __pyx_L0:;
35696  __Pyx_XGIVEREF(__pyx_r);
35697  __Pyx_RefNannyFinishContext();
35698  return __pyx_r;
35699 }
35700 
35701 /* "View.MemoryView":1109
35702  *
35703  *
35704  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
35705  * if arg < 0:
35706  * return -arg
35707  */
35708 
35709 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
35710  Py_ssize_t __pyx_r;
35711  int __pyx_t_1;
35712 
35713  /* "View.MemoryView":1110
35714  *
35715  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
35716  * if arg < 0: # <<<<<<<<<<<<<<
35717  * return -arg
35718  * else:
35719  */
35720  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
35721  if (__pyx_t_1) {
35722 
35723  /* "View.MemoryView":1111
35724  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
35725  * if arg < 0:
35726  * return -arg # <<<<<<<<<<<<<<
35727  * else:
35728  * return arg
35729  */
35730  __pyx_r = (-__pyx_v_arg);
35731  goto __pyx_L0;
35732 
35733  /* "View.MemoryView":1110
35734  *
35735  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
35736  * if arg < 0: # <<<<<<<<<<<<<<
35737  * return -arg
35738  * else:
35739  */
35740  }
35741 
35742  /* "View.MemoryView":1113
35743  * return -arg
35744  * else:
35745  * return arg # <<<<<<<<<<<<<<
35746  *
35747  * @cname('__pyx_get_best_slice_order')
35748  */
35749  /*else*/ {
35750  __pyx_r = __pyx_v_arg;
35751  goto __pyx_L0;
35752  }
35753 
35754  /* "View.MemoryView":1109
35755  *
35756  *
35757  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
35758  * if arg < 0:
35759  * return -arg
35760  */
35761 
35762  /* function exit code */
35763  __pyx_L0:;
35764  return __pyx_r;
35765 }
35766 
35767 /* "View.MemoryView":1116
35768  *
35769  * @cname('__pyx_get_best_slice_order')
35770  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
35771  * """
35772  * Figure out the best memory access order for a given slice.
35773  */
35774 
35775 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
35776  int __pyx_v_i;
35777  Py_ssize_t __pyx_v_c_stride;
35778  Py_ssize_t __pyx_v_f_stride;
35779  char __pyx_r;
35780  int __pyx_t_1;
35781  int __pyx_t_2;
35782  int __pyx_t_3;
35783  int __pyx_t_4;
35784 
35785  /* "View.MemoryView":1121
35786  * """
35787  * cdef int i
35788  * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
35789  * cdef Py_ssize_t f_stride = 0
35790  *
35791  */
35792  __pyx_v_c_stride = 0;
35793 
35794  /* "View.MemoryView":1122
35795  * cdef int i
35796  * cdef Py_ssize_t c_stride = 0
35797  * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
35798  *
35799  * for i in range(ndim - 1, -1, -1):
35800  */
35801  __pyx_v_f_stride = 0;
35802 
35803  /* "View.MemoryView":1124
35804  * cdef Py_ssize_t f_stride = 0
35805  *
35806  * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
35807  * if mslice.shape[i] > 1:
35808  * c_stride = mslice.strides[i]
35809  */
35810  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
35811  __pyx_v_i = __pyx_t_1;
35812 
35813  /* "View.MemoryView":1125
35814  *
35815  * for i in range(ndim - 1, -1, -1):
35816  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
35817  * c_stride = mslice.strides[i]
35818  * break
35819  */
35820  __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
35821  if (__pyx_t_2) {
35822 
35823  /* "View.MemoryView":1126
35824  * for i in range(ndim - 1, -1, -1):
35825  * if mslice.shape[i] > 1:
35826  * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
35827  * break
35828  *
35829  */
35830  __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
35831 
35832  /* "View.MemoryView":1127
35833  * if mslice.shape[i] > 1:
35834  * c_stride = mslice.strides[i]
35835  * break # <<<<<<<<<<<<<<
35836  *
35837  * for i in range(ndim):
35838  */
35839  goto __pyx_L4_break;
35840 
35841  /* "View.MemoryView":1125
35842  *
35843  * for i in range(ndim - 1, -1, -1):
35844  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
35845  * c_stride = mslice.strides[i]
35846  * break
35847  */
35848  }
35849  }
35850  __pyx_L4_break:;
35851 
35852  /* "View.MemoryView":1129
35853  * break
35854  *
35855  * for i in range(ndim): # <<<<<<<<<<<<<<
35856  * if mslice.shape[i] > 1:
35857  * f_stride = mslice.strides[i]
35858  */
35859  __pyx_t_1 = __pyx_v_ndim;
35860  __pyx_t_3 = __pyx_t_1;
35861  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
35862  __pyx_v_i = __pyx_t_4;
35863 
35864  /* "View.MemoryView":1130
35865  *
35866  * for i in range(ndim):
35867  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
35868  * f_stride = mslice.strides[i]
35869  * break
35870  */
35871  __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
35872  if (__pyx_t_2) {
35873 
35874  /* "View.MemoryView":1131
35875  * for i in range(ndim):
35876  * if mslice.shape[i] > 1:
35877  * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
35878  * break
35879  *
35880  */
35881  __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
35882 
35883  /* "View.MemoryView":1132
35884  * if mslice.shape[i] > 1:
35885  * f_stride = mslice.strides[i]
35886  * break # <<<<<<<<<<<<<<
35887  *
35888  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
35889  */
35890  goto __pyx_L7_break;
35891 
35892  /* "View.MemoryView":1130
35893  *
35894  * for i in range(ndim):
35895  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
35896  * f_stride = mslice.strides[i]
35897  * break
35898  */
35899  }
35900  }
35901  __pyx_L7_break:;
35902 
35903  /* "View.MemoryView":1134
35904  * break
35905  *
35906  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
35907  * return 'C'
35908  * else:
35909  */
35910  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
35911  if (__pyx_t_2) {
35912 
35913  /* "View.MemoryView":1135
35914  *
35915  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
35916  * return 'C' # <<<<<<<<<<<<<<
35917  * else:
35918  * return 'F'
35919  */
35920  __pyx_r = 'C';
35921  goto __pyx_L0;
35922 
35923  /* "View.MemoryView":1134
35924  * break
35925  *
35926  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
35927  * return 'C'
35928  * else:
35929  */
35930  }
35931 
35932  /* "View.MemoryView":1137
35933  * return 'C'
35934  * else:
35935  * return 'F' # <<<<<<<<<<<<<<
35936  *
35937  * @cython.cdivision(True)
35938  */
35939  /*else*/ {
35940  __pyx_r = 'F';
35941  goto __pyx_L0;
35942  }
35943 
35944  /* "View.MemoryView":1116
35945  *
35946  * @cname('__pyx_get_best_slice_order')
35947  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
35948  * """
35949  * Figure out the best memory access order for a given slice.
35950  */
35951 
35952  /* function exit code */
35953  __pyx_L0:;
35954  return __pyx_r;
35955 }
35956 
35957 /* "View.MemoryView":1140
35958  *
35959  * @cython.cdivision(True)
35960  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
35961  * char *dst_data, Py_ssize_t *dst_strides,
35962  * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
35963  */
35964 
35965 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
35966  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
35967  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
35968  Py_ssize_t __pyx_v_dst_extent;
35969  Py_ssize_t __pyx_v_src_stride;
35970  Py_ssize_t __pyx_v_dst_stride;
35971  int __pyx_t_1;
35972  int __pyx_t_2;
35973  int __pyx_t_3;
35974  Py_ssize_t __pyx_t_4;
35975  Py_ssize_t __pyx_t_5;
35976  Py_ssize_t __pyx_t_6;
35977 
35978  /* "View.MemoryView":1147
35979  *
35980  * cdef Py_ssize_t i
35981  * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
35982  * cdef Py_ssize_t dst_extent = dst_shape[0]
35983  * cdef Py_ssize_t src_stride = src_strides[0]
35984  */
35985  __pyx_v_src_extent = (__pyx_v_src_shape[0]);
35986 
35987  /* "View.MemoryView":1148
35988  * cdef Py_ssize_t i
35989  * cdef Py_ssize_t src_extent = src_shape[0]
35990  * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
35991  * cdef Py_ssize_t src_stride = src_strides[0]
35992  * cdef Py_ssize_t dst_stride = dst_strides[0]
35993  */
35994  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
35995 
35996  /* "View.MemoryView":1149
35997  * cdef Py_ssize_t src_extent = src_shape[0]
35998  * cdef Py_ssize_t dst_extent = dst_shape[0]
35999  * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
36000  * cdef Py_ssize_t dst_stride = dst_strides[0]
36001  *
36002  */
36003  __pyx_v_src_stride = (__pyx_v_src_strides[0]);
36004 
36005  /* "View.MemoryView":1150
36006  * cdef Py_ssize_t dst_extent = dst_shape[0]
36007  * cdef Py_ssize_t src_stride = src_strides[0]
36008  * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
36009  *
36010  * if ndim == 1:
36011  */
36012  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
36013 
36014  /* "View.MemoryView":1152
36015  * cdef Py_ssize_t dst_stride = dst_strides[0]
36016  *
36017  * if ndim == 1: # <<<<<<<<<<<<<<
36018  * if (src_stride > 0 and dst_stride > 0 and
36019  * <size_t> src_stride == itemsize == <size_t> dst_stride):
36020  */
36021  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
36022  if (__pyx_t_1) {
36023 
36024  /* "View.MemoryView":1153
36025  *
36026  * if ndim == 1:
36027  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
36028  * <size_t> src_stride == itemsize == <size_t> dst_stride):
36029  * memcpy(dst_data, src_data, itemsize * dst_extent)
36030  */
36031  __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
36032  if (__pyx_t_2) {
36033  } else {
36034  __pyx_t_1 = __pyx_t_2;
36035  goto __pyx_L5_bool_binop_done;
36036  }
36037  __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
36038  if (__pyx_t_2) {
36039  } else {
36040  __pyx_t_1 = __pyx_t_2;
36041  goto __pyx_L5_bool_binop_done;
36042  }
36043 
36044  /* "View.MemoryView":1154
36045  * if ndim == 1:
36046  * if (src_stride > 0 and dst_stride > 0 and
36047  * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
36048  * memcpy(dst_data, src_data, itemsize * dst_extent)
36049  * else:
36050  */
36051  __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
36052  if (__pyx_t_2) {
36053  __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
36054  }
36055  __pyx_t_3 = (__pyx_t_2 != 0);
36056  __pyx_t_1 = __pyx_t_3;
36057  __pyx_L5_bool_binop_done:;
36058 
36059  /* "View.MemoryView":1153
36060  *
36061  * if ndim == 1:
36062  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
36063  * <size_t> src_stride == itemsize == <size_t> dst_stride):
36064  * memcpy(dst_data, src_data, itemsize * dst_extent)
36065  */
36066  if (__pyx_t_1) {
36067 
36068  /* "View.MemoryView":1155
36069  * if (src_stride > 0 and dst_stride > 0 and
36070  * <size_t> src_stride == itemsize == <size_t> dst_stride):
36071  * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
36072  * else:
36073  * for i in range(dst_extent):
36074  */
36075  (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
36076 
36077  /* "View.MemoryView":1153
36078  *
36079  * if ndim == 1:
36080  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
36081  * <size_t> src_stride == itemsize == <size_t> dst_stride):
36082  * memcpy(dst_data, src_data, itemsize * dst_extent)
36083  */
36084  goto __pyx_L4;
36085  }
36086 
36087  /* "View.MemoryView":1157
36088  * memcpy(dst_data, src_data, itemsize * dst_extent)
36089  * else:
36090  * for i in range(dst_extent): # <<<<<<<<<<<<<<
36091  * memcpy(dst_data, src_data, itemsize)
36092  * src_data += src_stride
36093  */
36094  /*else*/ {
36095  __pyx_t_4 = __pyx_v_dst_extent;
36096  __pyx_t_5 = __pyx_t_4;
36097  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
36098  __pyx_v_i = __pyx_t_6;
36099 
36100  /* "View.MemoryView":1158
36101  * else:
36102  * for i in range(dst_extent):
36103  * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
36104  * src_data += src_stride
36105  * dst_data += dst_stride
36106  */
36107  (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
36108 
36109  /* "View.MemoryView":1159
36110  * for i in range(dst_extent):
36111  * memcpy(dst_data, src_data, itemsize)
36112  * src_data += src_stride # <<<<<<<<<<<<<<
36113  * dst_data += dst_stride
36114  * else:
36115  */
36116  __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
36117 
36118  /* "View.MemoryView":1160
36119  * memcpy(dst_data, src_data, itemsize)
36120  * src_data += src_stride
36121  * dst_data += dst_stride # <<<<<<<<<<<<<<
36122  * else:
36123  * for i in range(dst_extent):
36124  */
36125  __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
36126  }
36127  }
36128  __pyx_L4:;
36129 
36130  /* "View.MemoryView":1152
36131  * cdef Py_ssize_t dst_stride = dst_strides[0]
36132  *
36133  * if ndim == 1: # <<<<<<<<<<<<<<
36134  * if (src_stride > 0 and dst_stride > 0 and
36135  * <size_t> src_stride == itemsize == <size_t> dst_stride):
36136  */
36137  goto __pyx_L3;
36138  }
36139 
36140  /* "View.MemoryView":1162
36141  * dst_data += dst_stride
36142  * else:
36143  * for i in range(dst_extent): # <<<<<<<<<<<<<<
36144  * _copy_strided_to_strided(src_data, src_strides + 1,
36145  * dst_data, dst_strides + 1,
36146  */
36147  /*else*/ {
36148  __pyx_t_4 = __pyx_v_dst_extent;
36149  __pyx_t_5 = __pyx_t_4;
36150  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
36151  __pyx_v_i = __pyx_t_6;
36152 
36153  /* "View.MemoryView":1163
36154  * else:
36155  * for i in range(dst_extent):
36156  * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
36157  * dst_data, dst_strides + 1,
36158  * src_shape + 1, dst_shape + 1,
36159  */
36160  _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
36161 
36162  /* "View.MemoryView":1167
36163  * src_shape + 1, dst_shape + 1,
36164  * ndim - 1, itemsize)
36165  * src_data += src_stride # <<<<<<<<<<<<<<
36166  * dst_data += dst_stride
36167  *
36168  */
36169  __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
36170 
36171  /* "View.MemoryView":1168
36172  * ndim - 1, itemsize)
36173  * src_data += src_stride
36174  * dst_data += dst_stride # <<<<<<<<<<<<<<
36175  *
36176  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
36177  */
36178  __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
36179  }
36180  }
36181  __pyx_L3:;
36182 
36183  /* "View.MemoryView":1140
36184  *
36185  * @cython.cdivision(True)
36186  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
36187  * char *dst_data, Py_ssize_t *dst_strides,
36188  * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
36189  */
36190 
36191  /* function exit code */
36192 }
36193 
36194 /* "View.MemoryView":1170
36195  * dst_data += dst_stride
36196  *
36197  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
36198  * __Pyx_memviewslice *dst,
36199  * int ndim, size_t itemsize) nogil:
36200  */
36201 
36202 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
36203 
36204  /* "View.MemoryView":1173
36205  * __Pyx_memviewslice *dst,
36206  * int ndim, size_t itemsize) nogil:
36207  * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
36208  * src.shape, dst.shape, ndim, itemsize)
36209  *
36210  */
36211  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
36212 
36213  /* "View.MemoryView":1170
36214  * dst_data += dst_stride
36215  *
36216  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
36217  * __Pyx_memviewslice *dst,
36218  * int ndim, size_t itemsize) nogil:
36219  */
36220 
36221  /* function exit code */
36222 }
36223 
36224 /* "View.MemoryView":1177
36225  *
36226  * @cname('__pyx_memoryview_slice_get_size')
36227  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
36228  * "Return the size of the memory occupied by the slice in number of bytes"
36229  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
36230  */
36231 
36232 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
36233  Py_ssize_t __pyx_v_shape;
36234  Py_ssize_t __pyx_v_size;
36235  Py_ssize_t __pyx_r;
36236  Py_ssize_t __pyx_t_1;
36237  Py_ssize_t *__pyx_t_2;
36238  Py_ssize_t *__pyx_t_3;
36239  Py_ssize_t *__pyx_t_4;
36240 
36241  /* "View.MemoryView":1179
36242  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
36243  * "Return the size of the memory occupied by the slice in number of bytes"
36244  * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
36245  *
36246  * for shape in src.shape[:ndim]:
36247  */
36248  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
36249  __pyx_v_size = __pyx_t_1;
36250 
36251  /* "View.MemoryView":1181
36252  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
36253  *
36254  * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
36255  * size *= shape
36256  *
36257  */
36258  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
36259  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
36260  __pyx_t_2 = __pyx_t_4;
36261  __pyx_v_shape = (__pyx_t_2[0]);
36262 
36263  /* "View.MemoryView":1182
36264  *
36265  * for shape in src.shape[:ndim]:
36266  * size *= shape # <<<<<<<<<<<<<<
36267  *
36268  * return size
36269  */
36270  __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
36271  }
36272 
36273  /* "View.MemoryView":1184
36274  * size *= shape
36275  *
36276  * return size # <<<<<<<<<<<<<<
36277  *
36278  * @cname('__pyx_fill_contig_strides_array')
36279  */
36280  __pyx_r = __pyx_v_size;
36281  goto __pyx_L0;
36282 
36283  /* "View.MemoryView":1177
36284  *
36285  * @cname('__pyx_memoryview_slice_get_size')
36286  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
36287  * "Return the size of the memory occupied by the slice in number of bytes"
36288  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
36289  */
36290 
36291  /* function exit code */
36292  __pyx_L0:;
36293  return __pyx_r;
36294 }
36295 
36296 /* "View.MemoryView":1187
36297  *
36298  * @cname('__pyx_fill_contig_strides_array')
36299  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
36300  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
36301  * int ndim, char order) nogil:
36302  */
36303 
36304 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
36305  int __pyx_v_idx;
36306  Py_ssize_t __pyx_r;
36307  int __pyx_t_1;
36308  int __pyx_t_2;
36309  int __pyx_t_3;
36310  int __pyx_t_4;
36311 
36312  /* "View.MemoryView":1196
36313  * cdef int idx
36314  *
36315  * if order == 'F': # <<<<<<<<<<<<<<
36316  * for idx in range(ndim):
36317  * strides[idx] = stride
36318  */
36319  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
36320  if (__pyx_t_1) {
36321 
36322  /* "View.MemoryView":1197
36323  *
36324  * if order == 'F':
36325  * for idx in range(ndim): # <<<<<<<<<<<<<<
36326  * strides[idx] = stride
36327  * stride *= shape[idx]
36328  */
36329  __pyx_t_2 = __pyx_v_ndim;
36330  __pyx_t_3 = __pyx_t_2;
36331  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
36332  __pyx_v_idx = __pyx_t_4;
36333 
36334  /* "View.MemoryView":1198
36335  * if order == 'F':
36336  * for idx in range(ndim):
36337  * strides[idx] = stride # <<<<<<<<<<<<<<
36338  * stride *= shape[idx]
36339  * else:
36340  */
36341  (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
36342 
36343  /* "View.MemoryView":1199
36344  * for idx in range(ndim):
36345  * strides[idx] = stride
36346  * stride *= shape[idx] # <<<<<<<<<<<<<<
36347  * else:
36348  * for idx in range(ndim - 1, -1, -1):
36349  */
36350  __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
36351  }
36352 
36353  /* "View.MemoryView":1196
36354  * cdef int idx
36355  *
36356  * if order == 'F': # <<<<<<<<<<<<<<
36357  * for idx in range(ndim):
36358  * strides[idx] = stride
36359  */
36360  goto __pyx_L3;
36361  }
36362 
36363  /* "View.MemoryView":1201
36364  * stride *= shape[idx]
36365  * else:
36366  * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
36367  * strides[idx] = stride
36368  * stride *= shape[idx]
36369  */
36370  /*else*/ {
36371  for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
36372  __pyx_v_idx = __pyx_t_2;
36373 
36374  /* "View.MemoryView":1202
36375  * else:
36376  * for idx in range(ndim - 1, -1, -1):
36377  * strides[idx] = stride # <<<<<<<<<<<<<<
36378  * stride *= shape[idx]
36379  *
36380  */
36381  (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
36382 
36383  /* "View.MemoryView":1203
36384  * for idx in range(ndim - 1, -1, -1):
36385  * strides[idx] = stride
36386  * stride *= shape[idx] # <<<<<<<<<<<<<<
36387  *
36388  * return stride
36389  */
36390  __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
36391  }
36392  }
36393  __pyx_L3:;
36394 
36395  /* "View.MemoryView":1205
36396  * stride *= shape[idx]
36397  *
36398  * return stride # <<<<<<<<<<<<<<
36399  *
36400  * @cname('__pyx_memoryview_copy_data_to_temp')
36401  */
36402  __pyx_r = __pyx_v_stride;
36403  goto __pyx_L0;
36404 
36405  /* "View.MemoryView":1187
36406  *
36407  * @cname('__pyx_fill_contig_strides_array')
36408  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
36409  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
36410  * int ndim, char order) nogil:
36411  */
36412 
36413  /* function exit code */
36414  __pyx_L0:;
36415  return __pyx_r;
36416 }
36417 
36418 /* "View.MemoryView":1208
36419  *
36420  * @cname('__pyx_memoryview_copy_data_to_temp')
36421  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
36422  * __Pyx_memviewslice *tmpslice,
36423  * char order,
36424  */
36425 
36426 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
36427  int __pyx_v_i;
36428  void *__pyx_v_result;
36429  size_t __pyx_v_itemsize;
36430  size_t __pyx_v_size;
36431  void *__pyx_r;
36432  Py_ssize_t __pyx_t_1;
36433  int __pyx_t_2;
36434  int __pyx_t_3;
36435  struct __pyx_memoryview_obj *__pyx_t_4;
36436  int __pyx_t_5;
36437  int __pyx_t_6;
36438  int __pyx_lineno = 0;
36439  const char *__pyx_filename = NULL;
36440  int __pyx_clineno = 0;
36441 
36442  /* "View.MemoryView":1219
36443  * cdef void *result
36444  *
36445  * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
36446  * cdef size_t size = slice_get_size(src, ndim)
36447  *
36448  */
36449  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
36450  __pyx_v_itemsize = __pyx_t_1;
36451 
36452  /* "View.MemoryView":1220
36453  *
36454  * cdef size_t itemsize = src.memview.view.itemsize
36455  * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
36456  *
36457  * result = malloc(size)
36458  */
36459  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
36460 
36461  /* "View.MemoryView":1222
36462  * cdef size_t size = slice_get_size(src, ndim)
36463  *
36464  * result = malloc(size) # <<<<<<<<<<<<<<
36465  * if not result:
36466  * _err(MemoryError, NULL)
36467  */
36468  __pyx_v_result = malloc(__pyx_v_size);
36469 
36470  /* "View.MemoryView":1223
36471  *
36472  * result = malloc(size)
36473  * if not result: # <<<<<<<<<<<<<<
36474  * _err(MemoryError, NULL)
36475  *
36476  */
36477  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
36478  if (__pyx_t_2) {
36479 
36480  /* "View.MemoryView":1224
36481  * result = malloc(size)
36482  * if not result:
36483  * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
36484  *
36485  *
36486  */
36487  __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
36488 
36489  /* "View.MemoryView":1223
36490  *
36491  * result = malloc(size)
36492  * if not result: # <<<<<<<<<<<<<<
36493  * _err(MemoryError, NULL)
36494  *
36495  */
36496  }
36497 
36498  /* "View.MemoryView":1227
36499  *
36500  *
36501  * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
36502  * tmpslice.memview = src.memview
36503  * for i in range(ndim):
36504  */
36505  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
36506 
36507  /* "View.MemoryView":1228
36508  *
36509  * tmpslice.data = <char *> result
36510  * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
36511  * for i in range(ndim):
36512  * tmpslice.shape[i] = src.shape[i]
36513  */
36514  __pyx_t_4 = __pyx_v_src->memview;
36515  __pyx_v_tmpslice->memview = __pyx_t_4;
36516 
36517  /* "View.MemoryView":1229
36518  * tmpslice.data = <char *> result
36519  * tmpslice.memview = src.memview
36520  * for i in range(ndim): # <<<<<<<<<<<<<<
36521  * tmpslice.shape[i] = src.shape[i]
36522  * tmpslice.suboffsets[i] = -1
36523  */
36524  __pyx_t_3 = __pyx_v_ndim;
36525  __pyx_t_5 = __pyx_t_3;
36526  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
36527  __pyx_v_i = __pyx_t_6;
36528 
36529  /* "View.MemoryView":1230
36530  * tmpslice.memview = src.memview
36531  * for i in range(ndim):
36532  * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
36533  * tmpslice.suboffsets[i] = -1
36534  *
36535  */
36536  (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
36537 
36538  /* "View.MemoryView":1231
36539  * for i in range(ndim):
36540  * tmpslice.shape[i] = src.shape[i]
36541  * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
36542  *
36543  * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
36544  */
36545  (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
36546  }
36547 
36548  /* "View.MemoryView":1233
36549  * tmpslice.suboffsets[i] = -1
36550  *
36551  * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
36552  * ndim, order)
36553  *
36554  */
36555  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
36556 
36557  /* "View.MemoryView":1237
36558  *
36559  *
36560  * for i in range(ndim): # <<<<<<<<<<<<<<
36561  * if tmpslice.shape[i] == 1:
36562  * tmpslice.strides[i] = 0
36563  */
36564  __pyx_t_3 = __pyx_v_ndim;
36565  __pyx_t_5 = __pyx_t_3;
36566  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
36567  __pyx_v_i = __pyx_t_6;
36568 
36569  /* "View.MemoryView":1238
36570  *
36571  * for i in range(ndim):
36572  * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
36573  * tmpslice.strides[i] = 0
36574  *
36575  */
36576  __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
36577  if (__pyx_t_2) {
36578 
36579  /* "View.MemoryView":1239
36580  * for i in range(ndim):
36581  * if tmpslice.shape[i] == 1:
36582  * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
36583  *
36584  * if slice_is_contig(src[0], order, ndim):
36585  */
36586  (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
36587 
36588  /* "View.MemoryView":1238
36589  *
36590  * for i in range(ndim):
36591  * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
36592  * tmpslice.strides[i] = 0
36593  *
36594  */
36595  }
36596  }
36597 
36598  /* "View.MemoryView":1241
36599  * tmpslice.strides[i] = 0
36600  *
36601  * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
36602  * memcpy(result, src.data, size)
36603  * else:
36604  */
36605  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
36606  if (__pyx_t_2) {
36607 
36608  /* "View.MemoryView":1242
36609  *
36610  * if slice_is_contig(src[0], order, ndim):
36611  * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
36612  * else:
36613  * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
36614  */
36615  (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
36616 
36617  /* "View.MemoryView":1241
36618  * tmpslice.strides[i] = 0
36619  *
36620  * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
36621  * memcpy(result, src.data, size)
36622  * else:
36623  */
36624  goto __pyx_L9;
36625  }
36626 
36627  /* "View.MemoryView":1244
36628  * memcpy(result, src.data, size)
36629  * else:
36630  * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
36631  *
36632  * return result
36633  */
36634  /*else*/ {
36635  copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
36636  }
36637  __pyx_L9:;
36638 
36639  /* "View.MemoryView":1246
36640  * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
36641  *
36642  * return result # <<<<<<<<<<<<<<
36643  *
36644  *
36645  */
36646  __pyx_r = __pyx_v_result;
36647  goto __pyx_L0;
36648 
36649  /* "View.MemoryView":1208
36650  *
36651  * @cname('__pyx_memoryview_copy_data_to_temp')
36652  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
36653  * __Pyx_memviewslice *tmpslice,
36654  * char order,
36655  */
36656 
36657  /* function exit code */
36658  __pyx_L1_error:;
36659  {
36660  #ifdef WITH_THREAD
36661  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
36662  #endif
36663  __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
36664  #ifdef WITH_THREAD
36665  __Pyx_PyGILState_Release(__pyx_gilstate_save);
36666  #endif
36667  }
36668  __pyx_r = NULL;
36669  __pyx_L0:;
36670  return __pyx_r;
36671 }
36672 
36673 /* "View.MemoryView":1251
36674  *
36675  * @cname('__pyx_memoryview_err_extents')
36676  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
36677  * Py_ssize_t extent2) except -1 with gil:
36678  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
36679  */
36680 
36681 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
36682  int __pyx_r;
36683  __Pyx_RefNannyDeclarations
36684  PyObject *__pyx_t_1 = NULL;
36685  PyObject *__pyx_t_2 = NULL;
36686  PyObject *__pyx_t_3 = NULL;
36687  PyObject *__pyx_t_4 = NULL;
36688  int __pyx_lineno = 0;
36689  const char *__pyx_filename = NULL;
36690  int __pyx_clineno = 0;
36691  #ifdef WITH_THREAD
36692  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
36693  #endif
36694  __Pyx_RefNannySetupContext("_err_extents", 0);
36695 
36696  /* "View.MemoryView":1254
36697  * Py_ssize_t extent2) except -1 with gil:
36698  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
36699  * (i, extent1, extent2)) # <<<<<<<<<<<<<<
36700  *
36701  * @cname('__pyx_memoryview_err_dim')
36702  */
36703  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
36704  __Pyx_GOTREF(__pyx_t_1);
36705  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
36706  __Pyx_GOTREF(__pyx_t_2);
36707  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
36708  __Pyx_GOTREF(__pyx_t_3);
36709  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
36710  __Pyx_GOTREF(__pyx_t_4);
36711  __Pyx_GIVEREF(__pyx_t_1);
36712  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
36713  __Pyx_GIVEREF(__pyx_t_2);
36714  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
36715  __Pyx_GIVEREF(__pyx_t_3);
36716  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
36717  __pyx_t_1 = 0;
36718  __pyx_t_2 = 0;
36719  __pyx_t_3 = 0;
36720 
36721  /* "View.MemoryView":1253
36722  * cdef int _err_extents(int i, Py_ssize_t extent1,
36723  * Py_ssize_t extent2) except -1 with gil:
36724  * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
36725  * (i, extent1, extent2))
36726  *
36727  */
36728  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
36729  __Pyx_GOTREF(__pyx_t_3);
36730  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
36731  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
36732  __Pyx_GOTREF(__pyx_t_4);
36733  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36734  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
36735  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
36736  __PYX_ERR(2, 1253, __pyx_L1_error)
36737 
36738  /* "View.MemoryView":1251
36739  *
36740  * @cname('__pyx_memoryview_err_extents')
36741  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
36742  * Py_ssize_t extent2) except -1 with gil:
36743  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
36744  */
36745 
36746  /* function exit code */
36747  __pyx_L1_error:;
36748  __Pyx_XDECREF(__pyx_t_1);
36749  __Pyx_XDECREF(__pyx_t_2);
36750  __Pyx_XDECREF(__pyx_t_3);
36751  __Pyx_XDECREF(__pyx_t_4);
36752  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
36753  __pyx_r = -1;
36754  __Pyx_RefNannyFinishContext();
36755  #ifdef WITH_THREAD
36756  __Pyx_PyGILState_Release(__pyx_gilstate_save);
36757  #endif
36758  return __pyx_r;
36759 }
36760 
36761 /* "View.MemoryView":1257
36762  *
36763  * @cname('__pyx_memoryview_err_dim')
36764  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
36765  * raise error(msg.decode('ascii') % dim)
36766  *
36767  */
36768 
36769 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
36770  int __pyx_r;
36771  __Pyx_RefNannyDeclarations
36772  PyObject *__pyx_t_1 = NULL;
36773  PyObject *__pyx_t_2 = NULL;
36774  PyObject *__pyx_t_3 = NULL;
36775  PyObject *__pyx_t_4 = NULL;
36776  int __pyx_lineno = 0;
36777  const char *__pyx_filename = NULL;
36778  int __pyx_clineno = 0;
36779  #ifdef WITH_THREAD
36780  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
36781  #endif
36782  __Pyx_RefNannySetupContext("_err_dim", 0);
36783  __Pyx_INCREF(__pyx_v_error);
36784 
36785  /* "View.MemoryView":1258
36786  * @cname('__pyx_memoryview_err_dim')
36787  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
36788  * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
36789  *
36790  * @cname('__pyx_memoryview_err')
36791  */
36792  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1258, __pyx_L1_error)
36793  __Pyx_GOTREF(__pyx_t_2);
36794  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
36795  __Pyx_GOTREF(__pyx_t_3);
36796  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
36797  __Pyx_GOTREF(__pyx_t_4);
36798  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
36799  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36800  __Pyx_INCREF(__pyx_v_error);
36801  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
36802  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
36803  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
36804  if (likely(__pyx_t_2)) {
36805  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
36806  __Pyx_INCREF(__pyx_t_2);
36807  __Pyx_INCREF(function);
36808  __Pyx_DECREF_SET(__pyx_t_3, function);
36809  }
36810  }
36811  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
36812  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
36813  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
36814  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
36815  __Pyx_GOTREF(__pyx_t_1);
36816  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36817  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
36818  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
36819  __PYX_ERR(2, 1258, __pyx_L1_error)
36820 
36821  /* "View.MemoryView":1257
36822  *
36823  * @cname('__pyx_memoryview_err_dim')
36824  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
36825  * raise error(msg.decode('ascii') % dim)
36826  *
36827  */
36828 
36829  /* function exit code */
36830  __pyx_L1_error:;
36831  __Pyx_XDECREF(__pyx_t_1);
36832  __Pyx_XDECREF(__pyx_t_2);
36833  __Pyx_XDECREF(__pyx_t_3);
36834  __Pyx_XDECREF(__pyx_t_4);
36835  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
36836  __pyx_r = -1;
36837  __Pyx_XDECREF(__pyx_v_error);
36838  __Pyx_RefNannyFinishContext();
36839  #ifdef WITH_THREAD
36840  __Pyx_PyGILState_Release(__pyx_gilstate_save);
36841  #endif
36842  return __pyx_r;
36843 }
36844 
36845 /* "View.MemoryView":1261
36846  *
36847  * @cname('__pyx_memoryview_err')
36848  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
36849  * if msg != NULL:
36850  * raise error(msg.decode('ascii'))
36851  */
36852 
36853 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
36854  int __pyx_r;
36855  __Pyx_RefNannyDeclarations
36856  int __pyx_t_1;
36857  PyObject *__pyx_t_2 = NULL;
36858  PyObject *__pyx_t_3 = NULL;
36859  PyObject *__pyx_t_4 = NULL;
36860  PyObject *__pyx_t_5 = NULL;
36861  int __pyx_lineno = 0;
36862  const char *__pyx_filename = NULL;
36863  int __pyx_clineno = 0;
36864  #ifdef WITH_THREAD
36865  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
36866  #endif
36867  __Pyx_RefNannySetupContext("_err", 0);
36868  __Pyx_INCREF(__pyx_v_error);
36869 
36870  /* "View.MemoryView":1262
36871  * @cname('__pyx_memoryview_err')
36872  * cdef int _err(object error, char *msg) except -1 with gil:
36873  * if msg != NULL: # <<<<<<<<<<<<<<
36874  * raise error(msg.decode('ascii'))
36875  * else:
36876  */
36877  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
36878  if (unlikely(__pyx_t_1)) {
36879 
36880  /* "View.MemoryView":1263
36881  * cdef int _err(object error, char *msg) except -1 with gil:
36882  * if msg != NULL:
36883  * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
36884  * else:
36885  * raise error
36886  */
36887  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1263, __pyx_L1_error)
36888  __Pyx_GOTREF(__pyx_t_3);
36889  __Pyx_INCREF(__pyx_v_error);
36890  __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
36891  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
36892  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
36893  if (likely(__pyx_t_5)) {
36894  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
36895  __Pyx_INCREF(__pyx_t_5);
36896  __Pyx_INCREF(function);
36897  __Pyx_DECREF_SET(__pyx_t_4, function);
36898  }
36899  }
36900  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
36901  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
36902  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
36903  if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
36904  __Pyx_GOTREF(__pyx_t_2);
36905  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
36906  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
36907  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
36908  __PYX_ERR(2, 1263, __pyx_L1_error)
36909 
36910  /* "View.MemoryView":1262
36911  * @cname('__pyx_memoryview_err')
36912  * cdef int _err(object error, char *msg) except -1 with gil:
36913  * if msg != NULL: # <<<<<<<<<<<<<<
36914  * raise error(msg.decode('ascii'))
36915  * else:
36916  */
36917  }
36918 
36919  /* "View.MemoryView":1265
36920  * raise error(msg.decode('ascii'))
36921  * else:
36922  * raise error # <<<<<<<<<<<<<<
36923  *
36924  * @cname('__pyx_memoryview_copy_contents')
36925  */
36926  /*else*/ {
36927  __Pyx_Raise(__pyx_v_error, 0, 0, 0);
36928  __PYX_ERR(2, 1265, __pyx_L1_error)
36929  }
36930 
36931  /* "View.MemoryView":1261
36932  *
36933  * @cname('__pyx_memoryview_err')
36934  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
36935  * if msg != NULL:
36936  * raise error(msg.decode('ascii'))
36937  */
36938 
36939  /* function exit code */
36940  __pyx_L1_error:;
36941  __Pyx_XDECREF(__pyx_t_2);
36942  __Pyx_XDECREF(__pyx_t_3);
36943  __Pyx_XDECREF(__pyx_t_4);
36944  __Pyx_XDECREF(__pyx_t_5);
36945  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
36946  __pyx_r = -1;
36947  __Pyx_XDECREF(__pyx_v_error);
36948  __Pyx_RefNannyFinishContext();
36949  #ifdef WITH_THREAD
36950  __Pyx_PyGILState_Release(__pyx_gilstate_save);
36951  #endif
36952  return __pyx_r;
36953 }
36954 
36955 /* "View.MemoryView":1268
36956  *
36957  * @cname('__pyx_memoryview_copy_contents')
36958  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
36959  * __Pyx_memviewslice dst,
36960  * int src_ndim, int dst_ndim,
36961  */
36962 
36963 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
36964  void *__pyx_v_tmpdata;
36965  size_t __pyx_v_itemsize;
36966  int __pyx_v_i;
36967  char __pyx_v_order;
36968  int __pyx_v_broadcasting;
36969  int __pyx_v_direct_copy;
36970  __Pyx_memviewslice __pyx_v_tmp;
36971  int __pyx_v_ndim;
36972  int __pyx_r;
36973  Py_ssize_t __pyx_t_1;
36974  int __pyx_t_2;
36975  int __pyx_t_3;
36976  int __pyx_t_4;
36977  int __pyx_t_5;
36978  int __pyx_t_6;
36979  void *__pyx_t_7;
36980  int __pyx_t_8;
36981  int __pyx_lineno = 0;
36982  const char *__pyx_filename = NULL;
36983  int __pyx_clineno = 0;
36984 
36985  /* "View.MemoryView":1276
36986  * Check for overlapping memory and verify the shapes.
36987  * """
36988  * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
36989  * cdef size_t itemsize = src.memview.view.itemsize
36990  * cdef int i
36991  */
36992  __pyx_v_tmpdata = NULL;
36993 
36994  /* "View.MemoryView":1277
36995  * """
36996  * cdef void *tmpdata = NULL
36997  * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
36998  * cdef int i
36999  * cdef char order = get_best_order(&src, src_ndim)
37000  */
37001  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
37002  __pyx_v_itemsize = __pyx_t_1;
37003 
37004  /* "View.MemoryView":1279
37005  * cdef size_t itemsize = src.memview.view.itemsize
37006  * cdef int i
37007  * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
37008  * cdef bint broadcasting = False
37009  * cdef bint direct_copy = False
37010  */
37011  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
37012 
37013  /* "View.MemoryView":1280
37014  * cdef int i
37015  * cdef char order = get_best_order(&src, src_ndim)
37016  * cdef bint broadcasting = False # <<<<<<<<<<<<<<
37017  * cdef bint direct_copy = False
37018  * cdef __Pyx_memviewslice tmp
37019  */
37020  __pyx_v_broadcasting = 0;
37021 
37022  /* "View.MemoryView":1281
37023  * cdef char order = get_best_order(&src, src_ndim)
37024  * cdef bint broadcasting = False
37025  * cdef bint direct_copy = False # <<<<<<<<<<<<<<
37026  * cdef __Pyx_memviewslice tmp
37027  *
37028  */
37029  __pyx_v_direct_copy = 0;
37030 
37031  /* "View.MemoryView":1284
37032  * cdef __Pyx_memviewslice tmp
37033  *
37034  * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
37035  * broadcast_leading(&src, src_ndim, dst_ndim)
37036  * elif dst_ndim < src_ndim:
37037  */
37038  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
37039  if (__pyx_t_2) {
37040 
37041  /* "View.MemoryView":1285
37042  *
37043  * if src_ndim < dst_ndim:
37044  * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
37045  * elif dst_ndim < src_ndim:
37046  * broadcast_leading(&dst, dst_ndim, src_ndim)
37047  */
37048  __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
37049 
37050  /* "View.MemoryView":1284
37051  * cdef __Pyx_memviewslice tmp
37052  *
37053  * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
37054  * broadcast_leading(&src, src_ndim, dst_ndim)
37055  * elif dst_ndim < src_ndim:
37056  */
37057  goto __pyx_L3;
37058  }
37059 
37060  /* "View.MemoryView":1286
37061  * if src_ndim < dst_ndim:
37062  * broadcast_leading(&src, src_ndim, dst_ndim)
37063  * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
37064  * broadcast_leading(&dst, dst_ndim, src_ndim)
37065  *
37066  */
37067  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
37068  if (__pyx_t_2) {
37069 
37070  /* "View.MemoryView":1287
37071  * broadcast_leading(&src, src_ndim, dst_ndim)
37072  * elif dst_ndim < src_ndim:
37073  * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
37074  *
37075  * cdef int ndim = max(src_ndim, dst_ndim)
37076  */
37077  __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
37078 
37079  /* "View.MemoryView":1286
37080  * if src_ndim < dst_ndim:
37081  * broadcast_leading(&src, src_ndim, dst_ndim)
37082  * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
37083  * broadcast_leading(&dst, dst_ndim, src_ndim)
37084  *
37085  */
37086  }
37087  __pyx_L3:;
37088 
37089  /* "View.MemoryView":1289
37090  * broadcast_leading(&dst, dst_ndim, src_ndim)
37091  *
37092  * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
37093  *
37094  * for i in range(ndim):
37095  */
37096  __pyx_t_3 = __pyx_v_dst_ndim;
37097  __pyx_t_4 = __pyx_v_src_ndim;
37098  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
37099  __pyx_t_5 = __pyx_t_3;
37100  } else {
37101  __pyx_t_5 = __pyx_t_4;
37102  }
37103  __pyx_v_ndim = __pyx_t_5;
37104 
37105  /* "View.MemoryView":1291
37106  * cdef int ndim = max(src_ndim, dst_ndim)
37107  *
37108  * for i in range(ndim): # <<<<<<<<<<<<<<
37109  * if src.shape[i] != dst.shape[i]:
37110  * if src.shape[i] == 1:
37111  */
37112  __pyx_t_5 = __pyx_v_ndim;
37113  __pyx_t_3 = __pyx_t_5;
37114  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
37115  __pyx_v_i = __pyx_t_4;
37116 
37117  /* "View.MemoryView":1292
37118  *
37119  * for i in range(ndim):
37120  * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
37121  * if src.shape[i] == 1:
37122  * broadcasting = True
37123  */
37124  __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
37125  if (__pyx_t_2) {
37126 
37127  /* "View.MemoryView":1293
37128  * for i in range(ndim):
37129  * if src.shape[i] != dst.shape[i]:
37130  * if src.shape[i] == 1: # <<<<<<<<<<<<<<
37131  * broadcasting = True
37132  * src.strides[i] = 0
37133  */
37134  __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
37135  if (__pyx_t_2) {
37136 
37137  /* "View.MemoryView":1294
37138  * if src.shape[i] != dst.shape[i]:
37139  * if src.shape[i] == 1:
37140  * broadcasting = True # <<<<<<<<<<<<<<
37141  * src.strides[i] = 0
37142  * else:
37143  */
37144  __pyx_v_broadcasting = 1;
37145 
37146  /* "View.MemoryView":1295
37147  * if src.shape[i] == 1:
37148  * broadcasting = True
37149  * src.strides[i] = 0 # <<<<<<<<<<<<<<
37150  * else:
37151  * _err_extents(i, dst.shape[i], src.shape[i])
37152  */
37153  (__pyx_v_src.strides[__pyx_v_i]) = 0;
37154 
37155  /* "View.MemoryView":1293
37156  * for i in range(ndim):
37157  * if src.shape[i] != dst.shape[i]:
37158  * if src.shape[i] == 1: # <<<<<<<<<<<<<<
37159  * broadcasting = True
37160  * src.strides[i] = 0
37161  */
37162  goto __pyx_L7;
37163  }
37164 
37165  /* "View.MemoryView":1297
37166  * src.strides[i] = 0
37167  * else:
37168  * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
37169  *
37170  * if src.suboffsets[i] >= 0:
37171  */
37172  /*else*/ {
37173  __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1297, __pyx_L1_error)
37174  }
37175  __pyx_L7:;
37176 
37177  /* "View.MemoryView":1292
37178  *
37179  * for i in range(ndim):
37180  * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
37181  * if src.shape[i] == 1:
37182  * broadcasting = True
37183  */
37184  }
37185 
37186  /* "View.MemoryView":1299
37187  * _err_extents(i, dst.shape[i], src.shape[i])
37188  *
37189  * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
37190  * _err_dim(ValueError, "Dimension %d is not direct", i)
37191  *
37192  */
37193  __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
37194  if (__pyx_t_2) {
37195 
37196  /* "View.MemoryView":1300
37197  *
37198  * if src.suboffsets[i] >= 0:
37199  * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
37200  *
37201  * if slices_overlap(&src, &dst, ndim, itemsize):
37202  */
37203  __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1300, __pyx_L1_error)
37204 
37205  /* "View.MemoryView":1299
37206  * _err_extents(i, dst.shape[i], src.shape[i])
37207  *
37208  * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
37209  * _err_dim(ValueError, "Dimension %d is not direct", i)
37210  *
37211  */
37212  }
37213  }
37214 
37215  /* "View.MemoryView":1302
37216  * _err_dim(ValueError, "Dimension %d is not direct", i)
37217  *
37218  * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
37219  *
37220  * if not slice_is_contig(src, order, ndim):
37221  */
37222  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
37223  if (__pyx_t_2) {
37224 
37225  /* "View.MemoryView":1304
37226  * if slices_overlap(&src, &dst, ndim, itemsize):
37227  *
37228  * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
37229  * order = get_best_order(&dst, ndim)
37230  *
37231  */
37232  __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
37233  if (__pyx_t_2) {
37234 
37235  /* "View.MemoryView":1305
37236  *
37237  * if not slice_is_contig(src, order, ndim):
37238  * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
37239  *
37240  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
37241  */
37242  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
37243 
37244  /* "View.MemoryView":1304
37245  * if slices_overlap(&src, &dst, ndim, itemsize):
37246  *
37247  * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
37248  * order = get_best_order(&dst, ndim)
37249  *
37250  */
37251  }
37252 
37253  /* "View.MemoryView":1307
37254  * order = get_best_order(&dst, ndim)
37255  *
37256  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
37257  * src = tmp
37258  *
37259  */
37260  __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1307, __pyx_L1_error)
37261  __pyx_v_tmpdata = __pyx_t_7;
37262 
37263  /* "View.MemoryView":1308
37264  *
37265  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
37266  * src = tmp # <<<<<<<<<<<<<<
37267  *
37268  * if not broadcasting:
37269  */
37270  __pyx_v_src = __pyx_v_tmp;
37271 
37272  /* "View.MemoryView":1302
37273  * _err_dim(ValueError, "Dimension %d is not direct", i)
37274  *
37275  * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
37276  *
37277  * if not slice_is_contig(src, order, ndim):
37278  */
37279  }
37280 
37281  /* "View.MemoryView":1310
37282  * src = tmp
37283  *
37284  * if not broadcasting: # <<<<<<<<<<<<<<
37285  *
37286  *
37287  */
37288  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
37289  if (__pyx_t_2) {
37290 
37291  /* "View.MemoryView":1313
37292  *
37293  *
37294  * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
37295  * direct_copy = slice_is_contig(dst, 'C', ndim)
37296  * elif slice_is_contig(src, 'F', ndim):
37297  */
37298  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
37299  if (__pyx_t_2) {
37300 
37301  /* "View.MemoryView":1314
37302  *
37303  * if slice_is_contig(src, 'C', ndim):
37304  * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
37305  * elif slice_is_contig(src, 'F', ndim):
37306  * direct_copy = slice_is_contig(dst, 'F', ndim)
37307  */
37308  __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
37309 
37310  /* "View.MemoryView":1313
37311  *
37312  *
37313  * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
37314  * direct_copy = slice_is_contig(dst, 'C', ndim)
37315  * elif slice_is_contig(src, 'F', ndim):
37316  */
37317  goto __pyx_L12;
37318  }
37319 
37320  /* "View.MemoryView":1315
37321  * if slice_is_contig(src, 'C', ndim):
37322  * direct_copy = slice_is_contig(dst, 'C', ndim)
37323  * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
37324  * direct_copy = slice_is_contig(dst, 'F', ndim)
37325  *
37326  */
37327  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
37328  if (__pyx_t_2) {
37329 
37330  /* "View.MemoryView":1316
37331  * direct_copy = slice_is_contig(dst, 'C', ndim)
37332  * elif slice_is_contig(src, 'F', ndim):
37333  * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
37334  *
37335  * if direct_copy:
37336  */
37337  __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
37338 
37339  /* "View.MemoryView":1315
37340  * if slice_is_contig(src, 'C', ndim):
37341  * direct_copy = slice_is_contig(dst, 'C', ndim)
37342  * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
37343  * direct_copy = slice_is_contig(dst, 'F', ndim)
37344  *
37345  */
37346  }
37347  __pyx_L12:;
37348 
37349  /* "View.MemoryView":1318
37350  * direct_copy = slice_is_contig(dst, 'F', ndim)
37351  *
37352  * if direct_copy: # <<<<<<<<<<<<<<
37353  *
37354  * refcount_copying(&dst, dtype_is_object, ndim, False)
37355  */
37356  __pyx_t_2 = (__pyx_v_direct_copy != 0);
37357  if (__pyx_t_2) {
37358 
37359  /* "View.MemoryView":1320
37360  * if direct_copy:
37361  *
37362  * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
37363  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
37364  * refcount_copying(&dst, dtype_is_object, ndim, True)
37365  */
37366  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
37367 
37368  /* "View.MemoryView":1321
37369  *
37370  * refcount_copying(&dst, dtype_is_object, ndim, False)
37371  * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
37372  * refcount_copying(&dst, dtype_is_object, ndim, True)
37373  * free(tmpdata)
37374  */
37375  (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
37376 
37377  /* "View.MemoryView":1322
37378  * refcount_copying(&dst, dtype_is_object, ndim, False)
37379  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
37380  * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
37381  * free(tmpdata)
37382  * return 0
37383  */
37384  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
37385 
37386  /* "View.MemoryView":1323
37387  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
37388  * refcount_copying(&dst, dtype_is_object, ndim, True)
37389  * free(tmpdata) # <<<<<<<<<<<<<<
37390  * return 0
37391  *
37392  */
37393  free(__pyx_v_tmpdata);
37394 
37395  /* "View.MemoryView":1324
37396  * refcount_copying(&dst, dtype_is_object, ndim, True)
37397  * free(tmpdata)
37398  * return 0 # <<<<<<<<<<<<<<
37399  *
37400  * if order == 'F' == get_best_order(&dst, ndim):
37401  */
37402  __pyx_r = 0;
37403  goto __pyx_L0;
37404 
37405  /* "View.MemoryView":1318
37406  * direct_copy = slice_is_contig(dst, 'F', ndim)
37407  *
37408  * if direct_copy: # <<<<<<<<<<<<<<
37409  *
37410  * refcount_copying(&dst, dtype_is_object, ndim, False)
37411  */
37412  }
37413 
37414  /* "View.MemoryView":1310
37415  * src = tmp
37416  *
37417  * if not broadcasting: # <<<<<<<<<<<<<<
37418  *
37419  *
37420  */
37421  }
37422 
37423  /* "View.MemoryView":1326
37424  * return 0
37425  *
37426  * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
37427  *
37428  *
37429  */
37430  __pyx_t_2 = (__pyx_v_order == 'F');
37431  if (__pyx_t_2) {
37432  __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
37433  }
37434  __pyx_t_8 = (__pyx_t_2 != 0);
37435  if (__pyx_t_8) {
37436 
37437  /* "View.MemoryView":1329
37438  *
37439  *
37440  * transpose_memslice(&src) # <<<<<<<<<<<<<<
37441  * transpose_memslice(&dst)
37442  *
37443  */
37444  __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
37445 
37446  /* "View.MemoryView":1330
37447  *
37448  * transpose_memslice(&src)
37449  * transpose_memslice(&dst) # <<<<<<<<<<<<<<
37450  *
37451  * refcount_copying(&dst, dtype_is_object, ndim, False)
37452  */
37453  __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
37454 
37455  /* "View.MemoryView":1326
37456  * return 0
37457  *
37458  * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
37459  *
37460  *
37461  */
37462  }
37463 
37464  /* "View.MemoryView":1332
37465  * transpose_memslice(&dst)
37466  *
37467  * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
37468  * copy_strided_to_strided(&src, &dst, ndim, itemsize)
37469  * refcount_copying(&dst, dtype_is_object, ndim, True)
37470  */
37471  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
37472 
37473  /* "View.MemoryView":1333
37474  *
37475  * refcount_copying(&dst, dtype_is_object, ndim, False)
37476  * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
37477  * refcount_copying(&dst, dtype_is_object, ndim, True)
37478  *
37479  */
37480  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
37481 
37482  /* "View.MemoryView":1334
37483  * refcount_copying(&dst, dtype_is_object, ndim, False)
37484  * copy_strided_to_strided(&src, &dst, ndim, itemsize)
37485  * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
37486  *
37487  * free(tmpdata)
37488  */
37489  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
37490 
37491  /* "View.MemoryView":1336
37492  * refcount_copying(&dst, dtype_is_object, ndim, True)
37493  *
37494  * free(tmpdata) # <<<<<<<<<<<<<<
37495  * return 0
37496  *
37497  */
37498  free(__pyx_v_tmpdata);
37499 
37500  /* "View.MemoryView":1337
37501  *
37502  * free(tmpdata)
37503  * return 0 # <<<<<<<<<<<<<<
37504  *
37505  * @cname('__pyx_memoryview_broadcast_leading')
37506  */
37507  __pyx_r = 0;
37508  goto __pyx_L0;
37509 
37510  /* "View.MemoryView":1268
37511  *
37512  * @cname('__pyx_memoryview_copy_contents')
37513  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
37514  * __Pyx_memviewslice dst,
37515  * int src_ndim, int dst_ndim,
37516  */
37517 
37518  /* function exit code */
37519  __pyx_L1_error:;
37520  {
37521  #ifdef WITH_THREAD
37522  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
37523  #endif
37524  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
37525  #ifdef WITH_THREAD
37526  __Pyx_PyGILState_Release(__pyx_gilstate_save);
37527  #endif
37528  }
37529  __pyx_r = -1;
37530  __pyx_L0:;
37531  return __pyx_r;
37532 }
37533 
37534 /* "View.MemoryView":1340
37535  *
37536  * @cname('__pyx_memoryview_broadcast_leading')
37537  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
37538  * int ndim,
37539  * int ndim_other) nogil:
37540  */
37541 
37542 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
37543  int __pyx_v_i;
37544  int __pyx_v_offset;
37545  int __pyx_t_1;
37546  int __pyx_t_2;
37547  int __pyx_t_3;
37548 
37549  /* "View.MemoryView":1344
37550  * int ndim_other) nogil:
37551  * cdef int i
37552  * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
37553  *
37554  * for i in range(ndim - 1, -1, -1):
37555  */
37556  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
37557 
37558  /* "View.MemoryView":1346
37559  * cdef int offset = ndim_other - ndim
37560  *
37561  * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
37562  * mslice.shape[i + offset] = mslice.shape[i]
37563  * mslice.strides[i + offset] = mslice.strides[i]
37564  */
37565  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
37566  __pyx_v_i = __pyx_t_1;
37567 
37568  /* "View.MemoryView":1347
37569  *
37570  * for i in range(ndim - 1, -1, -1):
37571  * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
37572  * mslice.strides[i + offset] = mslice.strides[i]
37573  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
37574  */
37575  (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
37576 
37577  /* "View.MemoryView":1348
37578  * for i in range(ndim - 1, -1, -1):
37579  * mslice.shape[i + offset] = mslice.shape[i]
37580  * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
37581  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
37582  *
37583  */
37584  (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
37585 
37586  /* "View.MemoryView":1349
37587  * mslice.shape[i + offset] = mslice.shape[i]
37588  * mslice.strides[i + offset] = mslice.strides[i]
37589  * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
37590  *
37591  * for i in range(offset):
37592  */
37593  (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
37594  }
37595 
37596  /* "View.MemoryView":1351
37597  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
37598  *
37599  * for i in range(offset): # <<<<<<<<<<<<<<
37600  * mslice.shape[i] = 1
37601  * mslice.strides[i] = mslice.strides[0]
37602  */
37603  __pyx_t_1 = __pyx_v_offset;
37604  __pyx_t_2 = __pyx_t_1;
37605  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
37606  __pyx_v_i = __pyx_t_3;
37607 
37608  /* "View.MemoryView":1352
37609  *
37610  * for i in range(offset):
37611  * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
37612  * mslice.strides[i] = mslice.strides[0]
37613  * mslice.suboffsets[i] = -1
37614  */
37615  (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
37616 
37617  /* "View.MemoryView":1353
37618  * for i in range(offset):
37619  * mslice.shape[i] = 1
37620  * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
37621  * mslice.suboffsets[i] = -1
37622  *
37623  */
37624  (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
37625 
37626  /* "View.MemoryView":1354
37627  * mslice.shape[i] = 1
37628  * mslice.strides[i] = mslice.strides[0]
37629  * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
37630  *
37631  *
37632  */
37633  (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
37634  }
37635 
37636  /* "View.MemoryView":1340
37637  *
37638  * @cname('__pyx_memoryview_broadcast_leading')
37639  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
37640  * int ndim,
37641  * int ndim_other) nogil:
37642  */
37643 
37644  /* function exit code */
37645 }
37646 
37647 /* "View.MemoryView":1362
37648  *
37649  * @cname('__pyx_memoryview_refcount_copying')
37650  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
37651  * int ndim, bint inc) nogil:
37652  *
37653  */
37654 
37655 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
37656  int __pyx_t_1;
37657 
37658  /* "View.MemoryView":1366
37659  *
37660  *
37661  * if dtype_is_object: # <<<<<<<<<<<<<<
37662  * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
37663  * dst.strides, ndim, inc)
37664  */
37665  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
37666  if (__pyx_t_1) {
37667 
37668  /* "View.MemoryView":1367
37669  *
37670  * if dtype_is_object:
37671  * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
37672  * dst.strides, ndim, inc)
37673  *
37674  */
37675  __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
37676 
37677  /* "View.MemoryView":1366
37678  *
37679  *
37680  * if dtype_is_object: # <<<<<<<<<<<<<<
37681  * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
37682  * dst.strides, ndim, inc)
37683  */
37684  }
37685 
37686  /* "View.MemoryView":1362
37687  *
37688  * @cname('__pyx_memoryview_refcount_copying')
37689  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
37690  * int ndim, bint inc) nogil:
37691  *
37692  */
37693 
37694  /* function exit code */
37695 }
37696 
37697 /* "View.MemoryView":1371
37698  *
37699  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
37700  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
37701  * Py_ssize_t *strides, int ndim,
37702  * bint inc) with gil:
37703  */
37704 
37705 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
37706  __Pyx_RefNannyDeclarations
37707  #ifdef WITH_THREAD
37708  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
37709  #endif
37710  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
37711 
37712  /* "View.MemoryView":1374
37713  * Py_ssize_t *strides, int ndim,
37714  * bint inc) with gil:
37715  * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
37716  *
37717  * @cname('__pyx_memoryview_refcount_objects_in_slice')
37718  */
37719  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
37720 
37721  /* "View.MemoryView":1371
37722  *
37723  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
37724  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
37725  * Py_ssize_t *strides, int ndim,
37726  * bint inc) with gil:
37727  */
37728 
37729  /* function exit code */
37730  __Pyx_RefNannyFinishContext();
37731  #ifdef WITH_THREAD
37732  __Pyx_PyGILState_Release(__pyx_gilstate_save);
37733  #endif
37734 }
37735 
37736 /* "View.MemoryView":1377
37737  *
37738  * @cname('__pyx_memoryview_refcount_objects_in_slice')
37739  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
37740  * Py_ssize_t *strides, int ndim, bint inc):
37741  * cdef Py_ssize_t i
37742  */
37743 
37744 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
37745  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
37746  __Pyx_RefNannyDeclarations
37747  Py_ssize_t __pyx_t_1;
37748  Py_ssize_t __pyx_t_2;
37749  Py_ssize_t __pyx_t_3;
37750  int __pyx_t_4;
37751  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
37752 
37753  /* "View.MemoryView":1381
37754  * cdef Py_ssize_t i
37755  *
37756  * for i in range(shape[0]): # <<<<<<<<<<<<<<
37757  * if ndim == 1:
37758  * if inc:
37759  */
37760  __pyx_t_1 = (__pyx_v_shape[0]);
37761  __pyx_t_2 = __pyx_t_1;
37762  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
37763  __pyx_v_i = __pyx_t_3;
37764 
37765  /* "View.MemoryView":1382
37766  *
37767  * for i in range(shape[0]):
37768  * if ndim == 1: # <<<<<<<<<<<<<<
37769  * if inc:
37770  * Py_INCREF((<PyObject **> data)[0])
37771  */
37772  __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
37773  if (__pyx_t_4) {
37774 
37775  /* "View.MemoryView":1383
37776  * for i in range(shape[0]):
37777  * if ndim == 1:
37778  * if inc: # <<<<<<<<<<<<<<
37779  * Py_INCREF((<PyObject **> data)[0])
37780  * else:
37781  */
37782  __pyx_t_4 = (__pyx_v_inc != 0);
37783  if (__pyx_t_4) {
37784 
37785  /* "View.MemoryView":1384
37786  * if ndim == 1:
37787  * if inc:
37788  * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
37789  * else:
37790  * Py_DECREF((<PyObject **> data)[0])
37791  */
37792  Py_INCREF((((PyObject **)__pyx_v_data)[0]));
37793 
37794  /* "View.MemoryView":1383
37795  * for i in range(shape[0]):
37796  * if ndim == 1:
37797  * if inc: # <<<<<<<<<<<<<<
37798  * Py_INCREF((<PyObject **> data)[0])
37799  * else:
37800  */
37801  goto __pyx_L6;
37802  }
37803 
37804  /* "View.MemoryView":1386
37805  * Py_INCREF((<PyObject **> data)[0])
37806  * else:
37807  * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
37808  * else:
37809  * refcount_objects_in_slice(data, shape + 1, strides + 1,
37810  */
37811  /*else*/ {
37812  Py_DECREF((((PyObject **)__pyx_v_data)[0]));
37813  }
37814  __pyx_L6:;
37815 
37816  /* "View.MemoryView":1382
37817  *
37818  * for i in range(shape[0]):
37819  * if ndim == 1: # <<<<<<<<<<<<<<
37820  * if inc:
37821  * Py_INCREF((<PyObject **> data)[0])
37822  */
37823  goto __pyx_L5;
37824  }
37825 
37826  /* "View.MemoryView":1388
37827  * Py_DECREF((<PyObject **> data)[0])
37828  * else:
37829  * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
37830  * ndim - 1, inc)
37831  *
37832  */
37833  /*else*/ {
37834 
37835  /* "View.MemoryView":1389
37836  * else:
37837  * refcount_objects_in_slice(data, shape + 1, strides + 1,
37838  * ndim - 1, inc) # <<<<<<<<<<<<<<
37839  *
37840  * data += strides[0]
37841  */
37842  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
37843  }
37844  __pyx_L5:;
37845 
37846  /* "View.MemoryView":1391
37847  * ndim - 1, inc)
37848  *
37849  * data += strides[0] # <<<<<<<<<<<<<<
37850  *
37851  *
37852  */
37853  __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
37854  }
37855 
37856  /* "View.MemoryView":1377
37857  *
37858  * @cname('__pyx_memoryview_refcount_objects_in_slice')
37859  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
37860  * Py_ssize_t *strides, int ndim, bint inc):
37861  * cdef Py_ssize_t i
37862  */
37863 
37864  /* function exit code */
37865  __Pyx_RefNannyFinishContext();
37866 }
37867 
37868 /* "View.MemoryView":1397
37869  *
37870  * @cname('__pyx_memoryview_slice_assign_scalar')
37871  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
37872  * size_t itemsize, void *item,
37873  * bint dtype_is_object) nogil:
37874  */
37875 
37876 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
37877 
37878  /* "View.MemoryView":1400
37879  * size_t itemsize, void *item,
37880  * bint dtype_is_object) nogil:
37881  * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
37882  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
37883  * itemsize, item)
37884  */
37885  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
37886 
37887  /* "View.MemoryView":1401
37888  * bint dtype_is_object) nogil:
37889  * refcount_copying(dst, dtype_is_object, ndim, False)
37890  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
37891  * itemsize, item)
37892  * refcount_copying(dst, dtype_is_object, ndim, True)
37893  */
37894  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
37895 
37896  /* "View.MemoryView":1403
37897  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
37898  * itemsize, item)
37899  * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
37900  *
37901  *
37902  */
37903  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
37904 
37905  /* "View.MemoryView":1397
37906  *
37907  * @cname('__pyx_memoryview_slice_assign_scalar')
37908  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
37909  * size_t itemsize, void *item,
37910  * bint dtype_is_object) nogil:
37911  */
37912 
37913  /* function exit code */
37914 }
37915 
37916 /* "View.MemoryView":1407
37917  *
37918  * @cname('__pyx_memoryview__slice_assign_scalar')
37919  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
37920  * Py_ssize_t *strides, int ndim,
37921  * size_t itemsize, void *item) nogil:
37922  */
37923 
37924 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
37925  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
37926  Py_ssize_t __pyx_v_stride;
37927  Py_ssize_t __pyx_v_extent;
37928  int __pyx_t_1;
37929  Py_ssize_t __pyx_t_2;
37930  Py_ssize_t __pyx_t_3;
37931  Py_ssize_t __pyx_t_4;
37932 
37933  /* "View.MemoryView":1411
37934  * size_t itemsize, void *item) nogil:
37935  * cdef Py_ssize_t i
37936  * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
37937  * cdef Py_ssize_t extent = shape[0]
37938  *
37939  */
37940  __pyx_v_stride = (__pyx_v_strides[0]);
37941 
37942  /* "View.MemoryView":1412
37943  * cdef Py_ssize_t i
37944  * cdef Py_ssize_t stride = strides[0]
37945  * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
37946  *
37947  * if ndim == 1:
37948  */
37949  __pyx_v_extent = (__pyx_v_shape[0]);
37950 
37951  /* "View.MemoryView":1414
37952  * cdef Py_ssize_t extent = shape[0]
37953  *
37954  * if ndim == 1: # <<<<<<<<<<<<<<
37955  * for i in range(extent):
37956  * memcpy(data, item, itemsize)
37957  */
37958  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
37959  if (__pyx_t_1) {
37960 
37961  /* "View.MemoryView":1415
37962  *
37963  * if ndim == 1:
37964  * for i in range(extent): # <<<<<<<<<<<<<<
37965  * memcpy(data, item, itemsize)
37966  * data += stride
37967  */
37968  __pyx_t_2 = __pyx_v_extent;
37969  __pyx_t_3 = __pyx_t_2;
37970  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
37971  __pyx_v_i = __pyx_t_4;
37972 
37973  /* "View.MemoryView":1416
37974  * if ndim == 1:
37975  * for i in range(extent):
37976  * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
37977  * data += stride
37978  * else:
37979  */
37980  (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
37981 
37982  /* "View.MemoryView":1417
37983  * for i in range(extent):
37984  * memcpy(data, item, itemsize)
37985  * data += stride # <<<<<<<<<<<<<<
37986  * else:
37987  * for i in range(extent):
37988  */
37989  __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
37990  }
37991 
37992  /* "View.MemoryView":1414
37993  * cdef Py_ssize_t extent = shape[0]
37994  *
37995  * if ndim == 1: # <<<<<<<<<<<<<<
37996  * for i in range(extent):
37997  * memcpy(data, item, itemsize)
37998  */
37999  goto __pyx_L3;
38000  }
38001 
38002  /* "View.MemoryView":1419
38003  * data += stride
38004  * else:
38005  * for i in range(extent): # <<<<<<<<<<<<<<
38006  * _slice_assign_scalar(data, shape + 1, strides + 1,
38007  * ndim - 1, itemsize, item)
38008  */
38009  /*else*/ {
38010  __pyx_t_2 = __pyx_v_extent;
38011  __pyx_t_3 = __pyx_t_2;
38012  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
38013  __pyx_v_i = __pyx_t_4;
38014 
38015  /* "View.MemoryView":1420
38016  * else:
38017  * for i in range(extent):
38018  * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
38019  * ndim - 1, itemsize, item)
38020  * data += stride
38021  */
38022  __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
38023 
38024  /* "View.MemoryView":1422
38025  * _slice_assign_scalar(data, shape + 1, strides + 1,
38026  * ndim - 1, itemsize, item)
38027  * data += stride # <<<<<<<<<<<<<<
38028  *
38029  *
38030  */
38031  __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
38032  }
38033  }
38034  __pyx_L3:;
38035 
38036  /* "View.MemoryView":1407
38037  *
38038  * @cname('__pyx_memoryview__slice_assign_scalar')
38039  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
38040  * Py_ssize_t *strides, int ndim,
38041  * size_t itemsize, void *item) nogil:
38042  */
38043 
38044  /* function exit code */
38045 }
38046 
38047 /* "(tree fragment)":1
38048  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
38049  * cdef object __pyx_PickleError
38050  * cdef object __pyx_result
38051  */
38052 
38053 /* Python wrapper */
38054 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
38055 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
38056 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
38057  PyObject *__pyx_v___pyx_type = 0;
38058  long __pyx_v___pyx_checksum;
38059  PyObject *__pyx_v___pyx_state = 0;
38060  int __pyx_lineno = 0;
38061  const char *__pyx_filename = NULL;
38062  int __pyx_clineno = 0;
38063  PyObject *__pyx_r = 0;
38064  __Pyx_RefNannyDeclarations
38065  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
38066  {
38067  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
38068  PyObject* values[3] = {0,0,0};
38069  if (unlikely(__pyx_kwds)) {
38070  Py_ssize_t kw_args;
38071  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
38072  switch (pos_args) {
38073  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
38074  CYTHON_FALLTHROUGH;
38075  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
38076  CYTHON_FALLTHROUGH;
38077  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
38078  CYTHON_FALLTHROUGH;
38079  case 0: break;
38080  default: goto __pyx_L5_argtuple_error;
38081  }
38082  kw_args = PyDict_Size(__pyx_kwds);
38083  switch (pos_args) {
38084  case 0:
38085  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
38086  else goto __pyx_L5_argtuple_error;
38087  CYTHON_FALLTHROUGH;
38088  case 1:
38089  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
38090  else {
38091  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
38092  }
38093  CYTHON_FALLTHROUGH;
38094  case 2:
38095  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
38096  else {
38097  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
38098  }
38099  }
38100  if (unlikely(kw_args > 0)) {
38101  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
38102  }
38103  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
38104  goto __pyx_L5_argtuple_error;
38105  } else {
38106  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
38107  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
38108  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
38109  }
38110  __pyx_v___pyx_type = values[0];
38111  __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
38112  __pyx_v___pyx_state = values[2];
38113  }
38114  goto __pyx_L4_argument_unpacking_done;
38115  __pyx_L5_argtuple_error:;
38116  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
38117  __pyx_L3_error:;
38118  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
38119  __Pyx_RefNannyFinishContext();
38120  return NULL;
38121  __pyx_L4_argument_unpacking_done:;
38122  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
38123 
38124  /* function exit code */
38125  __Pyx_RefNannyFinishContext();
38126  return __pyx_r;
38127 }
38128 
38129 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
38130  PyObject *__pyx_v___pyx_PickleError = 0;
38131  PyObject *__pyx_v___pyx_result = 0;
38132  PyObject *__pyx_r = NULL;
38133  __Pyx_RefNannyDeclarations
38134  PyObject *__pyx_t_1 = NULL;
38135  int __pyx_t_2;
38136  int __pyx_t_3;
38137  PyObject *__pyx_t_4 = NULL;
38138  PyObject *__pyx_t_5 = NULL;
38139  PyObject *__pyx_t_6 = NULL;
38140  int __pyx_lineno = 0;
38141  const char *__pyx_filename = NULL;
38142  int __pyx_clineno = 0;
38143  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
38144 
38145  /* "(tree fragment)":4
38146  * cdef object __pyx_PickleError
38147  * cdef object __pyx_result
38148  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<<
38149  * from pickle import PickleError as __pyx_PickleError
38150  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
38151  */
38152  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
38153  __Pyx_GOTREF(__pyx_t_1);
38154  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__26, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error)
38155  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38156  __pyx_t_3 = (__pyx_t_2 != 0);
38157  if (__pyx_t_3) {
38158 
38159  /* "(tree fragment)":5
38160  * cdef object __pyx_result
38161  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):
38162  * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
38163  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
38164  * __pyx_result = Enum.__new__(__pyx_type)
38165  */
38166  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
38167  __Pyx_GOTREF(__pyx_t_1);
38168  __Pyx_INCREF(__pyx_n_s_PickleError);
38169  __Pyx_GIVEREF(__pyx_n_s_PickleError);
38170  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
38171  __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
38172  __Pyx_GOTREF(__pyx_t_4);
38173  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38174  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
38175  __Pyx_GOTREF(__pyx_t_1);
38176  __Pyx_INCREF(__pyx_t_1);
38177  __pyx_v___pyx_PickleError = __pyx_t_1;
38178  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38179  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38180 
38181  /* "(tree fragment)":6
38182  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):
38183  * from pickle import PickleError as __pyx_PickleError
38184  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
38185  * __pyx_result = Enum.__new__(__pyx_type)
38186  * if __pyx_state is not None:
38187  */
38188  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
38189  __Pyx_GOTREF(__pyx_t_1);
38190  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error)
38191  __Pyx_GOTREF(__pyx_t_5);
38192  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38193  __Pyx_INCREF(__pyx_v___pyx_PickleError);
38194  __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
38195  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
38196  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
38197  if (likely(__pyx_t_6)) {
38198  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
38199  __Pyx_INCREF(__pyx_t_6);
38200  __Pyx_INCREF(function);
38201  __Pyx_DECREF_SET(__pyx_t_1, function);
38202  }
38203  }
38204  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
38205  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
38206  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
38207  if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
38208  __Pyx_GOTREF(__pyx_t_4);
38209  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38210  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
38211  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38212  __PYX_ERR(2, 6, __pyx_L1_error)
38213 
38214  /* "(tree fragment)":4
38215  * cdef object __pyx_PickleError
38216  * cdef object __pyx_result
38217  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<<
38218  * from pickle import PickleError as __pyx_PickleError
38219  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
38220  */
38221  }
38222 
38223  /* "(tree fragment)":7
38224  * from pickle import PickleError as __pyx_PickleError
38225  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
38226  * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
38227  * if __pyx_state is not None:
38228  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38229  */
38230  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error)
38231  __Pyx_GOTREF(__pyx_t_1);
38232  __pyx_t_5 = NULL;
38233  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
38234  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
38235  if (likely(__pyx_t_5)) {
38236  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
38237  __Pyx_INCREF(__pyx_t_5);
38238  __Pyx_INCREF(function);
38239  __Pyx_DECREF_SET(__pyx_t_1, function);
38240  }
38241  }
38242  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
38243  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
38244  if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error)
38245  __Pyx_GOTREF(__pyx_t_4);
38246  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38247  __pyx_v___pyx_result = __pyx_t_4;
38248  __pyx_t_4 = 0;
38249 
38250  /* "(tree fragment)":8
38251  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
38252  * __pyx_result = Enum.__new__(__pyx_type)
38253  * if __pyx_state is not None: # <<<<<<<<<<<<<<
38254  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38255  * return __pyx_result
38256  */
38257  __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
38258  __pyx_t_2 = (__pyx_t_3 != 0);
38259  if (__pyx_t_2) {
38260 
38261  /* "(tree fragment)":9
38262  * __pyx_result = Enum.__new__(__pyx_type)
38263  * if __pyx_state is not None:
38264  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
38265  * return __pyx_result
38266  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38267  */
38268  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
38269  __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error)
38270  __Pyx_GOTREF(__pyx_t_4);
38271  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38272 
38273  /* "(tree fragment)":8
38274  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
38275  * __pyx_result = Enum.__new__(__pyx_type)
38276  * if __pyx_state is not None: # <<<<<<<<<<<<<<
38277  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38278  * return __pyx_result
38279  */
38280  }
38281 
38282  /* "(tree fragment)":10
38283  * if __pyx_state is not None:
38284  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38285  * return __pyx_result # <<<<<<<<<<<<<<
38286  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38287  * __pyx_result.name = __pyx_state[0]
38288  */
38289  __Pyx_XDECREF(__pyx_r);
38290  __Pyx_INCREF(__pyx_v___pyx_result);
38291  __pyx_r = __pyx_v___pyx_result;
38292  goto __pyx_L0;
38293 
38294  /* "(tree fragment)":1
38295  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
38296  * cdef object __pyx_PickleError
38297  * cdef object __pyx_result
38298  */
38299 
38300  /* function exit code */
38301  __pyx_L1_error:;
38302  __Pyx_XDECREF(__pyx_t_1);
38303  __Pyx_XDECREF(__pyx_t_4);
38304  __Pyx_XDECREF(__pyx_t_5);
38305  __Pyx_XDECREF(__pyx_t_6);
38306  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
38307  __pyx_r = NULL;
38308  __pyx_L0:;
38309  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
38310  __Pyx_XDECREF(__pyx_v___pyx_result);
38311  __Pyx_XGIVEREF(__pyx_r);
38312  __Pyx_RefNannyFinishContext();
38313  return __pyx_r;
38314 }
38315 
38316 /* "(tree fragment)":11
38317  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38318  * return __pyx_result
38319  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
38320  * __pyx_result.name = __pyx_state[0]
38321  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
38322  */
38323 
38324 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
38325  PyObject *__pyx_r = NULL;
38326  __Pyx_RefNannyDeclarations
38327  PyObject *__pyx_t_1 = NULL;
38328  int __pyx_t_2;
38329  Py_ssize_t __pyx_t_3;
38330  int __pyx_t_4;
38331  int __pyx_t_5;
38332  PyObject *__pyx_t_6 = NULL;
38333  PyObject *__pyx_t_7 = NULL;
38334  PyObject *__pyx_t_8 = NULL;
38335  int __pyx_lineno = 0;
38336  const char *__pyx_filename = NULL;
38337  int __pyx_clineno = 0;
38338  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
38339 
38340  /* "(tree fragment)":12
38341  * return __pyx_result
38342  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38343  * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
38344  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
38345  * __pyx_result.__dict__.update(__pyx_state[1])
38346  */
38347  if (unlikely(__pyx_v___pyx_state == Py_None)) {
38348  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
38349  __PYX_ERR(2, 12, __pyx_L1_error)
38350  }
38351  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
38352  __Pyx_GOTREF(__pyx_t_1);
38353  __Pyx_GIVEREF(__pyx_t_1);
38354  __Pyx_GOTREF(__pyx_v___pyx_result->name);
38355  __Pyx_DECREF(__pyx_v___pyx_result->name);
38356  __pyx_v___pyx_result->name = __pyx_t_1;
38357  __pyx_t_1 = 0;
38358 
38359  /* "(tree fragment)":13
38360  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38361  * __pyx_result.name = __pyx_state[0]
38362  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
38363  * __pyx_result.__dict__.update(__pyx_state[1])
38364  */
38365  if (unlikely(__pyx_v___pyx_state == Py_None)) {
38366  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
38367  __PYX_ERR(2, 13, __pyx_L1_error)
38368  }
38369  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
38370  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
38371  if (__pyx_t_4) {
38372  } else {
38373  __pyx_t_2 = __pyx_t_4;
38374  goto __pyx_L4_bool_binop_done;
38375  }
38376  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
38377  __pyx_t_5 = (__pyx_t_4 != 0);
38378  __pyx_t_2 = __pyx_t_5;
38379  __pyx_L4_bool_binop_done:;
38380  if (__pyx_t_2) {
38381 
38382  /* "(tree fragment)":14
38383  * __pyx_result.name = __pyx_state[0]
38384  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
38385  * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
38386  */
38387  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
38388  __Pyx_GOTREF(__pyx_t_6);
38389  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
38390  __Pyx_GOTREF(__pyx_t_7);
38391  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
38392  if (unlikely(__pyx_v___pyx_state == Py_None)) {
38393  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
38394  __PYX_ERR(2, 14, __pyx_L1_error)
38395  }
38396  __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
38397  __Pyx_GOTREF(__pyx_t_6);
38398  __pyx_t_8 = NULL;
38399  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
38400  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
38401  if (likely(__pyx_t_8)) {
38402  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
38403  __Pyx_INCREF(__pyx_t_8);
38404  __Pyx_INCREF(function);
38405  __Pyx_DECREF_SET(__pyx_t_7, function);
38406  }
38407  }
38408  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
38409  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
38410  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
38411  if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
38412  __Pyx_GOTREF(__pyx_t_1);
38413  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
38414  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
38415 
38416  /* "(tree fragment)":13
38417  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
38418  * __pyx_result.name = __pyx_state[0]
38419  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
38420  * __pyx_result.__dict__.update(__pyx_state[1])
38421  */
38422  }
38423 
38424  /* "(tree fragment)":11
38425  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
38426  * return __pyx_result
38427  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
38428  * __pyx_result.name = __pyx_state[0]
38429  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
38430  */
38431 
38432  /* function exit code */
38433  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
38434  goto __pyx_L0;
38435  __pyx_L1_error:;
38436  __Pyx_XDECREF(__pyx_t_1);
38437  __Pyx_XDECREF(__pyx_t_6);
38438  __Pyx_XDECREF(__pyx_t_7);
38439  __Pyx_XDECREF(__pyx_t_8);
38440  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
38441  __pyx_r = 0;
38442  __pyx_L0:;
38443  __Pyx_XGIVEREF(__pyx_r);
38444  __Pyx_RefNannyFinishContext();
38445  return __pyx_r;
38446 }
38447 
38448 /* "BufferFormatFromTypeInfo":1463
38449  *
38450  * @cname('__pyx_format_from_typeinfo')
38451  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<<
38452  * cdef __Pyx_StructField *field
38453  * cdef __pyx_typeinfo_string fmt
38454  */
38455 
38456 static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *__pyx_v_type) {
38457  __Pyx_StructField *__pyx_v_field;
38458  struct __pyx_typeinfo_string __pyx_v_fmt;
38459  PyObject *__pyx_v_part = 0;
38460  PyObject *__pyx_v_result = 0;
38461  PyObject *__pyx_v_alignment = NULL;
38462  PyObject *__pyx_v_parts = NULL;
38463  PyObject *__pyx_v_extents = NULL;
38464  int __pyx_v_i;
38465  PyObject *__pyx_r = NULL;
38466  __Pyx_RefNannyDeclarations
38467  int __pyx_t_1;
38468  PyObject *__pyx_t_2 = NULL;
38469  __Pyx_StructField *__pyx_t_3;
38470  PyObject *__pyx_t_4 = NULL;
38471  PyObject *__pyx_t_5 = NULL;
38472  int __pyx_t_6;
38473  int __pyx_t_7;
38474  int __pyx_t_8;
38475  int __pyx_t_9;
38476  int __pyx_lineno = 0;
38477  const char *__pyx_filename = NULL;
38478  int __pyx_clineno = 0;
38479  __Pyx_RefNannySetupContext("format_from_typeinfo", 0);
38480 
38481  /* "BufferFormatFromTypeInfo":1468
38482  * cdef bytes part, result
38483  *
38484  * if type.typegroup == 'S': # <<<<<<<<<<<<<<
38485  * assert type.fields != NULL
38486  * assert type.fields.type != NULL
38487  */
38488  __pyx_t_1 = ((__pyx_v_type->typegroup == 'S') != 0);
38489  if (__pyx_t_1) {
38490 
38491  /* "BufferFormatFromTypeInfo":1469
38492  *
38493  * if type.typegroup == 'S':
38494  * assert type.fields != NULL # <<<<<<<<<<<<<<
38495  * assert type.fields.type != NULL
38496  *
38497  */
38498  #ifndef CYTHON_WITHOUT_ASSERTIONS
38499  if (unlikely(!Py_OptimizeFlag)) {
38500  if (unlikely(!((__pyx_v_type->fields != NULL) != 0))) {
38501  PyErr_SetNone(PyExc_AssertionError);
38502  __PYX_ERR(2, 1469, __pyx_L1_error)
38503  }
38504  }
38505  #endif
38506 
38507  /* "BufferFormatFromTypeInfo":1470
38508  * if type.typegroup == 'S':
38509  * assert type.fields != NULL
38510  * assert type.fields.type != NULL # <<<<<<<<<<<<<<
38511  *
38512  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
38513  */
38514  #ifndef CYTHON_WITHOUT_ASSERTIONS
38515  if (unlikely(!Py_OptimizeFlag)) {
38516  if (unlikely(!((__pyx_v_type->fields->type != NULL) != 0))) {
38517  PyErr_SetNone(PyExc_AssertionError);
38518  __PYX_ERR(2, 1470, __pyx_L1_error)
38519  }
38520  }
38521  #endif
38522 
38523  /* "BufferFormatFromTypeInfo":1472
38524  * assert type.fields.type != NULL
38525  *
38526  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: # <<<<<<<<<<<<<<
38527  * alignment = b'^'
38528  * else:
38529  */
38530  __pyx_t_1 = ((__pyx_v_type->flags & __PYX_BUF_FLAGS_PACKED_STRUCT) != 0);
38531  if (__pyx_t_1) {
38532 
38533  /* "BufferFormatFromTypeInfo":1473
38534  *
38535  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT:
38536  * alignment = b'^' # <<<<<<<<<<<<<<
38537  * else:
38538  * alignment = b''
38539  */
38540  __Pyx_INCREF(__pyx_kp_b__27);
38541  __pyx_v_alignment = __pyx_kp_b__27;
38542 
38543  /* "BufferFormatFromTypeInfo":1472
38544  * assert type.fields.type != NULL
38545  *
38546  * if type.flags & __PYX_BUF_FLAGS_PACKED_STRUCT: # <<<<<<<<<<<<<<
38547  * alignment = b'^'
38548  * else:
38549  */
38550  goto __pyx_L4;
38551  }
38552 
38553  /* "BufferFormatFromTypeInfo":1475
38554  * alignment = b'^'
38555  * else:
38556  * alignment = b'' # <<<<<<<<<<<<<<
38557  *
38558  * parts = [b"T{"]
38559  */
38560  /*else*/ {
38561  __Pyx_INCREF(__pyx_kp_b__28);
38562  __pyx_v_alignment = __pyx_kp_b__28;
38563  }
38564  __pyx_L4:;
38565 
38566  /* "BufferFormatFromTypeInfo":1477
38567  * alignment = b''
38568  *
38569  * parts = [b"T{"] # <<<<<<<<<<<<<<
38570  * field = type.fields
38571  *
38572  */
38573  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1477, __pyx_L1_error)
38574  __Pyx_GOTREF(__pyx_t_2);
38575  __Pyx_INCREF(__pyx_kp_b_T);
38576  __Pyx_GIVEREF(__pyx_kp_b_T);
38577  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_kp_b_T);
38578  __pyx_v_parts = ((PyObject*)__pyx_t_2);
38579  __pyx_t_2 = 0;
38580 
38581  /* "BufferFormatFromTypeInfo":1478
38582  *
38583  * parts = [b"T{"]
38584  * field = type.fields # <<<<<<<<<<<<<<
38585  *
38586  * while field.type:
38587  */
38588  __pyx_t_3 = __pyx_v_type->fields;
38589  __pyx_v_field = __pyx_t_3;
38590 
38591  /* "BufferFormatFromTypeInfo":1480
38592  * field = type.fields
38593  *
38594  * while field.type: # <<<<<<<<<<<<<<
38595  * part = format_from_typeinfo(field.type)
38596  * parts.append(part + b':' + field.name + b':')
38597  */
38598  while (1) {
38599  __pyx_t_1 = (__pyx_v_field->type != 0);
38600  if (!__pyx_t_1) break;
38601 
38602  /* "BufferFormatFromTypeInfo":1481
38603  *
38604  * while field.type:
38605  * part = format_from_typeinfo(field.type) # <<<<<<<<<<<<<<
38606  * parts.append(part + b':' + field.name + b':')
38607  * field += 1
38608  */
38609  __pyx_t_2 = __pyx_format_from_typeinfo(__pyx_v_field->type); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1481, __pyx_L1_error)
38610  __Pyx_GOTREF(__pyx_t_2);
38611  __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
38612  __pyx_t_2 = 0;
38613 
38614  /* "BufferFormatFromTypeInfo":1482
38615  * while field.type:
38616  * part = format_from_typeinfo(field.type)
38617  * parts.append(part + b':' + field.name + b':') # <<<<<<<<<<<<<<
38618  * field += 1
38619  *
38620  */
38621  __pyx_t_2 = PyNumber_Add(__pyx_v_part, __pyx_kp_b__29); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1482, __pyx_L1_error)
38622  __Pyx_GOTREF(__pyx_t_2);
38623  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_field->name); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1482, __pyx_L1_error)
38624  __Pyx_GOTREF(__pyx_t_4);
38625  __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1482, __pyx_L1_error)
38626  __Pyx_GOTREF(__pyx_t_5);
38627  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38628  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38629  __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_kp_b__29); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1482, __pyx_L1_error)
38630  __Pyx_GOTREF(__pyx_t_4);
38631  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
38632  __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_t_4); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1482, __pyx_L1_error)
38633  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38634 
38635  /* "BufferFormatFromTypeInfo":1483
38636  * part = format_from_typeinfo(field.type)
38637  * parts.append(part + b':' + field.name + b':')
38638  * field += 1 # <<<<<<<<<<<<<<
38639  *
38640  * result = alignment.join(parts) + b'}'
38641  */
38642  __pyx_v_field = (__pyx_v_field + 1);
38643  }
38644 
38645  /* "BufferFormatFromTypeInfo":1485
38646  * field += 1
38647  *
38648  * result = alignment.join(parts) + b'}' # <<<<<<<<<<<<<<
38649  * else:
38650  * fmt = __Pyx_TypeInfoToFormat(type)
38651  */
38652  __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_v_alignment, __pyx_v_parts); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1485, __pyx_L1_error)
38653  __Pyx_GOTREF(__pyx_t_4);
38654  __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_kp_b__30); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1485, __pyx_L1_error)
38655  __Pyx_GOTREF(__pyx_t_5);
38656  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38657  if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_5)->tp_name), 0))) __PYX_ERR(2, 1485, __pyx_L1_error)
38658  __pyx_v_result = ((PyObject*)__pyx_t_5);
38659  __pyx_t_5 = 0;
38660 
38661  /* "BufferFormatFromTypeInfo":1468
38662  * cdef bytes part, result
38663  *
38664  * if type.typegroup == 'S': # <<<<<<<<<<<<<<
38665  * assert type.fields != NULL
38666  * assert type.fields.type != NULL
38667  */
38668  goto __pyx_L3;
38669  }
38670 
38671  /* "BufferFormatFromTypeInfo":1487
38672  * result = alignment.join(parts) + b'}'
38673  * else:
38674  * fmt = __Pyx_TypeInfoToFormat(type) # <<<<<<<<<<<<<<
38675  * if type.arraysize[0]:
38676  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
38677  */
38678  /*else*/ {
38679  __pyx_v_fmt = __Pyx_TypeInfoToFormat(__pyx_v_type);
38680 
38681  /* "BufferFormatFromTypeInfo":1488
38682  * else:
38683  * fmt = __Pyx_TypeInfoToFormat(type)
38684  * if type.arraysize[0]: # <<<<<<<<<<<<<<
38685  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
38686  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
38687  */
38688  __pyx_t_1 = ((__pyx_v_type->arraysize[0]) != 0);
38689  if (__pyx_t_1) {
38690 
38691  /* "BufferFormatFromTypeInfo":1489
38692  * fmt = __Pyx_TypeInfoToFormat(type)
38693  * if type.arraysize[0]:
38694  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)] # <<<<<<<<<<<<<<
38695  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
38696  * else:
38697  */
38698  __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1489, __pyx_L1_error)
38699  __Pyx_GOTREF(__pyx_t_5);
38700  __pyx_t_7 = __pyx_v_type->ndim;
38701  __pyx_t_8 = __pyx_t_7;
38702  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
38703  __pyx_v_i = __pyx_t_9;
38704  __pyx_t_4 = __Pyx_PyInt_FromSize_t((__pyx_v_type->arraysize[__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1489, __pyx_L1_error)
38705  __Pyx_GOTREF(__pyx_t_4);
38706  __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1489, __pyx_L1_error)
38707  __Pyx_GOTREF(__pyx_t_2);
38708  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
38709  if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 1489, __pyx_L1_error)
38710  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38711  }
38712  __pyx_v_extents = ((PyObject*)__pyx_t_5);
38713  __pyx_t_5 = 0;
38714 
38715  /* "BufferFormatFromTypeInfo":1490
38716  * if type.arraysize[0]:
38717  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
38718  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string # <<<<<<<<<<<<<<
38719  * else:
38720  * result = fmt.string
38721  */
38722  __pyx_t_5 = PyUnicode_Join(__pyx_kp_u__31, __pyx_v_extents); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1490, __pyx_L1_error)
38723  __Pyx_GOTREF(__pyx_t_5);
38724  __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_s, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1490, __pyx_L1_error)
38725  __Pyx_GOTREF(__pyx_t_2);
38726  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
38727  __pyx_t_5 = PyUnicode_AsASCIIString(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1490, __pyx_L1_error)
38728  __Pyx_GOTREF(__pyx_t_5);
38729  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38730  __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1490, __pyx_L1_error)
38731  __Pyx_GOTREF(__pyx_t_2);
38732  __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1490, __pyx_L1_error)
38733  __Pyx_GOTREF(__pyx_t_4);
38734  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
38735  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
38736  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 1490, __pyx_L1_error)
38737  __pyx_v_result = ((PyObject*)__pyx_t_4);
38738  __pyx_t_4 = 0;
38739 
38740  /* "BufferFormatFromTypeInfo":1488
38741  * else:
38742  * fmt = __Pyx_TypeInfoToFormat(type)
38743  * if type.arraysize[0]: # <<<<<<<<<<<<<<
38744  * extents = [unicode(type.arraysize[i]) for i in range(type.ndim)]
38745  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
38746  */
38747  goto __pyx_L7;
38748  }
38749 
38750  /* "BufferFormatFromTypeInfo":1492
38751  * result = (u"(%s)" % u','.join(extents)).encode('ascii') + fmt.string
38752  * else:
38753  * result = fmt.string # <<<<<<<<<<<<<<
38754  *
38755  * return result
38756  */
38757  /*else*/ {
38758  __pyx_t_4 = __Pyx_PyObject_FromString(__pyx_v_fmt.string); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1492, __pyx_L1_error)
38759  __Pyx_GOTREF(__pyx_t_4);
38760  __pyx_v_result = ((PyObject*)__pyx_t_4);
38761  __pyx_t_4 = 0;
38762  }
38763  __pyx_L7:;
38764  }
38765  __pyx_L3:;
38766 
38767  /* "BufferFormatFromTypeInfo":1494
38768  * result = fmt.string
38769  *
38770  * return result # <<<<<<<<<<<<<<
38771  */
38772  __Pyx_XDECREF(__pyx_r);
38773  __Pyx_INCREF(__pyx_v_result);
38774  __pyx_r = __pyx_v_result;
38775  goto __pyx_L0;
38776 
38777  /* "BufferFormatFromTypeInfo":1463
38778  *
38779  * @cname('__pyx_format_from_typeinfo')
38780  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<<
38781  * cdef __Pyx_StructField *field
38782  * cdef __pyx_typeinfo_string fmt
38783  */
38784 
38785  /* function exit code */
38786  __pyx_L1_error:;
38787  __Pyx_XDECREF(__pyx_t_2);
38788  __Pyx_XDECREF(__pyx_t_4);
38789  __Pyx_XDECREF(__pyx_t_5);
38790  __Pyx_AddTraceback("BufferFormatFromTypeInfo.format_from_typeinfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
38791  __pyx_r = 0;
38792  __pyx_L0:;
38793  __Pyx_XDECREF(__pyx_v_part);
38794  __Pyx_XDECREF(__pyx_v_result);
38795  __Pyx_XDECREF(__pyx_v_alignment);
38796  __Pyx_XDECREF(__pyx_v_parts);
38797  __Pyx_XDECREF(__pyx_v_extents);
38798  __Pyx_XGIVEREF(__pyx_r);
38799  __Pyx_RefNannyFinishContext();
38800  return __pyx_r;
38801 }
38802 
38803 static struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues[8];
38804 static int __pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = 0;
38805 
38806 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
38807  PyObject *o;
38808  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues)))) {
38809  o = (PyObject*)__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues[--__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues];
38810  memset(o, 0, sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues));
38811  (void) PyObject_INIT(o, t);
38812  } else {
38813  o = (*t->tp_alloc)(t, 0);
38814  if (unlikely(!o)) return 0;
38815  }
38816  return o;
38817 }
38818 
38819 static void __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues(PyObject *o) {
38820  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues)))) {
38821  __pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues[__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues++] = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues *)o);
38822  } else {
38823  (*Py_TYPE(o)->tp_free)(o);
38824  }
38825 }
38826 
38827 static PyTypeObject __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = {
38828  PyVarObject_HEAD_INIT(0, 0)
38829  "mprans.MeshSmoothing.__pyx_scope_struct__getNonOwnedNodeValues", /*tp_name*/
38830  sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues), /*tp_basicsize*/
38831  0, /*tp_itemsize*/
38832  __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues, /*tp_dealloc*/
38833  #if PY_VERSION_HEX < 0x030800b4
38834  0, /*tp_print*/
38835  #endif
38836  #if PY_VERSION_HEX >= 0x030800b4
38837  0, /*tp_vectorcall_offset*/
38838  #endif
38839  0, /*tp_getattr*/
38840  0, /*tp_setattr*/
38841  #if PY_MAJOR_VERSION < 3
38842  0, /*tp_compare*/
38843  #endif
38844  #if PY_MAJOR_VERSION >= 3
38845  0, /*tp_as_async*/
38846  #endif
38847  0, /*tp_repr*/
38848  0, /*tp_as_number*/
38849  0, /*tp_as_sequence*/
38850  0, /*tp_as_mapping*/
38851  0, /*tp_hash*/
38852  0, /*tp_call*/
38853  0, /*tp_str*/
38854  0, /*tp_getattro*/
38855  0, /*tp_setattro*/
38856  0, /*tp_as_buffer*/
38857  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER, /*tp_flags*/
38858  0, /*tp_doc*/
38859  0, /*tp_traverse*/
38860  0, /*tp_clear*/
38861  0, /*tp_richcompare*/
38862  0, /*tp_weaklistoffset*/
38863  0, /*tp_iter*/
38864  0, /*tp_iternext*/
38865  0, /*tp_methods*/
38866  0, /*tp_members*/
38867  0, /*tp_getset*/
38868  0, /*tp_base*/
38869  0, /*tp_dict*/
38870  0, /*tp_descr_get*/
38871  0, /*tp_descr_set*/
38872  0, /*tp_dictoffset*/
38873  0, /*tp_init*/
38874  0, /*tp_alloc*/
38875  __pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues, /*tp_new*/
38876  0, /*tp_free*/
38877  0, /*tp_is_gc*/
38878  0, /*tp_bases*/
38879  0, /*tp_mro*/
38880  0, /*tp_cache*/
38881  0, /*tp_subclasses*/
38882  0, /*tp_weaklist*/
38883  0, /*tp_del*/
38884  0, /*tp_version_tag*/
38885  #if PY_VERSION_HEX >= 0x030400a1
38886  0, /*tp_finalize*/
38887  #endif
38888  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
38889  0, /*tp_vectorcall*/
38890  #endif
38891  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
38892  0, /*tp_print*/
38893  #endif
38894  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
38895  0, /*tp_pypy_flags*/
38896  #endif
38897 };
38898 
38899 static struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr[8];
38900 static int __pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = 0;
38901 
38902 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
38903  PyObject *o;
38904  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr)))) {
38905  o = (PyObject*)__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr[--__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr];
38906  memset(o, 0, sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr));
38907  (void) PyObject_INIT(o, t);
38908  PyObject_GC_Track(o);
38909  } else {
38910  o = (*t->tp_alloc)(t, 0);
38911  if (unlikely(!o)) return 0;
38912  }
38913  return o;
38914 }
38915 
38916 static void __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyObject *o) {
38917  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)o;
38918  PyObject_GC_UnTrack(o);
38919  Py_CLEAR(p->__pyx_outer_scope);
38920  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr)))) {
38921  __pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr[__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)o);
38922  } else {
38923  (*Py_TYPE(o)->tp_free)(o);
38924  }
38925 }
38926 
38927 static int __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
38928  int e;
38929  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr *)o;
38930  if (p->__pyx_outer_scope) {
38931  e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
38932  }
38933  return 0;
38934 }
38935 
38936 static PyTypeObject __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = {
38937  PyVarObject_HEAD_INIT(0, 0)
38938  "mprans.MeshSmoothing.__pyx_scope_struct_1_genexpr", /*tp_name*/
38939  sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
38940  0, /*tp_itemsize*/
38941  __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
38942  #if PY_VERSION_HEX < 0x030800b4
38943  0, /*tp_print*/
38944  #endif
38945  #if PY_VERSION_HEX >= 0x030800b4
38946  0, /*tp_vectorcall_offset*/
38947  #endif
38948  0, /*tp_getattr*/
38949  0, /*tp_setattr*/
38950  #if PY_MAJOR_VERSION < 3
38951  0, /*tp_compare*/
38952  #endif
38953  #if PY_MAJOR_VERSION >= 3
38954  0, /*tp_as_async*/
38955  #endif
38956  0, /*tp_repr*/
38957  0, /*tp_as_number*/
38958  0, /*tp_as_sequence*/
38959  0, /*tp_as_mapping*/
38960  0, /*tp_hash*/
38961  0, /*tp_call*/
38962  0, /*tp_str*/
38963  0, /*tp_getattro*/
38964  0, /*tp_setattro*/
38965  0, /*tp_as_buffer*/
38966  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
38967  0, /*tp_doc*/
38968  __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, /*tp_traverse*/
38969  0, /*tp_clear*/
38970  0, /*tp_richcompare*/
38971  0, /*tp_weaklistoffset*/
38972  0, /*tp_iter*/
38973  0, /*tp_iternext*/
38974  0, /*tp_methods*/
38975  0, /*tp_members*/
38976  0, /*tp_getset*/
38977  0, /*tp_base*/
38978  0, /*tp_dict*/
38979  0, /*tp_descr_get*/
38980  0, /*tp_descr_set*/
38981  0, /*tp_dictoffset*/
38982  0, /*tp_init*/
38983  0, /*tp_alloc*/
38984  __pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr, /*tp_new*/
38985  0, /*tp_free*/
38986  0, /*tp_is_gc*/
38987  0, /*tp_bases*/
38988  0, /*tp_mro*/
38989  0, /*tp_cache*/
38990  0, /*tp_subclasses*/
38991  0, /*tp_weaklist*/
38992  0, /*tp_del*/
38993  0, /*tp_version_tag*/
38994  #if PY_VERSION_HEX >= 0x030400a1
38995  0, /*tp_finalize*/
38996  #endif
38997  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
38998  0, /*tp_vectorcall*/
38999  #endif
39000  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39001  0, /*tp_print*/
39002  #endif
39003  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
39004  0, /*tp_pypy_flags*/
39005  #endif
39006 };
39007 
39008 static struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr[8];
39009 static int __pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = 0;
39010 
39011 static PyObject *__pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
39012  PyObject *o;
39013  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr)))) {
39014  o = (PyObject*)__pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr[--__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr];
39015  memset(o, 0, sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr));
39016  (void) PyObject_INIT(o, t);
39017  PyObject_GC_Track(o);
39018  } else {
39019  o = (*t->tp_alloc)(t, 0);
39020  if (unlikely(!o)) return 0;
39021  }
39022  return o;
39023 }
39024 
39025 static void __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyObject *o) {
39026  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)o;
39027  PyObject_GC_UnTrack(o);
39028  Py_CLEAR(p->__pyx_outer_scope);
39029  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr)))) {
39030  __pyx_freelist_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr[__pyx_freecount_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)o);
39031  } else {
39032  (*Py_TYPE(o)->tp_free)(o);
39033  }
39034 }
39035 
39036 static int __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
39037  int e;
39038  struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr *)o;
39039  if (p->__pyx_outer_scope) {
39040  e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
39041  }
39042  return 0;
39043 }
39044 
39045 static PyTypeObject __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = {
39046  PyVarObject_HEAD_INIT(0, 0)
39047  "mprans.MeshSmoothing.__pyx_scope_struct_2_genexpr", /*tp_name*/
39048  sizeof(struct __pyx_obj_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
39049  0, /*tp_itemsize*/
39050  __pyx_tp_dealloc_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
39051  #if PY_VERSION_HEX < 0x030800b4
39052  0, /*tp_print*/
39053  #endif
39054  #if PY_VERSION_HEX >= 0x030800b4
39055  0, /*tp_vectorcall_offset*/
39056  #endif
39057  0, /*tp_getattr*/
39058  0, /*tp_setattr*/
39059  #if PY_MAJOR_VERSION < 3
39060  0, /*tp_compare*/
39061  #endif
39062  #if PY_MAJOR_VERSION >= 3
39063  0, /*tp_as_async*/
39064  #endif
39065  0, /*tp_repr*/
39066  0, /*tp_as_number*/
39067  0, /*tp_as_sequence*/
39068  0, /*tp_as_mapping*/
39069  0, /*tp_hash*/
39070  0, /*tp_call*/
39071  0, /*tp_str*/
39072  0, /*tp_getattro*/
39073  0, /*tp_setattro*/
39074  0, /*tp_as_buffer*/
39075  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
39076  0, /*tp_doc*/
39077  __pyx_tp_traverse_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, /*tp_traverse*/
39078  0, /*tp_clear*/
39079  0, /*tp_richcompare*/
39080  0, /*tp_weaklistoffset*/
39081  0, /*tp_iter*/
39082  0, /*tp_iternext*/
39083  0, /*tp_methods*/
39084  0, /*tp_members*/
39085  0, /*tp_getset*/
39086  0, /*tp_base*/
39087  0, /*tp_dict*/
39088  0, /*tp_descr_get*/
39089  0, /*tp_descr_set*/
39090  0, /*tp_dictoffset*/
39091  0, /*tp_init*/
39092  0, /*tp_alloc*/
39093  __pyx_tp_new_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr, /*tp_new*/
39094  0, /*tp_free*/
39095  0, /*tp_is_gc*/
39096  0, /*tp_bases*/
39097  0, /*tp_mro*/
39098  0, /*tp_cache*/
39099  0, /*tp_subclasses*/
39100  0, /*tp_weaklist*/
39101  0, /*tp_del*/
39102  0, /*tp_version_tag*/
39103  #if PY_VERSION_HEX >= 0x030400a1
39104  0, /*tp_finalize*/
39105  #endif
39106  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
39107  0, /*tp_vectorcall*/
39108  #endif
39109  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39110  0, /*tp_print*/
39111  #endif
39112  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
39113  0, /*tp_pypy_flags*/
39114  #endif
39115 };
39116 static struct __pyx_vtabstruct_array __pyx_vtable_array;
39117 
39118 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
39119  struct __pyx_array_obj *p;
39120  PyObject *o;
39121  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
39122  o = (*t->tp_alloc)(t, 0);
39123  } else {
39124  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
39125  }
39126  if (unlikely(!o)) return 0;
39127  p = ((struct __pyx_array_obj *)o);
39128  p->__pyx_vtab = __pyx_vtabptr_array;
39129  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
39130  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
39131  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
39132  return o;
39133  bad:
39134  Py_DECREF(o); o = 0;
39135  return NULL;
39136 }
39137 
39138 static void __pyx_tp_dealloc_array(PyObject *o) {
39139  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
39140  #if CYTHON_USE_TP_FINALIZE
39141  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
39142  if (PyObject_CallFinalizerFromDealloc(o)) return;
39143  }
39144  #endif
39145  {
39146  PyObject *etype, *eval, *etb;
39147  PyErr_Fetch(&etype, &eval, &etb);
39148  __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
39149  __pyx_array___dealloc__(o);
39150  __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
39151  PyErr_Restore(etype, eval, etb);
39152  }
39153  Py_CLEAR(p->mode);
39154  Py_CLEAR(p->_format);
39155  (*Py_TYPE(o)->tp_free)(o);
39156 }
39157 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
39158  PyObject *r;
39159  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
39160  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
39161  Py_DECREF(x);
39162  return r;
39163 }
39164 
39165 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
39166  if (v) {
39167  return __pyx_array___setitem__(o, i, v);
39168  }
39169  else {
39170  PyErr_Format(PyExc_NotImplementedError,
39171  "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
39172  return -1;
39173  }
39174 }
39175 
39176 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
39177  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
39178  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
39179  PyErr_Clear();
39180  v = __pyx_array___getattr__(o, n);
39181  }
39182  return v;
39183 }
39184 
39185 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
39186  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
39187 }
39188 
39189 static PyMethodDef __pyx_methods_array[] = {
39190  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
39191  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
39192  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
39193  {0, 0, 0, 0}
39194 };
39195 
39196 static struct PyGetSetDef __pyx_getsets_array[] = {
39197  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
39198  {0, 0, 0, 0, 0}
39199 };
39200 
39201 static PySequenceMethods __pyx_tp_as_sequence_array = {
39202  __pyx_array___len__, /*sq_length*/
39203  0, /*sq_concat*/
39204  0, /*sq_repeat*/
39205  __pyx_sq_item_array, /*sq_item*/
39206  0, /*sq_slice*/
39207  0, /*sq_ass_item*/
39208  0, /*sq_ass_slice*/
39209  0, /*sq_contains*/
39210  0, /*sq_inplace_concat*/
39211  0, /*sq_inplace_repeat*/
39212 };
39213 
39214 static PyMappingMethods __pyx_tp_as_mapping_array = {
39215  __pyx_array___len__, /*mp_length*/
39216  __pyx_array___getitem__, /*mp_subscript*/
39217  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
39218 };
39219 
39220 static PyBufferProcs __pyx_tp_as_buffer_array = {
39221  #if PY_MAJOR_VERSION < 3
39222  0, /*bf_getreadbuffer*/
39223  #endif
39224  #if PY_MAJOR_VERSION < 3
39225  0, /*bf_getwritebuffer*/
39226  #endif
39227  #if PY_MAJOR_VERSION < 3
39228  0, /*bf_getsegcount*/
39229  #endif
39230  #if PY_MAJOR_VERSION < 3
39231  0, /*bf_getcharbuffer*/
39232  #endif
39233  __pyx_array_getbuffer, /*bf_getbuffer*/
39234  0, /*bf_releasebuffer*/
39235 };
39236 
39237 static PyTypeObject __pyx_type___pyx_array = {
39238  PyVarObject_HEAD_INIT(0, 0)
39239  "mprans.MeshSmoothing.array", /*tp_name*/
39240  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
39241  0, /*tp_itemsize*/
39242  __pyx_tp_dealloc_array, /*tp_dealloc*/
39243  #if PY_VERSION_HEX < 0x030800b4
39244  0, /*tp_print*/
39245  #endif
39246  #if PY_VERSION_HEX >= 0x030800b4
39247  0, /*tp_vectorcall_offset*/
39248  #endif
39249  0, /*tp_getattr*/
39250  0, /*tp_setattr*/
39251  #if PY_MAJOR_VERSION < 3
39252  0, /*tp_compare*/
39253  #endif
39254  #if PY_MAJOR_VERSION >= 3
39255  0, /*tp_as_async*/
39256  #endif
39257  0, /*tp_repr*/
39258  0, /*tp_as_number*/
39259  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
39260  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
39261  0, /*tp_hash*/
39262  0, /*tp_call*/
39263  0, /*tp_str*/
39264  __pyx_tp_getattro_array, /*tp_getattro*/
39265  0, /*tp_setattro*/
39266  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
39267  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
39268  0, /*tp_doc*/
39269  0, /*tp_traverse*/
39270  0, /*tp_clear*/
39271  0, /*tp_richcompare*/
39272  0, /*tp_weaklistoffset*/
39273  0, /*tp_iter*/
39274  0, /*tp_iternext*/
39275  __pyx_methods_array, /*tp_methods*/
39276  0, /*tp_members*/
39277  __pyx_getsets_array, /*tp_getset*/
39278  0, /*tp_base*/
39279  0, /*tp_dict*/
39280  0, /*tp_descr_get*/
39281  0, /*tp_descr_set*/
39282  0, /*tp_dictoffset*/
39283  0, /*tp_init*/
39284  0, /*tp_alloc*/
39285  __pyx_tp_new_array, /*tp_new*/
39286  0, /*tp_free*/
39287  0, /*tp_is_gc*/
39288  0, /*tp_bases*/
39289  0, /*tp_mro*/
39290  0, /*tp_cache*/
39291  0, /*tp_subclasses*/
39292  0, /*tp_weaklist*/
39293  0, /*tp_del*/
39294  0, /*tp_version_tag*/
39295  #if PY_VERSION_HEX >= 0x030400a1
39296  0, /*tp_finalize*/
39297  #endif
39298  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
39299  0, /*tp_vectorcall*/
39300  #endif
39301  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39302  0, /*tp_print*/
39303  #endif
39304  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
39305  0, /*tp_pypy_flags*/
39306  #endif
39307 };
39308 
39309 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
39310  struct __pyx_MemviewEnum_obj *p;
39311  PyObject *o;
39312  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
39313  o = (*t->tp_alloc)(t, 0);
39314  } else {
39315  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
39316  }
39317  if (unlikely(!o)) return 0;
39318  p = ((struct __pyx_MemviewEnum_obj *)o);
39319  p->name = Py_None; Py_INCREF(Py_None);
39320  return o;
39321 }
39322 
39323 static void __pyx_tp_dealloc_Enum(PyObject *o) {
39324  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
39325  #if CYTHON_USE_TP_FINALIZE
39326  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
39327  if (PyObject_CallFinalizerFromDealloc(o)) return;
39328  }
39329  #endif
39330  PyObject_GC_UnTrack(o);
39331  Py_CLEAR(p->name);
39332  (*Py_TYPE(o)->tp_free)(o);
39333 }
39334 
39335 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
39336  int e;
39337  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
39338  if (p->name) {
39339  e = (*v)(p->name, a); if (e) return e;
39340  }
39341  return 0;
39342 }
39343 
39344 static int __pyx_tp_clear_Enum(PyObject *o) {
39345  PyObject* tmp;
39346  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
39347  tmp = ((PyObject*)p->name);
39348  p->name = Py_None; Py_INCREF(Py_None);
39349  Py_XDECREF(tmp);
39350  return 0;
39351 }
39352 
39353 static PyMethodDef __pyx_methods_Enum[] = {
39354  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
39355  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
39356  {0, 0, 0, 0}
39357 };
39358 
39359 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
39360  PyVarObject_HEAD_INIT(0, 0)
39361  "mprans.MeshSmoothing.Enum", /*tp_name*/
39362  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
39363  0, /*tp_itemsize*/
39364  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
39365  #if PY_VERSION_HEX < 0x030800b4
39366  0, /*tp_print*/
39367  #endif
39368  #if PY_VERSION_HEX >= 0x030800b4
39369  0, /*tp_vectorcall_offset*/
39370  #endif
39371  0, /*tp_getattr*/
39372  0, /*tp_setattr*/
39373  #if PY_MAJOR_VERSION < 3
39374  0, /*tp_compare*/
39375  #endif
39376  #if PY_MAJOR_VERSION >= 3
39377  0, /*tp_as_async*/
39378  #endif
39379  __pyx_MemviewEnum___repr__, /*tp_repr*/
39380  0, /*tp_as_number*/
39381  0, /*tp_as_sequence*/
39382  0, /*tp_as_mapping*/
39383  0, /*tp_hash*/
39384  0, /*tp_call*/
39385  0, /*tp_str*/
39386  0, /*tp_getattro*/
39387  0, /*tp_setattro*/
39388  0, /*tp_as_buffer*/
39389  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
39390  0, /*tp_doc*/
39391  __pyx_tp_traverse_Enum, /*tp_traverse*/
39392  __pyx_tp_clear_Enum, /*tp_clear*/
39393  0, /*tp_richcompare*/
39394  0, /*tp_weaklistoffset*/
39395  0, /*tp_iter*/
39396  0, /*tp_iternext*/
39397  __pyx_methods_Enum, /*tp_methods*/
39398  0, /*tp_members*/
39399  0, /*tp_getset*/
39400  0, /*tp_base*/
39401  0, /*tp_dict*/
39402  0, /*tp_descr_get*/
39403  0, /*tp_descr_set*/
39404  0, /*tp_dictoffset*/
39405  __pyx_MemviewEnum___init__, /*tp_init*/
39406  0, /*tp_alloc*/
39407  __pyx_tp_new_Enum, /*tp_new*/
39408  0, /*tp_free*/
39409  0, /*tp_is_gc*/
39410  0, /*tp_bases*/
39411  0, /*tp_mro*/
39412  0, /*tp_cache*/
39413  0, /*tp_subclasses*/
39414  0, /*tp_weaklist*/
39415  0, /*tp_del*/
39416  0, /*tp_version_tag*/
39417  #if PY_VERSION_HEX >= 0x030400a1
39418  0, /*tp_finalize*/
39419  #endif
39420  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
39421  0, /*tp_vectorcall*/
39422  #endif
39423  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39424  0, /*tp_print*/
39425  #endif
39426  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
39427  0, /*tp_pypy_flags*/
39428  #endif
39429 };
39430 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
39431 
39432 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
39433  struct __pyx_memoryview_obj *p;
39434  PyObject *o;
39435  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
39436  o = (*t->tp_alloc)(t, 0);
39437  } else {
39438  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
39439  }
39440  if (unlikely(!o)) return 0;
39441  p = ((struct __pyx_memoryview_obj *)o);
39442  p->__pyx_vtab = __pyx_vtabptr_memoryview;
39443  p->obj = Py_None; Py_INCREF(Py_None);
39444  p->_size = Py_None; Py_INCREF(Py_None);
39445  p->_array_interface = Py_None; Py_INCREF(Py_None);
39446  p->view.obj = NULL;
39447  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
39448  return o;
39449  bad:
39450  Py_DECREF(o); o = 0;
39451  return NULL;
39452 }
39453 
39454 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
39455  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
39456  #if CYTHON_USE_TP_FINALIZE
39457  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
39458  if (PyObject_CallFinalizerFromDealloc(o)) return;
39459  }
39460  #endif
39461  PyObject_GC_UnTrack(o);
39462  {
39463  PyObject *etype, *eval, *etb;
39464  PyErr_Fetch(&etype, &eval, &etb);
39465  __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
39466  __pyx_memoryview___dealloc__(o);
39467  __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
39468  PyErr_Restore(etype, eval, etb);
39469  }
39470  Py_CLEAR(p->obj);
39471  Py_CLEAR(p->_size);
39472  Py_CLEAR(p->_array_interface);
39473  (*Py_TYPE(o)->tp_free)(o);
39474 }
39475 
39476 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
39477  int e;
39478  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
39479  if (p->obj) {
39480  e = (*v)(p->obj, a); if (e) return e;
39481  }
39482  if (p->_size) {
39483  e = (*v)(p->_size, a); if (e) return e;
39484  }
39485  if (p->_array_interface) {
39486  e = (*v)(p->_array_interface, a); if (e) return e;
39487  }
39488  if (p->view.obj) {
39489  e = (*v)(p->view.obj, a); if (e) return e;
39490  }
39491  return 0;
39492 }
39493 
39494 static int __pyx_tp_clear_memoryview(PyObject *o) {
39495  PyObject* tmp;
39496  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
39497  tmp = ((PyObject*)p->obj);
39498  p->obj = Py_None; Py_INCREF(Py_None);
39499  Py_XDECREF(tmp);
39500  tmp = ((PyObject*)p->_size);
39501  p->_size = Py_None; Py_INCREF(Py_None);
39502  Py_XDECREF(tmp);
39503  tmp = ((PyObject*)p->_array_interface);
39504  p->_array_interface = Py_None; Py_INCREF(Py_None);
39505  Py_XDECREF(tmp);
39506  Py_CLEAR(p->view.obj);
39507  return 0;
39508 }
39509 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
39510  PyObject *r;
39511  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
39512  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
39513  Py_DECREF(x);
39514  return r;
39515 }
39516 
39517 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
39518  if (v) {
39519  return __pyx_memoryview___setitem__(o, i, v);
39520  }
39521  else {
39522  PyErr_Format(PyExc_NotImplementedError,
39523  "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
39524  return -1;
39525  }
39526 }
39527 
39528 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
39529  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
39530 }
39531 
39532 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
39533  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
39534 }
39535 
39536 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
39537  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
39538 }
39539 
39540 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
39541  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
39542 }
39543 
39544 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
39545  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
39546 }
39547 
39548 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
39549  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
39550 }
39551 
39552 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
39553  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
39554 }
39555 
39556 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
39557  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
39558 }
39559 
39560 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
39561  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
39562 }
39563 
39564 static PyMethodDef __pyx_methods_memoryview[] = {
39565  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
39566  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
39567  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
39568  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
39569  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
39570  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
39571  {0, 0, 0, 0}
39572 };
39573 
39574 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
39575  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
39576  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
39577  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
39578  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
39579  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
39580  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
39581  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
39582  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
39583  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
39584  {0, 0, 0, 0, 0}
39585 };
39586 
39587 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
39588  __pyx_memoryview___len__, /*sq_length*/
39589  0, /*sq_concat*/
39590  0, /*sq_repeat*/
39591  __pyx_sq_item_memoryview, /*sq_item*/
39592  0, /*sq_slice*/
39593  0, /*sq_ass_item*/
39594  0, /*sq_ass_slice*/
39595  0, /*sq_contains*/
39596  0, /*sq_inplace_concat*/
39597  0, /*sq_inplace_repeat*/
39598 };
39599 
39600 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
39601  __pyx_memoryview___len__, /*mp_length*/
39602  __pyx_memoryview___getitem__, /*mp_subscript*/
39603  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
39604 };
39605 
39606 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
39607  #if PY_MAJOR_VERSION < 3
39608  0, /*bf_getreadbuffer*/
39609  #endif
39610  #if PY_MAJOR_VERSION < 3
39611  0, /*bf_getwritebuffer*/
39612  #endif
39613  #if PY_MAJOR_VERSION < 3
39614  0, /*bf_getsegcount*/
39615  #endif
39616  #if PY_MAJOR_VERSION < 3
39617  0, /*bf_getcharbuffer*/
39618  #endif
39619  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
39620  0, /*bf_releasebuffer*/
39621 };
39622 
39623 static PyTypeObject __pyx_type___pyx_memoryview = {
39624  PyVarObject_HEAD_INIT(0, 0)
39625  "mprans.MeshSmoothing.memoryview", /*tp_name*/
39626  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
39627  0, /*tp_itemsize*/
39628  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
39629  #if PY_VERSION_HEX < 0x030800b4
39630  0, /*tp_print*/
39631  #endif
39632  #if PY_VERSION_HEX >= 0x030800b4
39633  0, /*tp_vectorcall_offset*/
39634  #endif
39635  0, /*tp_getattr*/
39636  0, /*tp_setattr*/
39637  #if PY_MAJOR_VERSION < 3
39638  0, /*tp_compare*/
39639  #endif
39640  #if PY_MAJOR_VERSION >= 3
39641  0, /*tp_as_async*/
39642  #endif
39643  __pyx_memoryview___repr__, /*tp_repr*/
39644  0, /*tp_as_number*/
39645  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
39646  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
39647  0, /*tp_hash*/
39648  0, /*tp_call*/
39649  __pyx_memoryview___str__, /*tp_str*/
39650  0, /*tp_getattro*/
39651  0, /*tp_setattro*/
39652  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
39653  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
39654  0, /*tp_doc*/
39655  __pyx_tp_traverse_memoryview, /*tp_traverse*/
39656  __pyx_tp_clear_memoryview, /*tp_clear*/
39657  0, /*tp_richcompare*/
39658  0, /*tp_weaklistoffset*/
39659  0, /*tp_iter*/
39660  0, /*tp_iternext*/
39661  __pyx_methods_memoryview, /*tp_methods*/
39662  0, /*tp_members*/
39663  __pyx_getsets_memoryview, /*tp_getset*/
39664  0, /*tp_base*/
39665  0, /*tp_dict*/
39666  0, /*tp_descr_get*/
39667  0, /*tp_descr_set*/
39668  0, /*tp_dictoffset*/
39669  0, /*tp_init*/
39670  0, /*tp_alloc*/
39671  __pyx_tp_new_memoryview, /*tp_new*/
39672  0, /*tp_free*/
39673  0, /*tp_is_gc*/
39674  0, /*tp_bases*/
39675  0, /*tp_mro*/
39676  0, /*tp_cache*/
39677  0, /*tp_subclasses*/
39678  0, /*tp_weaklist*/
39679  0, /*tp_del*/
39680  0, /*tp_version_tag*/
39681  #if PY_VERSION_HEX >= 0x030400a1
39682  0, /*tp_finalize*/
39683  #endif
39684  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
39685  0, /*tp_vectorcall*/
39686  #endif
39687  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39688  0, /*tp_print*/
39689  #endif
39690  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
39691  0, /*tp_pypy_flags*/
39692  #endif
39693 };
39694 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
39695 
39696 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
39697  struct __pyx_memoryviewslice_obj *p;
39698  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
39699  if (unlikely(!o)) return 0;
39700  p = ((struct __pyx_memoryviewslice_obj *)o);
39701  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
39702  p->from_object = Py_None; Py_INCREF(Py_None);
39703  p->from_slice.memview = NULL;
39704  return o;
39705 }
39706 
39707 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
39708  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
39709  #if CYTHON_USE_TP_FINALIZE
39710  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
39711  if (PyObject_CallFinalizerFromDealloc(o)) return;
39712  }
39713  #endif
39714  PyObject_GC_UnTrack(o);
39715  {
39716  PyObject *etype, *eval, *etb;
39717  PyErr_Fetch(&etype, &eval, &etb);
39718  __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
39719  __pyx_memoryviewslice___dealloc__(o);
39720  __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
39721  PyErr_Restore(etype, eval, etb);
39722  }
39723  Py_CLEAR(p->from_object);
39724  PyObject_GC_Track(o);
39725  __pyx_tp_dealloc_memoryview(o);
39726 }
39727 
39728 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
39729  int e;
39730  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
39731  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
39732  if (p->from_object) {
39733  e = (*v)(p->from_object, a); if (e) return e;
39734  }
39735  return 0;
39736 }
39737 
39738 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
39739  PyObject* tmp;
39740  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
39741  __pyx_tp_clear_memoryview(o);
39742  tmp = ((PyObject*)p->from_object);
39743  p->from_object = Py_None; Py_INCREF(Py_None);
39744  Py_XDECREF(tmp);
39745  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
39746  return 0;
39747 }
39748 
39749 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
39750  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
39751 }
39752 
39753 static PyMethodDef __pyx_methods__memoryviewslice[] = {
39754  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
39755  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
39756  {0, 0, 0, 0}
39757 };
39758 
39759 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
39760  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
39761  {0, 0, 0, 0, 0}
39762 };
39763 
39764 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
39765  PyVarObject_HEAD_INIT(0, 0)
39766  "mprans.MeshSmoothing._memoryviewslice", /*tp_name*/
39767  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
39768  0, /*tp_itemsize*/
39769  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
39770  #if PY_VERSION_HEX < 0x030800b4
39771  0, /*tp_print*/
39772  #endif
39773  #if PY_VERSION_HEX >= 0x030800b4
39774  0, /*tp_vectorcall_offset*/
39775  #endif
39776  0, /*tp_getattr*/
39777  0, /*tp_setattr*/
39778  #if PY_MAJOR_VERSION < 3
39779  0, /*tp_compare*/
39780  #endif
39781  #if PY_MAJOR_VERSION >= 3
39782  0, /*tp_as_async*/
39783  #endif
39784  #if CYTHON_COMPILING_IN_PYPY
39785  __pyx_memoryview___repr__, /*tp_repr*/
39786  #else
39787  0, /*tp_repr*/
39788  #endif
39789  0, /*tp_as_number*/
39790  0, /*tp_as_sequence*/
39791  0, /*tp_as_mapping*/
39792  0, /*tp_hash*/
39793  0, /*tp_call*/
39794  #if CYTHON_COMPILING_IN_PYPY
39795  __pyx_memoryview___str__, /*tp_str*/
39796  #else
39797  0, /*tp_str*/
39798  #endif
39799  0, /*tp_getattro*/
39800  0, /*tp_setattro*/
39801  0, /*tp_as_buffer*/
39802  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
39803  "Internal class for passing memoryview slices to Python", /*tp_doc*/
39804  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
39805  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
39806  0, /*tp_richcompare*/
39807  0, /*tp_weaklistoffset*/
39808  0, /*tp_iter*/
39809  0, /*tp_iternext*/
39810  __pyx_methods__memoryviewslice, /*tp_methods*/
39811  0, /*tp_members*/
39812  __pyx_getsets__memoryviewslice, /*tp_getset*/
39813  0, /*tp_base*/
39814  0, /*tp_dict*/
39815  0, /*tp_descr_get*/
39816  0, /*tp_descr_set*/
39817  0, /*tp_dictoffset*/
39818  0, /*tp_init*/
39819  0, /*tp_alloc*/
39820  __pyx_tp_new__memoryviewslice, /*tp_new*/
39821  0, /*tp_free*/
39822  0, /*tp_is_gc*/
39823  0, /*tp_bases*/
39824  0, /*tp_mro*/
39825  0, /*tp_cache*/
39826  0, /*tp_subclasses*/
39827  0, /*tp_weaklist*/
39828  0, /*tp_del*/
39829  0, /*tp_version_tag*/
39830  #if PY_VERSION_HEX >= 0x030400a1
39831  0, /*tp_finalize*/
39832  #endif
39833  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
39834  0, /*tp_vectorcall*/
39835  #endif
39836  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
39837  0, /*tp_print*/
39838  #endif
39839  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
39840  0, /*tp_pypy_flags*/
39841  #endif
39842 };
39843 
39844 static PyMethodDef __pyx_methods[] = {
39845  {0, 0, 0, 0}
39846 };
39847 
39848 #if PY_MAJOR_VERSION >= 3
39849 #if CYTHON_PEP489_MULTI_PHASE_INIT
39850 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
39851 static int __pyx_pymod_exec_MeshSmoothing(PyObject* module); /*proto*/
39852 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
39853  {Py_mod_create, (void*)__pyx_pymod_create},
39854  {Py_mod_exec, (void*)__pyx_pymod_exec_MeshSmoothing},
39855  {0, NULL}
39856 };
39857 #endif
39858 
39859 static struct PyModuleDef __pyx_moduledef = {
39860  PyModuleDef_HEAD_INIT,
39861  "MeshSmoothing",
39862  0, /* m_doc */
39863  #if CYTHON_PEP489_MULTI_PHASE_INIT
39864  0, /* m_size */
39865  #else
39866  -1, /* m_size */
39867  #endif
39868  __pyx_methods /* m_methods */,
39869  #if CYTHON_PEP489_MULTI_PHASE_INIT
39870  __pyx_moduledef_slots, /* m_slots */
39871  #else
39872  NULL, /* m_reload */
39873  #endif
39874  NULL, /* m_traverse */
39875  NULL, /* m_clear */
39876  NULL /* m_free */
39877 };
39878 #endif
39879 #ifndef CYTHON_SMALL_CODE
39880 #if defined(__clang__)
39881  #define CYTHON_SMALL_CODE
39882 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
39883  #define CYTHON_SMALL_CODE __attribute__((cold))
39884 #else
39885  #define CYTHON_SMALL_CODE
39886 #endif
39887 #endif
39888 
39889 static __Pyx_StringTabEntry __pyx_string_tab[] = {
39890  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
39891  {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
39892  {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
39893  {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
39894  {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
39895  {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
39896  {&__pyx_n_s_Comm, __pyx_k_Comm, sizeof(__pyx_k_Comm), 0, 0, 1, 1},
39897  {&__pyx_n_s_Commit, __pyx_k_Commit, sizeof(__pyx_k_Commit), 0, 0, 1, 1},
39898  {&__pyx_n_s_Create_contiguous, __pyx_k_Create_contiguous, sizeof(__pyx_k_Create_contiguous), 0, 0, 1, 1},
39899  {&__pyx_n_s_DOUBLE, __pyx_k_DOUBLE, sizeof(__pyx_k_DOUBLE), 0, 0, 1, 1},
39900  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
39901  {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
39902  {&__pyx_n_s_Gatherv, __pyx_k_Gatherv, sizeof(__pyx_k_Gatherv), 0, 0, 1, 1},
39903  {&__pyx_n_s_IMRElementsArray, __pyx_k_IMRElementsArray, sizeof(__pyx_k_IMRElementsArray), 0, 0, 1, 1},
39904  {&__pyx_n_s_IMRNodesArray, __pyx_k_IMRNodesArray, sizeof(__pyx_k_IMRNodesArray), 0, 0, 1, 1},
39905  {&__pyx_n_s_INT, __pyx_k_INT, sizeof(__pyx_k_INT), 0, 0, 1, 1},
39906  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
39907  {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
39908  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
39909  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
39910  {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
39911  {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
39912  {&__pyx_n_s_J_array, __pyx_k_J_array, sizeof(__pyx_k_J_array), 0, 0, 1, 1},
39913  {&__pyx_n_s_MPI, __pyx_k_MPI, sizeof(__pyx_k_MPI), 0, 0, 1, 1},
39914  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
39915  {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
39916  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
39917  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
39918  {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
39919  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
39920  {&__pyx_n_s_SUM, __pyx_k_SUM, sizeof(__pyx_k_SUM), 0, 0, 1, 1},
39921  {&__pyx_kp_b_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 0, 0},
39922  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
39923  {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
39924  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
39925  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
39926  {&__pyx_kp_b__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 0, 0},
39927  {&__pyx_kp_b__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 0, 0, 0},
39928  {&__pyx_kp_b__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 0, 0},
39929  {&__pyx_kp_b__30, __pyx_k__30, sizeof(__pyx_k__30), 0, 0, 0, 0},
39930  {&__pyx_kp_u__31, __pyx_k__31, sizeof(__pyx_k__31), 0, 1, 0, 0},
39931  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
39932  {&__pyx_n_s_allreduce, __pyx_k_allreduce, sizeof(__pyx_k_allreduce), 0, 0, 1, 1},
39933  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
39934  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
39935  {&__pyx_n_s_apply_directly, __pyx_k_apply_directly, sizeof(__pyx_k_apply_directly), 0, 0, 1, 1},
39936  {&__pyx_n_s_arg_2doArray, __pyx_k_arg_2doArray, sizeof(__pyx_k_arg_2doArray), 0, 0, 1, 1},
39937  {&__pyx_n_s_arg_2rank, __pyx_k_arg_2rank, sizeof(__pyx_k_arg_2rank), 0, 0, 1, 1},
39938  {&__pyx_n_s_arg_2rank_values, __pyx_k_arg_2rank_values, sizeof(__pyx_k_arg_2rank_values), 0, 0, 1, 1},
39939  {&__pyx_n_s_arg_shape, __pyx_k_arg_shape, sizeof(__pyx_k_arg_shape), 0, 0, 1, 1},
39940  {&__pyx_n_s_arg_shape_copy, __pyx_k_arg_shape_copy, sizeof(__pyx_k_arg_shape_copy), 0, 0, 1, 1},
39941  {&__pyx_n_s_arg_shape_len, __pyx_k_arg_shape_len, sizeof(__pyx_k_arg_shape_len), 0, 0, 1, 1},
39942  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
39943  {&__pyx_n_s_args_2, __pyx_k_args_2, sizeof(__pyx_k_args_2), 0, 0, 1, 1},
39944  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
39945  {&__pyx_n_s_array_size, __pyx_k_array_size, sizeof(__pyx_k_array_size), 0, 0, 1, 1},
39946  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
39947  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
39948  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
39949  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
39950  {&__pyx_n_s_checkOwnedVariable, __pyx_k_checkOwnedVariable, sizeof(__pyx_k_checkOwnedVariable), 0, 0, 1, 1},
39951  {&__pyx_n_s_checkedElements, __pyx_k_checkedElements, sizeof(__pyx_k_checkedElements), 0, 0, 1, 1},
39952  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
39953  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
39954  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
39955  {&__pyx_n_s_comm, __pyx_k_comm, sizeof(__pyx_k_comm), 0, 0, 1, 1},
39956  {&__pyx_n_s_comm_size, __pyx_k_comm_size, sizeof(__pyx_k_comm_size), 0, 0, 1, 1},
39957  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
39958  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
39959  {&__pyx_n_s_coords, __pyx_k_coords, sizeof(__pyx_k_coords), 0, 0, 1, 1},
39960  {&__pyx_kp_s_could_not_find_element_element_e, __pyx_k_could_not_find_element_element_e, sizeof(__pyx_k_could_not_find_element_element_e), 0, 0, 1, 0},
39961  {&__pyx_n_s_counts_in, __pyx_k_counts_in, sizeof(__pyx_k_counts_in), 0, 0, 1, 1},
39962  {&__pyx_n_s_counts_out, __pyx_k_counts_out, sizeof(__pyx_k_counts_out), 0, 0, 1, 1},
39963  {&__pyx_n_s_datatype, __pyx_k_datatype, sizeof(__pyx_k_datatype), 0, 0, 1, 1},
39964  {&__pyx_n_s_detJ_array, __pyx_k_detJ_array, sizeof(__pyx_k_detJ_array), 0, 0, 1, 1},
39965  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
39966  {&__pyx_n_s_dilation, __pyx_k_dilation, sizeof(__pyx_k_dilation), 0, 0, 1, 1},
39967  {&__pyx_n_s_disp, __pyx_k_disp, sizeof(__pyx_k_disp), 0, 0, 1, 1},
39968  {&__pyx_n_s_displacements_in, __pyx_k_displacements_in, sizeof(__pyx_k_displacements_in), 0, 0, 1, 1},
39969  {&__pyx_n_s_displacements_out, __pyx_k_displacements_out, sizeof(__pyx_k_displacements_out), 0, 0, 1, 1},
39970  {&__pyx_n_s_distortion, __pyx_k_distortion, sizeof(__pyx_k_distortion), 0, 0, 1, 1},
39971  {&__pyx_n_s_dot, __pyx_k_dot, sizeof(__pyx_k_dot), 0, 0, 1, 1},
39972  {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
39973  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
39974  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
39975  {&__pyx_n_s_eN, __pyx_k_eN, sizeof(__pyx_k_eN), 0, 0, 1, 1},
39976  {&__pyx_n_s_eOffset, __pyx_k_eOffset, sizeof(__pyx_k_eOffset), 0, 0, 1, 1},
39977  {&__pyx_n_s_el_average, __pyx_k_el_average, sizeof(__pyx_k_el_average), 0, 0, 1, 1},
39978  {&__pyx_n_s_elementBarycentersArray, __pyx_k_elementBarycentersArray, sizeof(__pyx_k_elementBarycentersArray), 0, 0, 1, 1},
39979  {&__pyx_n_s_elementBarycentersArray_2, __pyx_k_elementBarycentersArray_2, sizeof(__pyx_k_elementBarycentersArray_2), 0, 0, 1, 1},
39980  {&__pyx_n_s_elementBoundariesArray, __pyx_k_elementBoundariesArray, sizeof(__pyx_k_elementBoundariesArray), 0, 0, 1, 1},
39981  {&__pyx_n_s_elementBoundaryBarycentersArray, __pyx_k_elementBoundaryBarycentersArray, sizeof(__pyx_k_elementBoundaryBarycentersArray), 0, 0, 1, 1},
39982  {&__pyx_n_s_elementBoundaryElementsArray, __pyx_k_elementBoundaryElementsArray, sizeof(__pyx_k_elementBoundaryElementsArray), 0, 0, 1, 1},
39983  {&__pyx_n_s_elementBoundaryNodesArray, __pyx_k_elementBoundaryNodesArray, sizeof(__pyx_k_elementBoundaryNodesArray), 0, 0, 1, 1},
39984  {&__pyx_n_s_elementBoundaryNormalsArray, __pyx_k_elementBoundaryNormalsArray, sizeof(__pyx_k_elementBoundaryNormalsArray), 0, 0, 1, 1},
39985  {&__pyx_n_s_elementBoundaryNormalsArray_2, __pyx_k_elementBoundaryNormalsArray_2, sizeof(__pyx_k_elementBoundaryNormalsArray_2), 0, 0, 1, 1},
39986  {&__pyx_n_s_elementDilationArray, __pyx_k_elementDilationArray, sizeof(__pyx_k_elementDilationArray), 0, 0, 1, 1},
39987  {&__pyx_n_s_elementDistortionArray, __pyx_k_elementDistortionArray, sizeof(__pyx_k_elementDistortionArray), 0, 0, 1, 1},
39988  {&__pyx_n_s_elementMaps, __pyx_k_elementMaps, sizeof(__pyx_k_elementMaps), 0, 0, 1, 1},
39989  {&__pyx_n_s_elementNeighborsArray, __pyx_k_elementNeighborsArray, sizeof(__pyx_k_elementNeighborsArray), 0, 0, 1, 1},
39990  {&__pyx_n_s_elementNodesArray, __pyx_k_elementNodesArray, sizeof(__pyx_k_elementNodesArray), 0, 0, 1, 1},
39991  {&__pyx_n_s_elementVolumeArray, __pyx_k_elementVolumeArray, sizeof(__pyx_k_elementVolumeArray), 0, 0, 1, 1},
39992  {&__pyx_n_s_elementVolumeTargetArray, __pyx_k_elementVolumeTargetArray, sizeof(__pyx_k_elementVolumeTargetArray), 0, 0, 1, 1},
39993  {&__pyx_n_s_elementVolumesArray, __pyx_k_elementVolumesArray, sizeof(__pyx_k_elementVolumesArray), 0, 0, 1, 1},
39994  {&__pyx_n_s_elementVolumesArray_2, __pyx_k_elementVolumesArray_2, sizeof(__pyx_k_elementVolumesArray_2), 0, 0, 1, 1},
39995  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
39996  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
39997  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
39998  {&__pyx_kp_s_error_looking_for_dir, __pyx_k_error_looking_for_dir, sizeof(__pyx_k_error_looking_for_dir), 0, 0, 1, 0},
39999  {&__pyx_n_s_exteriorElementBoundariesBoolArr, __pyx_k_exteriorElementBoundariesBoolArr, sizeof(__pyx_k_exteriorElementBoundariesBoolArr), 0, 0, 1, 1},
40000  {&__pyx_n_s_femSpace, __pyx_k_femSpace, sizeof(__pyx_k_femSpace), 0, 0, 1, 1},
40001  {&__pyx_n_s_fixedNodesBoolArray, __pyx_k_fixedNodesBoolArray, sizeof(__pyx_k_fixedNodesBoolArray), 0, 0, 1, 1},
40002  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
40003  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
40004  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
40005  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
40006  {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1},
40007  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
40008  {&__pyx_n_s_getCornerNodesTriangle, __pyx_k_getCornerNodesTriangle, sizeof(__pyx_k_getCornerNodesTriangle), 0, 0, 1, 1},
40009  {&__pyx_n_s_getDilationElements, __pyx_k_getDilationElements, sizeof(__pyx_k_getDilationElements), 0, 0, 1, 1},
40010  {&__pyx_n_s_getDistortionElements, __pyx_k_getDistortionElements, sizeof(__pyx_k_getDistortionElements), 0, 0, 1, 1},
40011  {&__pyx_n_s_getElementBoundaryNormalsTetra, __pyx_k_getElementBoundaryNormalsTetra, sizeof(__pyx_k_getElementBoundaryNormalsTetra), 0, 0, 1, 1},
40012  {&__pyx_n_s_getElementBoundaryNormalsTriangl, __pyx_k_getElementBoundaryNormalsTriangl, sizeof(__pyx_k_getElementBoundaryNormalsTriangl), 0, 0, 1, 1},
40013  {&__pyx_n_s_getElementVolumeTriangle, __pyx_k_getElementVolumeTriangle, sizeof(__pyx_k_getElementVolumeTriangle), 0, 0, 1, 1},
40014  {&__pyx_n_s_getInverseMeanRatioSingleTriangl, __pyx_k_getInverseMeanRatioSingleTriangl, sizeof(__pyx_k_getInverseMeanRatioSingleTriangl), 0, 0, 1, 1},
40015  {&__pyx_n_s_getInverseMeanRatioTriangleEleme, __pyx_k_getInverseMeanRatioTriangleEleme, sizeof(__pyx_k_getInverseMeanRatioTriangleEleme), 0, 0, 1, 1},
40016  {&__pyx_n_s_getInverseMeanRatioTriangleNodes, __pyx_k_getInverseMeanRatioTriangleNodes, sizeof(__pyx_k_getInverseMeanRatioTriangleNodes), 0, 0, 1, 1},
40017  {&__pyx_n_s_getInverseValue, __pyx_k_getInverseValue, sizeof(__pyx_k_getInverseValue), 0, 0, 1, 1},
40018  {&__pyx_n_s_getLocalElement, __pyx_k_getLocalElement, sizeof(__pyx_k_getLocalElement), 0, 0, 1, 1},
40019  {&__pyx_n_s_getLocalNearestElement, __pyx_k_getLocalNearestElement, sizeof(__pyx_k_getLocalNearestElement), 0, 0, 1, 1},
40020  {&__pyx_n_s_getLocalNearestElementAroundNode, __pyx_k_getLocalNearestElementAroundNode, sizeof(__pyx_k_getLocalNearestElementAroundNode), 0, 0, 1, 1},
40021  {&__pyx_n_s_getLocalNearestElementIntersecti, __pyx_k_getLocalNearestElementIntersecti, sizeof(__pyx_k_getLocalNearestElementIntersecti), 0, 0, 1, 1},
40022  {&__pyx_n_s_getLocalNearestNode, __pyx_k_getLocalNearestNode, sizeof(__pyx_k_getLocalNearestNode), 0, 0, 1, 1},
40023  {&__pyx_n_s_getNonOwnedNodeValues, __pyx_k_getNonOwnedNodeValues, sizeof(__pyx_k_getNonOwnedNodeValues), 0, 0, 1, 1},
40024  {&__pyx_n_s_getNonOwnedNodeValues_locals_gen, __pyx_k_getNonOwnedNodeValues_locals_gen, sizeof(__pyx_k_getNonOwnedNodeValues_locals_gen), 0, 0, 1, 1},
40025  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
40026  {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
40027  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
40028  {&__pyx_n_s_iN, __pyx_k_iN, sizeof(__pyx_k_iN), 0, 0, 1, 1},
40029  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
40030  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
40031  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
40032  {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
40033  {&__pyx_n_s_inv, __pyx_k_inv, sizeof(__pyx_k_inv), 0, 0, 1, 1},
40034  {&__pyx_n_s_ir, __pyx_k_ir, sizeof(__pyx_k_ir), 0, 0, 1, 1},
40035  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
40036  {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
40037  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
40038  {&__pyx_n_s_linalg, __pyx_k_linalg, sizeof(__pyx_k_linalg), 0, 0, 1, 1},
40039  {&__pyx_n_s_logEvent, __pyx_k_logEvent, sizeof(__pyx_k_logEvent), 0, 0, 1, 1},
40040  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
40041  {&__pyx_n_s_maxit, __pyx_k_maxit, sizeof(__pyx_k_maxit), 0, 0, 1, 1},
40042  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
40043  {&__pyx_n_s_mesh, __pyx_k_mesh, sizeof(__pyx_k_mesh), 0, 0, 1, 1},
40044  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
40045  {&__pyx_n_s_mpi4py, __pyx_k_mpi4py, sizeof(__pyx_k_mpi4py), 0, 0, 1, 1},
40046  {&__pyx_n_s_mprans_MeshSmoothing, __pyx_k_mprans_MeshSmoothing, sizeof(__pyx_k_mprans_MeshSmoothing), 0, 0, 1, 1},
40047  {&__pyx_n_s_my_rank, __pyx_k_my_rank, sizeof(__pyx_k_my_rank), 0, 0, 1, 1},
40048  {&__pyx_n_s_my_size, __pyx_k_my_size, sizeof(__pyx_k_my_size), 0, 0, 1, 1},
40049  {&__pyx_n_s_nA, __pyx_k_nA, sizeof(__pyx_k_nA), 0, 0, 1, 1},
40050  {&__pyx_n_s_nB, __pyx_k_nB, sizeof(__pyx_k_nB), 0, 0, 1, 1},
40051  {&__pyx_n_s_nC, __pyx_k_nC, sizeof(__pyx_k_nC), 0, 0, 1, 1},
40052  {&__pyx_n_s_nElements, __pyx_k_nElements, sizeof(__pyx_k_nElements), 0, 0, 1, 1},
40053  {&__pyx_n_s_nNodes, __pyx_k_nNodes, sizeof(__pyx_k_nNodes), 0, 0, 1, 1},
40054  {&__pyx_n_s_nNodes_global, __pyx_k_nNodes_global, sizeof(__pyx_k_nNodes_global), 0, 0, 1, 1},
40055  {&__pyx_n_s_nNodes_owned, __pyx_k_nNodes_owned, sizeof(__pyx_k_nNodes_owned), 0, 0, 1, 1},
40056  {&__pyx_n_s_nVariables_owned, __pyx_k_nVariables_owned, sizeof(__pyx_k_nVariables_owned), 0, 0, 1, 1},
40057  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
40058  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
40059  {&__pyx_n_s_nd, __pyx_k_nd, sizeof(__pyx_k_nd), 0, 0, 1, 1},
40060  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
40061  {&__pyx_n_s_nearest_eN, __pyx_k_nearest_eN, sizeof(__pyx_k_nearest_eN), 0, 0, 1, 1},
40062  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
40063  {&__pyx_n_s_new_rank, __pyx_k_new_rank, sizeof(__pyx_k_new_rank), 0, 0, 1, 1},
40064  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
40065  {&__pyx_n_s_node, __pyx_k_node, sizeof(__pyx_k_node), 0, 0, 1, 1},
40066  {&__pyx_n_s_node0, __pyx_k_node0, sizeof(__pyx_k_node0), 0, 0, 1, 1},
40067  {&__pyx_n_s_nodeArray, __pyx_k_nodeArray, sizeof(__pyx_k_nodeArray), 0, 0, 1, 1},
40068  {&__pyx_n_s_nodeArray_2, __pyx_k_nodeArray_2, sizeof(__pyx_k_nodeArray_2), 0, 0, 1, 1},
40069  {&__pyx_n_s_nodeElementOffsets, __pyx_k_nodeElementOffsets, sizeof(__pyx_k_nodeElementOffsets), 0, 0, 1, 1},
40070  {&__pyx_n_s_nodeElementsArray, __pyx_k_nodeElementsArray, sizeof(__pyx_k_nodeElementsArray), 0, 0, 1, 1},
40071  {&__pyx_n_s_nodeMaterialTypes, __pyx_k_nodeMaterialTypes, sizeof(__pyx_k_nodeMaterialTypes), 0, 0, 1, 1},
40072  {&__pyx_n_s_nodeNumbering_subdomain2global, __pyx_k_nodeNumbering_subdomain2global, sizeof(__pyx_k_nodeNumbering_subdomain2global), 0, 0, 1, 1},
40073  {&__pyx_n_s_nodeOffsets_subdomain_owned, __pyx_k_nodeOffsets_subdomain_owned, sizeof(__pyx_k_nodeOffsets_subdomain_owned), 0, 0, 1, 1},
40074  {&__pyx_n_s_nodeStarArray, __pyx_k_nodeStarArray, sizeof(__pyx_k_nodeStarArray), 0, 0, 1, 1},
40075  {&__pyx_n_s_nodeStarOffsets, __pyx_k_nodeStarOffsets, sizeof(__pyx_k_nodeStarOffsets), 0, 0, 1, 1},
40076  {&__pyx_n_s_node_new_rank, __pyx_k_node_new_rank, sizeof(__pyx_k_node_new_rank), 0, 0, 1, 1},
40077  {&__pyx_n_s_nodes_2doArray, __pyx_k_nodes_2doArray, sizeof(__pyx_k_nodes_2doArray), 0, 0, 1, 1},
40078  {&__pyx_n_s_nodes_2rank, __pyx_k_nodes_2rank, sizeof(__pyx_k_nodes_2rank), 0, 0, 1, 1},
40079  {&__pyx_n_s_nodes_2rank_len, __pyx_k_nodes_2rank_len, sizeof(__pyx_k_nodes_2rank_len), 0, 0, 1, 1},
40080  {&__pyx_n_s_nodes_2rank_values, __pyx_k_nodes_2rank_values, sizeof(__pyx_k_nodes_2rank_values), 0, 0, 1, 1},
40081  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
40082  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
40083  {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
40084  {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
40085  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
40086  {&__pyx_n_s_onElement, __pyx_k_onElement, sizeof(__pyx_k_onElement), 0, 0, 1, 1},
40087  {&__pyx_n_s_op, __pyx_k_op, sizeof(__pyx_k_op), 0, 0, 1, 1},
40088  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
40089  {&__pyx_n_s_patchBoundaryNodes, __pyx_k_patchBoundaryNodes, sizeof(__pyx_k_patchBoundaryNodes), 0, 0, 1, 1},
40090  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
40091  {&__pyx_n_s_proteus, __pyx_k_proteus, sizeof(__pyx_k_proteus), 0, 0, 1, 1},
40092  {&__pyx_n_s_proteus_Profiling, __pyx_k_proteus_Profiling, sizeof(__pyx_k_proteus_Profiling), 0, 0, 1, 1},
40093  {&__pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_k_proteus_mprans_MeshSmoothing_pyx, sizeof(__pyx_k_proteus_mprans_MeshSmoothing_pyx), 0, 0, 1, 0},
40094  {&__pyx_n_s_pyScalarRecoveryAtNodes, __pyx_k_pyScalarRecoveryAtNodes, sizeof(__pyx_k_pyScalarRecoveryAtNodes), 0, 0, 1, 1},
40095  {&__pyx_n_s_pyScalarRecoveryAtNodesWeighted, __pyx_k_pyScalarRecoveryAtNodesWeighted, sizeof(__pyx_k_pyScalarRecoveryAtNodesWeighted), 0, 0, 1, 1},
40096  {&__pyx_n_s_pyVectorRecoveryAtNodes, __pyx_k_pyVectorRecoveryAtNodes, sizeof(__pyx_k_pyVectorRecoveryAtNodes), 0, 0, 1, 1},
40097  {&__pyx_n_s_pyVectorRecoveryAtNodesWeighted, __pyx_k_pyVectorRecoveryAtNodesWeighted, sizeof(__pyx_k_pyVectorRecoveryAtNodesWeighted), 0, 0, 1, 1},
40098  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
40099  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
40100  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
40101  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
40102  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
40103  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
40104  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
40105  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
40106  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
40107  {&__pyx_n_s_rank, __pyx_k_rank, sizeof(__pyx_k_rank), 0, 0, 1, 1},
40108  {&__pyx_n_s_rank_recv, __pyx_k_rank_recv, sizeof(__pyx_k_rank_recv), 0, 0, 1, 1},
40109  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
40110  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
40111  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
40112  {&__pyx_n_s_referenceElement, __pyx_k_referenceElement, sizeof(__pyx_k_referenceElement), 0, 0, 1, 1},
40113  {&__pyx_n_s_result, __pyx_k_result, sizeof(__pyx_k_result), 0, 0, 1, 1},
40114  {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
40115  {&__pyx_kp_u_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 1, 0, 0},
40116  {&__pyx_n_s_scalars, __pyx_k_scalars, sizeof(__pyx_k_scalars), 0, 0, 1, 1},
40117  {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1},
40118  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
40119  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
40120  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
40121  {&__pyx_n_s_shape_factor, __pyx_k_shape_factor, sizeof(__pyx_k_shape_factor), 0, 0, 1, 1},
40122  {&__pyx_n_s_simultaneous, __pyx_k_simultaneous, sizeof(__pyx_k_simultaneous), 0, 0, 1, 1},
40123  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
40124  {&__pyx_n_s_smoothBoundaries, __pyx_k_smoothBoundaries, sizeof(__pyx_k_smoothBoundaries), 0, 0, 1, 1},
40125  {&__pyx_n_s_smoothNodesCentroid, __pyx_k_smoothNodesCentroid, sizeof(__pyx_k_smoothNodesCentroid), 0, 0, 1, 1},
40126  {&__pyx_n_s_smoothNodesLaplace, __pyx_k_smoothNodesLaplace, sizeof(__pyx_k_smoothNodesLaplace), 0, 0, 1, 1},
40127  {&__pyx_n_s_smoothNodesQuality, __pyx_k_smoothNodesQuality, sizeof(__pyx_k_smoothNodesQuality), 0, 0, 1, 1},
40128  {&__pyx_kp_s_smoothNodesQuality_is_work_in_pr, __pyx_k_smoothNodesQuality_is_work_in_pr, sizeof(__pyx_k_smoothNodesQuality_is_work_in_pr), 0, 0, 1, 0},
40129  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
40130  {&__pyx_n_s_starting_coords, __pyx_k_starting_coords, sizeof(__pyx_k_starting_coords), 0, 0, 1, 1},
40131  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
40132  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
40133  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
40134  {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
40135  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
40136  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
40137  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
40138  {&__pyx_n_s_sumtot, __pyx_k_sumtot, sizeof(__pyx_k_sumtot), 0, 0, 1, 1},
40139  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
40140  {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1},
40141  {&__pyx_n_s_tompi4py, __pyx_k_tompi4py, sizeof(__pyx_k_tompi4py), 0, 0, 1, 1},
40142  {&__pyx_n_s_transpose, __pyx_k_transpose, sizeof(__pyx_k_transpose), 0, 0, 1, 1},
40143  {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
40144  {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
40145  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
40146  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
40147  {&__pyx_n_s_updateDilationElements, __pyx_k_updateDilationElements, sizeof(__pyx_k_updateDilationElements), 0, 0, 1, 1},
40148  {&__pyx_n_s_updateDistortionElements, __pyx_k_updateDistortionElements, sizeof(__pyx_k_updateDistortionElements), 0, 0, 1, 1},
40149  {&__pyx_n_s_updateElementBarycenters, __pyx_k_updateElementBarycenters, sizeof(__pyx_k_updateElementBarycenters), 0, 0, 1, 1},
40150  {&__pyx_n_s_updateElementBoundaryNormalsTetr, __pyx_k_updateElementBoundaryNormalsTetr, sizeof(__pyx_k_updateElementBoundaryNormalsTetr), 0, 0, 1, 1},
40151  {&__pyx_n_s_updateElementBoundaryNormalsTria, __pyx_k_updateElementBoundaryNormalsTria, sizeof(__pyx_k_updateElementBoundaryNormalsTria), 0, 0, 1, 1},
40152  {&__pyx_n_s_updateElementVolumesTetra, __pyx_k_updateElementVolumesTetra, sizeof(__pyx_k_updateElementVolumesTetra), 0, 0, 1, 1},
40153  {&__pyx_n_s_updateElementVolumesTriangle, __pyx_k_updateElementVolumesTriangle, sizeof(__pyx_k_updateElementVolumesTriangle), 0, 0, 1, 1},
40154  {&__pyx_n_s_updateInverseMeanRatioTriangleEl, __pyx_k_updateInverseMeanRatioTriangleEl, sizeof(__pyx_k_updateInverseMeanRatioTriangleEl), 0, 0, 1, 1},
40155  {&__pyx_n_s_updateInverseMeanRatioTriangleNo, __pyx_k_updateInverseMeanRatioTriangleNo, sizeof(__pyx_k_updateInverseMeanRatioTriangleNo), 0, 0, 1, 1},
40156  {&__pyx_n_s_variableNumbering_subdomain2glob, __pyx_k_variableNumbering_subdomain2glob, sizeof(__pyx_k_variableNumbering_subdomain2glob), 0, 0, 1, 1},
40157  {&__pyx_n_s_variableOffsets_subdomain_owned, __pyx_k_variableOffsets_subdomain_owned, sizeof(__pyx_k_variableOffsets_subdomain_owned), 0, 0, 1, 1},
40158  {&__pyx_n_s_variable_nb_local, __pyx_k_variable_nb_local, sizeof(__pyx_k_variable_nb_local), 0, 0, 1, 1},
40159  {&__pyx_n_s_vectors, __pyx_k_vectors, sizeof(__pyx_k_vectors), 0, 0, 1, 1},
40160  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
40161  {&__pyx_n_s_x2, __pyx_k_x2, sizeof(__pyx_k_x2), 0, 0, 1, 1},
40162  {&__pyx_n_s_xi, __pyx_k_xi, sizeof(__pyx_k_xi), 0, 0, 1, 1},
40163  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
40164  {&__pyx_n_s_y2, __pyx_k_y2, sizeof(__pyx_k_y2), 0, 0, 1, 1},
40165  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
40166  {&__pyx_n_s_z2, __pyx_k_z2, sizeof(__pyx_k_z2), 0, 0, 1, 1},
40167  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
40168  {&__pyx_n_s_zeros_like, __pyx_k_zeros_like, sizeof(__pyx_k_zeros_like), 0, 0, 1, 1},
40169  {0, 0, 0, 0, 0, 0, 0}
40170 };
40171 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
40172  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 414, __pyx_L1_error)
40173  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 1041, __pyx_L1_error)
40174  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 945, __pyx_L1_error)
40175  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(2, 133, __pyx_L1_error)
40176  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
40177  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
40178  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
40179  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
40180  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
40181  return 0;
40182  __pyx_L1_error:;
40183  return -1;
40184 }
40185 
40186 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
40187  __Pyx_RefNannyDeclarations
40188  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
40189 
40190  /* "mprans/MeshSmoothing.pyx":588
40191  * cdef int sumtot
40192  * cdef int[:] nodes_2rank_values
40193  * cdef int[:] nodes_2doArray = np.zeros(0, dtype=np.int32) # <<<<<<<<<<<<<<
40194  * if arg_shape_len > 1:
40195  * for i in range(1, arg_shape_len):
40196  */
40197  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 588, __pyx_L1_error)
40198  __Pyx_GOTREF(__pyx_tuple__3);
40199  __Pyx_GIVEREF(__pyx_tuple__3);
40200 
40201  /* "mprans/MeshSmoothing.pyx":608
40202  * # -----
40203  * # find length of array to do on processor rank_recv
40204  * nodes_2rank_values = (nodes_2rank[rank_recv][:]).astype(np.int32) # <<<<<<<<<<<<<<
40205  * nodes_2rank_len = len(nodes_2rank_values)
40206  * array_size = comm.allreduce(nodes_2rank_len, op=MPI.SUM)
40207  */
40208  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 608, __pyx_L1_error)
40209  __Pyx_GOTREF(__pyx_slice__4);
40210  __Pyx_GIVEREF(__pyx_slice__4);
40211 
40212  /* "mprans/MeshSmoothing.pyx":977
40213  * cdef double[:,:] W = np.array([[1., 0.5],
40214  * [0., sqrt(3)/2.]])
40215  * cdef double[:,:] A = np.zeros((2,2)) # <<<<<<<<<<<<<<
40216  * cdef double[:,:] AW = np.zeros((2,2))
40217  * cdef int[:] nElementsArray = np.zeros(nElements)
40218  */
40219  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 977, __pyx_L1_error)
40220  __Pyx_GOTREF(__pyx_tuple__6);
40221  __Pyx_GIVEREF(__pyx_tuple__6);
40222 
40223  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":945
40224  * __pyx_import_array()
40225  * except Exception:
40226  * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
40227  *
40228  * cdef inline int import_umath() except -1:
40229  */
40230  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 945, __pyx_L1_error)
40231  __Pyx_GOTREF(__pyx_tuple__7);
40232  __Pyx_GIVEREF(__pyx_tuple__7);
40233 
40234  /* "../miniconda3/envs/proteus-dev-up/lib/python3.10/site-packages/numpy/__init__.pxd":951
40235  * _import_umath()
40236  * except Exception:
40237  * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
40238  *
40239  * cdef inline int import_ufunc() except -1:
40240  */
40241  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 951, __pyx_L1_error)
40242  __Pyx_GOTREF(__pyx_tuple__8);
40243  __Pyx_GIVEREF(__pyx_tuple__8);
40244 
40245  /* "View.MemoryView":133
40246  *
40247  * if not self.ndim:
40248  * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
40249  *
40250  * if itemsize <= 0:
40251  */
40252  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 133, __pyx_L1_error)
40253  __Pyx_GOTREF(__pyx_tuple__9);
40254  __Pyx_GIVEREF(__pyx_tuple__9);
40255 
40256  /* "View.MemoryView":136
40257  *
40258  * if itemsize <= 0:
40259  * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
40260  *
40261  * if not isinstance(format, bytes):
40262  */
40263  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 136, __pyx_L1_error)
40264  __Pyx_GOTREF(__pyx_tuple__10);
40265  __Pyx_GIVEREF(__pyx_tuple__10);
40266 
40267  /* "View.MemoryView":148
40268  *
40269  * if not self._shape:
40270  * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
40271  *
40272  *
40273  */
40274  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 148, __pyx_L1_error)
40275  __Pyx_GOTREF(__pyx_tuple__11);
40276  __Pyx_GIVEREF(__pyx_tuple__11);
40277 
40278  /* "View.MemoryView":176
40279  * self.data = <char *>malloc(self.len)
40280  * if not self.data:
40281  * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
40282  *
40283  * if self.dtype_is_object:
40284  */
40285  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 176, __pyx_L1_error)
40286  __Pyx_GOTREF(__pyx_tuple__12);
40287  __Pyx_GIVEREF(__pyx_tuple__12);
40288 
40289  /* "View.MemoryView":192
40290  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
40291  * if not (flags & bufmode):
40292  * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
40293  * info.buf = self.data
40294  * info.len = self.len
40295  */
40296  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 192, __pyx_L1_error)
40297  __Pyx_GOTREF(__pyx_tuple__13);
40298  __Pyx_GIVEREF(__pyx_tuple__13);
40299 
40300  /* "(tree fragment)":2
40301  * def __reduce_cython__(self):
40302  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
40303  * def __setstate_cython__(self, __pyx_state):
40304  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40305  */
40306  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 2, __pyx_L1_error)
40307  __Pyx_GOTREF(__pyx_tuple__14);
40308  __Pyx_GIVEREF(__pyx_tuple__14);
40309 
40310  /* "(tree fragment)":4
40311  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40312  * def __setstate_cython__(self, __pyx_state):
40313  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
40314  */
40315  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 4, __pyx_L1_error)
40316  __Pyx_GOTREF(__pyx_tuple__15);
40317  __Pyx_GIVEREF(__pyx_tuple__15);
40318 
40319  /* "View.MemoryView":418
40320  * def __setitem__(memoryview self, object index, object value):
40321  * if self.view.readonly:
40322  * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
40323  *
40324  * have_slices, index = _unellipsify(index, self.view.ndim)
40325  */
40326  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 418, __pyx_L1_error)
40327  __Pyx_GOTREF(__pyx_tuple__16);
40328  __Pyx_GIVEREF(__pyx_tuple__16);
40329 
40330  /* "View.MemoryView":495
40331  * result = struct.unpack(self.view.format, bytesitem)
40332  * except struct.error:
40333  * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
40334  * else:
40335  * if len(self.view.format) == 1:
40336  */
40337  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 495, __pyx_L1_error)
40338  __Pyx_GOTREF(__pyx_tuple__17);
40339  __Pyx_GIVEREF(__pyx_tuple__17);
40340 
40341  /* "View.MemoryView":520
40342  * def __getbuffer__(self, Py_buffer *info, int flags):
40343  * if flags & PyBUF_WRITABLE and self.view.readonly:
40344  * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
40345  *
40346  * if flags & PyBUF_ND:
40347  */
40348  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 520, __pyx_L1_error)
40349  __Pyx_GOTREF(__pyx_tuple__18);
40350  __Pyx_GIVEREF(__pyx_tuple__18);
40351 
40352  /* "View.MemoryView":570
40353  * if self.view.strides == NULL:
40354  *
40355  * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
40356  *
40357  * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
40358  */
40359  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 570, __pyx_L1_error)
40360  __Pyx_GOTREF(__pyx_tuple__19);
40361  __Pyx_GIVEREF(__pyx_tuple__19);
40362 
40363  /* "View.MemoryView":577
40364  * def suboffsets(self):
40365  * if self.view.suboffsets == NULL:
40366  * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
40367  *
40368  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
40369  */
40370  __pyx_tuple__20 = PyTuple_New(1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 577, __pyx_L1_error)
40371  __Pyx_GOTREF(__pyx_tuple__20);
40372  __Pyx_INCREF(__pyx_int_neg_1);
40373  __Pyx_GIVEREF(__pyx_int_neg_1);
40374  PyTuple_SET_ITEM(__pyx_tuple__20, 0, __pyx_int_neg_1);
40375  __Pyx_GIVEREF(__pyx_tuple__20);
40376 
40377  /* "(tree fragment)":2
40378  * def __reduce_cython__(self):
40379  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
40380  * def __setstate_cython__(self, __pyx_state):
40381  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40382  */
40383  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 2, __pyx_L1_error)
40384  __Pyx_GOTREF(__pyx_tuple__21);
40385  __Pyx_GIVEREF(__pyx_tuple__21);
40386 
40387  /* "(tree fragment)":4
40388  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40389  * def __setstate_cython__(self, __pyx_state):
40390  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
40391  */
40392  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error)
40393  __Pyx_GOTREF(__pyx_tuple__22);
40394  __Pyx_GIVEREF(__pyx_tuple__22);
40395 
40396  /* "View.MemoryView":703
40397  * for suboffset in suboffsets[:ndim]:
40398  * if suboffset >= 0:
40399  * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
40400  *
40401  *
40402  */
40403  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 703, __pyx_L1_error)
40404  __Pyx_GOTREF(__pyx_tuple__23);
40405  __Pyx_GIVEREF(__pyx_tuple__23);
40406 
40407  /* "(tree fragment)":2
40408  * def __reduce_cython__(self):
40409  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
40410  * def __setstate_cython__(self, __pyx_state):
40411  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40412  */
40413  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error)
40414  __Pyx_GOTREF(__pyx_tuple__24);
40415  __Pyx_GIVEREF(__pyx_tuple__24);
40416 
40417  /* "(tree fragment)":4
40418  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
40419  * def __setstate_cython__(self, __pyx_state):
40420  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
40421  */
40422  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error)
40423  __Pyx_GOTREF(__pyx_tuple__25);
40424  __Pyx_GIVEREF(__pyx_tuple__25);
40425  __pyx_tuple__26 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 4, __pyx_L1_error)
40426  __Pyx_GOTREF(__pyx_tuple__26);
40427  __Pyx_GIVEREF(__pyx_tuple__26);
40428 
40429  /* "mprans/MeshSmoothing.pyx":11
40430  * from proteus.Profiling import logEvent
40431  *
40432  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
40433  * int[:] nodeStarOffsets,
40434  * int[:] nodeStarArray,
40435  */
40436  __pyx_tuple__32 = PyTuple_Pack(10, __pyx_n_s_nodeArray, __pyx_n_s_nodeStarOffsets, __pyx_n_s_nodeStarArray, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_nNodes_owned, __pyx_n_s_nd, __pyx_n_s_simultaneous, __pyx_n_s_smoothBoundaries, __pyx_n_s_fixedNodesBoolArray, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 11, __pyx_L1_error)
40437  __Pyx_GOTREF(__pyx_tuple__32);
40438  __Pyx_GIVEREF(__pyx_tuple__32);
40439  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(10, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_smoothNodesLaplace, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 11, __pyx_L1_error)
40440 
40441  /* "mprans/MeshSmoothing.pyx":64
40442  * alpha=alpha)
40443  *
40444  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
40445  * int[:] nodeElementOffsets,
40446  * int[:] nodeElementsArray,
40447  */
40448  __pyx_tuple__34 = PyTuple_Pack(12, __pyx_n_s_nodeArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementVolumesArray, __pyx_n_s_elementNodesArray, __pyx_n_s_nNodes_owned, __pyx_n_s_simultaneous, __pyx_n_s_smoothBoundaries, __pyx_n_s_fixedNodesBoolArray, __pyx_n_s_alpha); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 64, __pyx_L1_error)
40449  __Pyx_GOTREF(__pyx_tuple__34);
40450  __Pyx_GIVEREF(__pyx_tuple__34);
40451  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(12, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_smoothNodesCentroid, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 64, __pyx_L1_error)
40452 
40453  /* "mprans/MeshSmoothing.pyx":127
40454  * alpha=alpha)
40455  *
40456  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
40457  * double[:] elementVolumeArray,
40458  * double[:] elementVolumeTargetArray,
40459  */
40460  __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_elementDilationArray, __pyx_n_s_elementVolumeArray, __pyx_n_s_elementVolumeTargetArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 127, __pyx_L1_error)
40461  __Pyx_GOTREF(__pyx_tuple__36);
40462  __Pyx_GIVEREF(__pyx_tuple__36);
40463  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateDilationElements, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 127, __pyx_L1_error)
40464 
40465  /* "mprans/MeshSmoothing.pyx":136
40466  * nElements=nElements)
40467  *
40468  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
40469  * double[:] elementVolumeTargetArray):
40470  * cdef int nElements = len(elementVolumeArray)
40471  */
40472  __pyx_tuple__38 = PyTuple_Pack(4, __pyx_n_s_elementVolumeArray, __pyx_n_s_elementVolumeTargetArray, __pyx_n_s_nElements, __pyx_n_s_elementDilationArray); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 136, __pyx_L1_error)
40473  __Pyx_GOTREF(__pyx_tuple__38);
40474  __Pyx_GIVEREF(__pyx_tuple__38);
40475  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getDilationElements, 136, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 136, __pyx_L1_error)
40476 
40477  /* "mprans/MeshSmoothing.pyx":146
40478  * return elementDilationArray_
40479  *
40480  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
40481  * double[:,:,:,:] J_array,
40482  * double[:,:] detJ_array,
40483  */
40484  __pyx_tuple__40 = PyTuple_Pack(5, __pyx_n_s_elementDistortionArray, __pyx_n_s_J_array, __pyx_n_s_detJ_array, __pyx_n_s_nd, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 146, __pyx_L1_error)
40485  __Pyx_GOTREF(__pyx_tuple__40);
40486  __Pyx_GIVEREF(__pyx_tuple__40);
40487  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateDistortionElements, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 146, __pyx_L1_error)
40488 
40489  /* "mprans/MeshSmoothing.pyx":157
40490  * nElements=nElements)
40491  *
40492  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
40493  * double[:,:] detJ_array,
40494  * int nd):
40495  */
40496  __pyx_tuple__42 = PyTuple_Pack(5, __pyx_n_s_J_array, __pyx_n_s_detJ_array, __pyx_n_s_nd, __pyx_n_s_nElements, __pyx_n_s_elementDistortionArray); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 157, __pyx_L1_error)
40497  __Pyx_GOTREF(__pyx_tuple__42);
40498  __Pyx_GIVEREF(__pyx_tuple__42);
40499  __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getDistortionElements, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 157, __pyx_L1_error)
40500 
40501  /* "mprans/MeshSmoothing.pyx":169
40502  * return elementDistortionArray_
40503  *
40504  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
40505  * double[:,:] nodeArray,
40506  * int[:,:] elementNodesArray,
40507  */
40508  __pyx_tuple__44 = PyTuple_Pack(4, __pyx_n_s_IMRElementsArray, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 169, __pyx_L1_error)
40509  __Pyx_GOTREF(__pyx_tuple__44);
40510  __Pyx_GIVEREF(__pyx_tuple__44);
40511  __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateInverseMeanRatioTriangleEl, 169, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 169, __pyx_L1_error)
40512 
40513  /* "mprans/MeshSmoothing.pyx":178
40514  * nElements=nElements)
40515  *
40516  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
40517  * int[:,:] elementNodesArray):
40518  * cdef int nElements = len(elementNodesArray)
40519  */
40520  __pyx_tuple__46 = PyTuple_Pack(4, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nElements, __pyx_n_s_IMRElementsArray); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 178, __pyx_L1_error)
40521  __Pyx_GOTREF(__pyx_tuple__46);
40522  __Pyx_GIVEREF(__pyx_tuple__46);
40523  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getInverseMeanRatioTriangleEleme, 178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 178, __pyx_L1_error)
40524 
40525  /* "mprans/MeshSmoothing.pyx":188
40526  * return IMRElementsArray_
40527  *
40528  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
40529  * double[:,:] nodeArray,
40530  * int[:,:] elementNodesArray,
40531  */
40532  __pyx_tuple__48 = PyTuple_Pack(8, __pyx_n_s_IMRNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_nNodes, __pyx_n_s_nElements, __pyx_n_s_el_average); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 188, __pyx_L1_error)
40533  __Pyx_GOTREF(__pyx_tuple__48);
40534  __Pyx_GIVEREF(__pyx_tuple__48);
40535  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateInverseMeanRatioTriangleNo, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 188, __pyx_L1_error)
40536 
40537  /* "mprans/MeshSmoothing.pyx":205
40538  * nElements=nElements)
40539  *
40540  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
40541  * int[:,:] elementNodesArray,
40542  * int[:] nodeElementOffsets,
40543  */
40544  __pyx_tuple__50 = PyTuple_Pack(8, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_el_average, __pyx_n_s_nNodes, __pyx_n_s_nElements, __pyx_n_s_IMRNodesArray); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 205, __pyx_L1_error)
40545  __Pyx_GOTREF(__pyx_tuple__50);
40546  __Pyx_GIVEREF(__pyx_tuple__50);
40547  __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getInverseMeanRatioTriangleNodes, 205, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 205, __pyx_L1_error)
40548 
40549  /* "mprans/MeshSmoothing.pyx":223
40550  * return IMRNodesArray_
40551  *
40552  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
40553  * double[:,:] nodeArray,
40554  * int[:,:] elementNodesArray,
40555  */
40556  __pyx_tuple__52 = PyTuple_Pack(5, __pyx_n_s_node0, __pyx_n_s_nodeArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 223, __pyx_L1_error)
40557  __Pyx_GOTREF(__pyx_tuple__52);
40558  __Pyx_GIVEREF(__pyx_tuple__52);
40559  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getInverseMeanRatioSingleTriangl, 223, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 223, __pyx_L1_error)
40560 
40561  /* "mprans/MeshSmoothing.pyx":234
40562  * nodeElementsArray=nodeElementsArray)
40563  *
40564  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
40565  * double[:] dilation,
40566  * double[:,:] nodeArray,
40567  */
40568  __pyx_tuple__54 = PyTuple_Pack(9, __pyx_n_s_distortion, __pyx_n_s_dilation, __pyx_n_s_nodeArray_2, __pyx_n_s_nNodes_owned, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_elementNodesArray, __pyx_n_s_apply_directly); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 234, __pyx_L1_error)
40569  __Pyx_GOTREF(__pyx_tuple__54);
40570  __Pyx_GIVEREF(__pyx_tuple__54);
40571  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_smoothNodesQuality, 234, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 234, __pyx_L1_error)
40572 
40573  /* "mprans/MeshSmoothing.pyx":254
40574  * apply_directly=False)
40575  *
40576  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
40577  * double[:,:] nodeArray,
40578  * int[:] nodeStarOffsets,
40579  */
40580  __pyx_tuple__56 = PyTuple_Pack(5, __pyx_n_s_coords, __pyx_n_s_nodeArray_2, __pyx_n_s_nodeStarOffsets, __pyx_n_s_nodeStarArray, __pyx_n_s_node); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 254, __pyx_L1_error)
40581  __Pyx_GOTREF(__pyx_tuple__56);
40582  __Pyx_GIVEREF(__pyx_tuple__56);
40583  __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestNode, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 254, __pyx_L1_error)
40584 
40585  /* "mprans/MeshSmoothing.pyx":285
40586  * node)
40587  *
40588  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
40589  * double[:,:] elementBarycentersArray,
40590  * int[:,:] elementNeighborsArray,
40591  */
40592  __pyx_tuple__58 = PyTuple_Pack(4, __pyx_n_s_coords, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementNeighborsArray, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 285, __pyx_L1_error)
40593  __Pyx_GOTREF(__pyx_tuple__58);
40594  __Pyx_GIVEREF(__pyx_tuple__58);
40595  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestElement, 285, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 285, __pyx_L1_error)
40596 
40597  /* "mprans/MeshSmoothing.pyx":312
40598  * eN)
40599  *
40600  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
40601  * int[:] nodeElementOffsets,
40602  * int[:] nodeElementsArray,
40603  */
40604  __pyx_tuple__60 = PyTuple_Pack(5, __pyx_n_s_coords, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nodeElementsArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_node); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 312, __pyx_L1_error)
40605  __Pyx_GOTREF(__pyx_tuple__60);
40606  __Pyx_GIVEREF(__pyx_tuple__60);
40607  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestElementAroundNode, 312, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 312, __pyx_L1_error)
40608 
40609  /* "mprans/MeshSmoothing.pyx":343
40610  * node=node)
40611  *
40612  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
40613  * double[:] starting_coords,
40614  * double[:,:,:] elementBoundaryNormalsArray,
40615  */
40616  __pyx_tuple__62 = PyTuple_Pack(8, __pyx_n_s_coords, __pyx_n_s_starting_coords, __pyx_n_s_elementBoundaryNormalsArray, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBoundaryElementsArray, __pyx_n_s_exteriorElementBoundariesBoolArr, __pyx_n_s_eN); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 343, __pyx_L1_error)
40617  __Pyx_GOTREF(__pyx_tuple__62);
40618  __Pyx_GIVEREF(__pyx_tuple__62);
40619  __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalNearestElementIntersecti, 343, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 343, __pyx_L1_error)
40620 
40621  /* "mprans/MeshSmoothing.pyx":388
40622  * eN=eN)
40623  *
40624  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
40625  * coords,
40626  * node):
40627  */
40628  __pyx_tuple__64 = PyTuple_Pack(8, __pyx_n_s_femSpace, __pyx_n_s_coords, __pyx_n_s_node, __pyx_n_s_patchBoundaryNodes, __pyx_n_s_checkedElements, __pyx_n_s_eOffset, __pyx_n_s_eN, __pyx_n_s_xi); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 388, __pyx_L1_error)
40629  __Pyx_GOTREF(__pyx_tuple__64);
40630  __Pyx_GIVEREF(__pyx_tuple__64);
40631  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getLocalElement, 388, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 388, __pyx_L1_error)
40632 
40633  /* "mprans/MeshSmoothing.pyx":452
40634  *
40635  *
40636  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
40637  * double[:,:] nodeArray,
40638  * int[:,:] elementBoundariesArray,
40639  */
40640  __pyx_tuple__66 = PyTuple_Pack(7, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 452, __pyx_L1_error)
40641  __Pyx_GOTREF(__pyx_tuple__66);
40642  __Pyx_GIVEREF(__pyx_tuple__66);
40643  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementBoundaryNormalsTria, 452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 452, __pyx_L1_error)
40644 
40645  /* "mprans/MeshSmoothing.pyx":467
40646  * nElements=nElements)
40647  *
40648  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
40649  * int[:,:] elementBoundariesArray,
40650  * int[:,:] elementBoundaryNodesArray,
40651  */
40652  __pyx_tuple__68 = PyTuple_Pack(7, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 467, __pyx_L1_error)
40653  __Pyx_GOTREF(__pyx_tuple__68);
40654  __Pyx_GIVEREF(__pyx_tuple__68);
40655  __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getElementBoundaryNormalsTriangl, 467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 467, __pyx_L1_error)
40656 
40657  /* "mprans/MeshSmoothing.pyx":483
40658  * return elementBoundaryNormalsArray_
40659  *
40660  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
40661  * double[:,:] nodeArray,
40662  * int[:,:] elementBoundariesArray,
40663  */
40664  __pyx_tuple__70 = PyTuple_Pack(7, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 483, __pyx_L1_error)
40665  __Pyx_GOTREF(__pyx_tuple__70);
40666  __Pyx_GIVEREF(__pyx_tuple__70);
40667  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementBoundaryNormalsTetr, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 483, __pyx_L1_error)
40668 
40669  /* "mprans/MeshSmoothing.pyx":498
40670  * nElements=nElements)
40671  *
40672  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
40673  * int[:,:] elementBoundariesArray,
40674  * int[:,:] elementBoundaryNodesArray,
40675  */
40676  __pyx_tuple__72 = PyTuple_Pack(7, __pyx_n_s_nodeArray_2, __pyx_n_s_elementBoundariesArray, __pyx_n_s_elementBoundaryNodesArray, __pyx_n_s_elementBoundaryBarycentersArray, __pyx_n_s_elementBarycentersArray, __pyx_n_s_elementBoundaryNormalsArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 498, __pyx_L1_error)
40677  __Pyx_GOTREF(__pyx_tuple__72);
40678  __Pyx_GIVEREF(__pyx_tuple__72);
40679  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getElementBoundaryNormalsTetra, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 498, __pyx_L1_error)
40680 
40681  /* "mprans/MeshSmoothing.pyx":514
40682  * return elementBoundaryNormalsArray_
40683  *
40684  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
40685  * int[:,:] elementNodesArray,
40686  * double[:,:] nodeArray,
40687  */
40688  __pyx_tuple__74 = PyTuple_Pack(4, __pyx_n_s_elementVolumesArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 514, __pyx_L1_error)
40689  __Pyx_GOTREF(__pyx_tuple__74);
40690  __Pyx_GIVEREF(__pyx_tuple__74);
40691  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementVolumesTriangle, 514, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 514, __pyx_L1_error)
40692 
40693  /* "mprans/MeshSmoothing.pyx":523
40694  * nElements=nElements)
40695  *
40696  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
40697  * double[:] nB,
40698  * double[:] nC):
40699  */
40700  __pyx_tuple__76 = PyTuple_Pack(3, __pyx_n_s_nA, __pyx_n_s_nB, __pyx_n_s_nC); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 523, __pyx_L1_error)
40701  __Pyx_GOTREF(__pyx_tuple__76);
40702  __Pyx_GIVEREF(__pyx_tuple__76);
40703  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getElementVolumeTriangle, 523, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 523, __pyx_L1_error)
40704 
40705  /* "mprans/MeshSmoothing.pyx":530
40706  * nC=nC)
40707  *
40708  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
40709  * int[:,:] elementNodesArray,
40710  * double[:,:] nodeArray,
40711  */
40712  __pyx_tuple__78 = PyTuple_Pack(4, __pyx_n_s_elementVolumesArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 530, __pyx_L1_error)
40713  __Pyx_GOTREF(__pyx_tuple__78);
40714  __Pyx_GIVEREF(__pyx_tuple__78);
40715  __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementVolumesTetra, 530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 530, __pyx_L1_error)
40716 
40717  /* "mprans/MeshSmoothing.pyx":539
40718  * nElements=nElements)
40719  *
40720  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
40721  * int[:,:] elementNodesArray,
40722  * double[:,:] nodeArray,
40723  */
40724  __pyx_tuple__80 = PyTuple_Pack(4, __pyx_n_s_elementBarycentersArray_2, __pyx_n_s_elementNodesArray, __pyx_n_s_nodeArray_2, __pyx_n_s_nElements); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 539, __pyx_L1_error)
40725  __Pyx_GOTREF(__pyx_tuple__80);
40726  __Pyx_GIVEREF(__pyx_tuple__80);
40727  __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_updateElementBarycenters, 539, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 539, __pyx_L1_error)
40728 
40729  /* "mprans/MeshSmoothing.pyx":548
40730  * nElements=nElements)
40731  *
40732  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
40733  * int[:] nodeStarArray,
40734  * int[:] nodeStarOffsets,
40735  */
40736  __pyx_tuple__82 = PyTuple_Pack(5, __pyx_n_s_nodeArray_2, __pyx_n_s_nodeStarArray, __pyx_n_s_nodeStarOffsets, __pyx_n_s_nodeMaterialTypes, __pyx_n_s_nNodes); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 548, __pyx_L1_error)
40737  __Pyx_GOTREF(__pyx_tuple__82);
40738  __Pyx_GIVEREF(__pyx_tuple__82);
40739  __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getCornerNodesTriangle, 548, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 548, __pyx_L1_error)
40740 
40741  /* "mprans/MeshSmoothing.pyx":559
40742  * nNodes=nNodes)
40743  *
40744  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
40745  * int nNodes_owned,
40746  * int nNodes_global,
40747  */
40748  __pyx_tuple__84 = PyTuple_Pack(42, __pyx_n_s_args, __pyx_n_s_nNodes_owned, __pyx_n_s_nNodes_global, __pyx_n_s_nodeNumbering_subdomain2global, __pyx_n_s_nodeOffsets_subdomain_owned, __pyx_n_s_Comm, __pyx_n_s_comm, __pyx_n_s_comm_size, __pyx_n_s_my_rank, __pyx_n_s_arg_2rank, __pyx_n_s_nodes_2rank, __pyx_n_s_result, __pyx_n_s_counts_in, __pyx_n_s_displacements_in, __pyx_n_s_counts_out, __pyx_n_s_displacements_out, __pyx_n_s_arg_shape, __pyx_n_s_arg_shape_copy, __pyx_n_s_arg_shape_len, __pyx_n_s_shape_factor, __pyx_n_s_disp, __pyx_n_s_rank, __pyx_n_s_rank_recv, __pyx_n_s_ii, __pyx_n_s_ir, __pyx_n_s_iN, __pyx_n_s_node_new_rank, __pyx_n_s_new_rank, __pyx_n_s_sumtot, __pyx_n_s_nodes_2rank_values, __pyx_n_s_nodes_2doArray, __pyx_n_s_i, __pyx_n_s_node, __pyx_n_s_nodes_2rank_len, __pyx_n_s_array_size, __pyx_n_s_my_size, __pyx_n_s_arg_2rank_values, __pyx_n_s_arg_2doArray, __pyx_n_s_datatype, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 559, __pyx_L1_error)
40749  __Pyx_GOTREF(__pyx_tuple__84);
40750  __Pyx_GIVEREF(__pyx_tuple__84);
40751  __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(5, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_getNonOwnedNodeValues, 559, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 559, __pyx_L1_error)
40752 
40753  /* "mprans/MeshSmoothing.pyx":690
40754  * # nproc=str(comm_size)))
40755  *
40756  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
40757  * int rank,
40758  * int nVariables_owned,
40759  */
40760  __pyx_tuple__86 = PyTuple_Pack(5, __pyx_n_s_variable_nb_local, __pyx_n_s_rank, __pyx_n_s_nVariables_owned, __pyx_n_s_variableNumbering_subdomain2glob, __pyx_n_s_variableOffsets_subdomain_owned); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 690, __pyx_L1_error)
40761  __Pyx_GOTREF(__pyx_tuple__86);
40762  __Pyx_GIVEREF(__pyx_tuple__86);
40763  __pyx_codeobj__87 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_checkOwnedVariable, 690, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__87)) __PYX_ERR(0, 690, __pyx_L1_error)
40764 
40765  /* "mprans/MeshSmoothing.pyx":701
40766  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
40767  *
40768  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
40769  * int[:] nodeElementsArray,
40770  * int[:] nodeElementOffsets):
40771  */
40772  __pyx_tuple__88 = PyTuple_Pack(3, __pyx_n_s_scalars, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 701, __pyx_L1_error)
40773  __Pyx_GOTREF(__pyx_tuple__88);
40774  __Pyx_GIVEREF(__pyx_tuple__88);
40775  __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyScalarRecoveryAtNodes, 701, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 701, __pyx_L1_error)
40776 
40777  /* "mprans/MeshSmoothing.pyx":708
40778  * nodeElementOffsets=nodeElementOffsets)
40779  *
40780  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
40781  * int[:] nodeElementsArray,
40782  * int[:] nodeElementOffsets,
40783  */
40784  __pyx_tuple__90 = PyTuple_Pack(5, __pyx_n_s_scalars, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_detJ_array, __pyx_n_s_nNodes); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 708, __pyx_L1_error)
40785  __Pyx_GOTREF(__pyx_tuple__90);
40786  __Pyx_GIVEREF(__pyx_tuple__90);
40787  __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyScalarRecoveryAtNodesWeighted, 708, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 708, __pyx_L1_error)
40788 
40789  /* "mprans/MeshSmoothing.pyx":719
40790  * nNodes=nNodes)
40791  *
40792  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
40793  * nodeElementsArray,
40794  * nodeElementOffsets,
40795  */
40796  __pyx_tuple__92 = PyTuple_Pack(4, __pyx_n_s_vectors, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_nd); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 719, __pyx_L1_error)
40797  __Pyx_GOTREF(__pyx_tuple__92);
40798  __Pyx_GIVEREF(__pyx_tuple__92);
40799  __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyVectorRecoveryAtNodes, 719, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 719, __pyx_L1_error)
40800 
40801  /* "mprans/MeshSmoothing.pyx":728
40802  * nd=nd)
40803  *
40804  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
40805  * int[:] nodeElementsArray,
40806  * int[:] nodeElementOffsets,
40807  */
40808  __pyx_tuple__94 = PyTuple_Pack(5, __pyx_n_s_vectors, __pyx_n_s_nodeElementsArray, __pyx_n_s_nodeElementOffsets, __pyx_n_s_detJ_array, __pyx_n_s_nd); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 728, __pyx_L1_error)
40809  __Pyx_GOTREF(__pyx_tuple__94);
40810  __Pyx_GIVEREF(__pyx_tuple__94);
40811  __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_mprans_MeshSmoothing_pyx, __pyx_n_s_pyVectorRecoveryAtNodesWeighted, 728, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 728, __pyx_L1_error)
40812 
40813  /* "View.MemoryView":286
40814  * return self.name
40815  *
40816  * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
40817  * cdef strided = Enum("<strided and direct>") # default
40818  * cdef indirect = Enum("<strided and indirect>")
40819  */
40820  __pyx_tuple__96 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(2, 286, __pyx_L1_error)
40821  __Pyx_GOTREF(__pyx_tuple__96);
40822  __Pyx_GIVEREF(__pyx_tuple__96);
40823 
40824  /* "View.MemoryView":287
40825  *
40826  * cdef generic = Enum("<strided and direct or indirect>")
40827  * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
40828  * cdef indirect = Enum("<strided and indirect>")
40829  *
40830  */
40831  __pyx_tuple__97 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(2, 287, __pyx_L1_error)
40832  __Pyx_GOTREF(__pyx_tuple__97);
40833  __Pyx_GIVEREF(__pyx_tuple__97);
40834 
40835  /* "View.MemoryView":288
40836  * cdef generic = Enum("<strided and direct or indirect>")
40837  * cdef strided = Enum("<strided and direct>") # default
40838  * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
40839  *
40840  *
40841  */
40842  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(2, 288, __pyx_L1_error)
40843  __Pyx_GOTREF(__pyx_tuple__98);
40844  __Pyx_GIVEREF(__pyx_tuple__98);
40845 
40846  /* "View.MemoryView":291
40847  *
40848  *
40849  * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
40850  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
40851  *
40852  */
40853  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(2, 291, __pyx_L1_error)
40854  __Pyx_GOTREF(__pyx_tuple__99);
40855  __Pyx_GIVEREF(__pyx_tuple__99);
40856 
40857  /* "View.MemoryView":292
40858  *
40859  * cdef contiguous = Enum("<contiguous and direct>")
40860  * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
40861  *
40862  *
40863  */
40864  __pyx_tuple__100 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(2, 292, __pyx_L1_error)
40865  __Pyx_GOTREF(__pyx_tuple__100);
40866  __Pyx_GIVEREF(__pyx_tuple__100);
40867 
40868  /* "(tree fragment)":1
40869  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
40870  * cdef object __pyx_PickleError
40871  * cdef object __pyx_result
40872  */
40873  __pyx_tuple__101 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(2, 1, __pyx_L1_error)
40874  __Pyx_GOTREF(__pyx_tuple__101);
40875  __Pyx_GIVEREF(__pyx_tuple__101);
40876  __pyx_codeobj__102 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__101, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__102)) __PYX_ERR(2, 1, __pyx_L1_error)
40877  __Pyx_RefNannyFinishContext();
40878  return 0;
40879  __pyx_L1_error:;
40880  __Pyx_RefNannyFinishContext();
40881  return -1;
40882 }
40883 
40884 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
40885  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
40886  __pyx_float_0_ = PyFloat_FromDouble(0.); if (unlikely(!__pyx_float_0_)) __PYX_ERR(0, 1, __pyx_L1_error)
40887  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) __PYX_ERR(0, 1, __pyx_L1_error)
40888  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error)
40889  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
40890  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
40891  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
40892  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
40893  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
40894  __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error)
40895  __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error)
40896  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
40897  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
40898  return 0;
40899  __pyx_L1_error:;
40900  return -1;
40901 }
40902 
40903 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
40904 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
40905 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
40906 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
40907 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
40908 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
40909 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
40910 
40911 static int __Pyx_modinit_global_init_code(void) {
40912  __Pyx_RefNannyDeclarations
40913  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
40914  /*--- Global init code ---*/
40915  generic = Py_None; Py_INCREF(Py_None);
40916  strided = Py_None; Py_INCREF(Py_None);
40917  indirect = Py_None; Py_INCREF(Py_None);
40918  contiguous = Py_None; Py_INCREF(Py_None);
40919  indirect_contiguous = Py_None; Py_INCREF(Py_None);
40920  __Pyx_RefNannyFinishContext();
40921  return 0;
40922 }
40923 
40924 static int __Pyx_modinit_variable_export_code(void) {
40925  __Pyx_RefNannyDeclarations
40926  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
40927  /*--- Variable export code ---*/
40928  __Pyx_RefNannyFinishContext();
40929  return 0;
40930 }
40931 
40932 static int __Pyx_modinit_function_export_code(void) {
40933  __Pyx_RefNannyDeclarations
40934  int __pyx_lineno = 0;
40935  const char *__pyx_filename = NULL;
40936  int __pyx_clineno = 0;
40937  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
40938  /*--- Function export code ---*/
40939  if (__Pyx_ExportFunction("cySmoothNodesLaplace", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cySmoothNodesLaplace, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesLaplace *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40940  if (__Pyx_ExportFunction("cySmoothNodesCentroid", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cySmoothNodesCentroid, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesCentroid *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40941  if (__Pyx_ExportFunction("cyUpdateDilationElements", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateDilationElements, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40942  if (__Pyx_ExportFunction("cyUpdateDistortionElements", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateDistortionElements, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40943  if (__Pyx_ExportFunction("cyUpdateInverseMeanRatioTriangleNodes", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, int, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleNodes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40944  if (__Pyx_ExportFunction("cyUpdateInverseMeanRatioTriangleElements", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateInverseMeanRatioTriangleElements, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40945  if (__Pyx_ExportFunction("cyGetInverseMeanRatioSingleTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle, "double (int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cyGetInverseMeanRatioSingleTriangle *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40946  if (__Pyx_ExportFunction("cySmoothNodesQuality", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cySmoothNodesQuality, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_6mprans_13MeshSmoothing_cySmoothNodesQuality *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40947  if (__Pyx_ExportFunction("pyxGetLocalNearestNode", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestNode, "int (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40948  if (__Pyx_ExportFunction("pyxGetLocalNearestElement", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElement, "int (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40949  if (__Pyx_ExportFunction("pyxGetLocalNearestElementIntersection", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementIntersection, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40950  if (__Pyx_ExportFunction("pyxGetLocalNearestElementAroundNode", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxGetLocalNearestElementAroundNode, "int (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40951  if (__Pyx_ExportFunction("pyxUpdateElementBoundaryNormalsTetra", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTetra, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40952  if (__Pyx_ExportFunction("pyxUpdateElementBoundaryNormalsTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_pyxUpdateElementBoundaryNormalsTriangle, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40953  if (__Pyx_ExportFunction("cyUpdateElementVolumesTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTriangle, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40954  if (__Pyx_ExportFunction("cyUpdateElementVolumesTetra", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateElementVolumesTetra, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40955  if (__Pyx_ExportFunction("cyUpdateElementBarycenters", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyUpdateElementBarycenters, "void (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40956  if (__Pyx_ExportFunction("cyGetCornerNodesTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetCornerNodesTriangle, "PyArrayObject *(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40957  if (__Pyx_ExportFunction("cyCheckOwnedVariable", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyCheckOwnedVariable, "__Pyx_memviewslice (int, int, int, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40958  if (__Pyx_ExportFunction("cyGetGlobalVariable", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetGlobalVariable, "__Pyx_memviewslice (int, int, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40959  if (__Pyx_ExportFunction("cyGetLocalVariable", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyGetLocalVariable, "int (int, int, int, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40960  if (__Pyx_ExportFunction("cyScalarRecoveryAtNodes", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodes, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40961  if (__Pyx_ExportFunction("cyScalarRecoveryAtNodesWeighted", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyScalarRecoveryAtNodesWeighted, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40962  if (__Pyx_ExportFunction("cyVectorRecoveryAtNodesWeighted", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodesWeighted, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40963  if (__Pyx_ExportFunction("cyVectorRecoveryAtNodes", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyVectorRecoveryAtNodes, "__Pyx_memviewslice (__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40964  if (__Pyx_ExportFunction("cyFindBoundaryDirectionTriangle", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTriangle, "void (__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40965  if (__Pyx_ExportFunction("cyFindBoundaryDirectionTetra", (void (*)(void))__pyx_f_6mprans_13MeshSmoothing_cyFindBoundaryDirectionTetra, "void (__Pyx_memviewslice, int, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
40966  __Pyx_RefNannyFinishContext();
40967  return 0;
40968  __pyx_L1_error:;
40969  __Pyx_RefNannyFinishContext();
40970  return -1;
40971 }
40972 
40973 static int __Pyx_modinit_type_init_code(void) {
40974  __Pyx_RefNannyDeclarations
40975  int __pyx_lineno = 0;
40976  const char *__pyx_filename = NULL;
40977  int __pyx_clineno = 0;
40978  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
40979  /*--- Type init code ---*/
40980  if (PyType_Ready(&__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues) < 0) __PYX_ERR(0, 559, __pyx_L1_error)
40981  #if PY_VERSION_HEX < 0x030800B1
40982  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_print = 0;
40983  #endif
40984  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_dictoffset && __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_getattro == PyObject_GenericGetAttr)) {
40985  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
40986  }
40987  __pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues = &__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct__getNonOwnedNodeValues;
40988  if (PyType_Ready(&__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 625, __pyx_L1_error)
40989  #if PY_VERSION_HEX < 0x030800B1
40990  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_print = 0;
40991  #endif
40992  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_dictoffset && __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
40993  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
40994  }
40995  __pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr = &__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_1_genexpr;
40996  if (PyType_Ready(&__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 626, __pyx_L1_error)
40997  #if PY_VERSION_HEX < 0x030800B1
40998  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_print = 0;
40999  #endif
41000  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_dictoffset && __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_getattro == PyObject_GenericGetAttr)) {
41001  __pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
41002  }
41003  __pyx_ptype_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr = &__pyx_type_6mprans_13MeshSmoothing___pyx_scope_struct_2_genexpr;
41004  __pyx_vtabptr_array = &__pyx_vtable_array;
41005  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
41006  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
41007  #if PY_VERSION_HEX < 0x030800B1
41008  __pyx_type___pyx_array.tp_print = 0;
41009  #endif
41010  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
41011  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
41012  __pyx_array_type = &__pyx_type___pyx_array;
41013  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
41014  #if PY_VERSION_HEX < 0x030800B1
41015  __pyx_type___pyx_MemviewEnum.tp_print = 0;
41016  #endif
41017  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
41018  __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
41019  }
41020  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
41021  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
41022  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
41023  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
41024  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
41025  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
41026  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
41027  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
41028  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
41029  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
41030  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
41031  #if PY_VERSION_HEX < 0x030800B1
41032  __pyx_type___pyx_memoryview.tp_print = 0;
41033  #endif
41034  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
41035  __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
41036  }
41037  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
41038  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
41039  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
41040  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
41041  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
41042  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
41043  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
41044  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
41045  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
41046  #if PY_VERSION_HEX < 0x030800B1
41047  __pyx_type___pyx_memoryviewslice.tp_print = 0;
41048  #endif
41049  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
41050  __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
41051  }
41052  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
41053  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
41054  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
41055  __Pyx_RefNannyFinishContext();
41056  return 0;
41057  __pyx_L1_error:;
41058  __Pyx_RefNannyFinishContext();
41059  return -1;
41060 }
41061 
41062 static int __Pyx_modinit_type_import_code(void) {
41063  __Pyx_RefNannyDeclarations
41064  PyObject *__pyx_t_1 = NULL;
41065  int __pyx_lineno = 0;
41066  const char *__pyx_filename = NULL;
41067  int __pyx_clineno = 0;
41068  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
41069  /*--- Type import code ---*/
41070  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
41071  __Pyx_GOTREF(__pyx_t_1);
41072  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
41073  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
41074  sizeof(PyTypeObject),
41075  #else
41076  sizeof(PyHeapTypeObject),
41077  #endif
41078  __Pyx_ImportType_CheckSize_Warn);
41079  if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
41080  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41081  __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 200, __pyx_L1_error)
41082  __Pyx_GOTREF(__pyx_t_1);
41083  __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
41084  if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 200, __pyx_L1_error)
41085  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
41086  if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 223, __pyx_L1_error)
41087  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
41088  if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 227, __pyx_L1_error)
41089  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
41090  if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 239, __pyx_L1_error)
41091  __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1, "numpy", "generic", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41092  if (!__pyx_ptype_5numpy_generic) __PYX_ERR(1, 771, __pyx_L1_error)
41093  __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1, "numpy", "number", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41094  if (!__pyx_ptype_5numpy_number) __PYX_ERR(1, 773, __pyx_L1_error)
41095  __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1, "numpy", "integer", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41096  if (!__pyx_ptype_5numpy_integer) __PYX_ERR(1, 775, __pyx_L1_error)
41097  __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "signedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41098  if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(1, 777, __pyx_L1_error)
41099  __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1, "numpy", "unsignedinteger", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41100  if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(1, 779, __pyx_L1_error)
41101  __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1, "numpy", "inexact", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41102  if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(1, 781, __pyx_L1_error)
41103  __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1, "numpy", "floating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41104  if (!__pyx_ptype_5numpy_floating) __PYX_ERR(1, 783, __pyx_L1_error)
41105  __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1, "numpy", "complexfloating", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41106  if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(1, 785, __pyx_L1_error)
41107  __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1, "numpy", "flexible", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41108  if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(1, 787, __pyx_L1_error)
41109  __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1, "numpy", "character", sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
41110  if (!__pyx_ptype_5numpy_character) __PYX_ERR(1, 789, __pyx_L1_error)
41111  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
41112  if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 827, __pyx_L1_error)
41113  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41114  __Pyx_RefNannyFinishContext();
41115  return 0;
41116  __pyx_L1_error:;
41117  __Pyx_XDECREF(__pyx_t_1);
41118  __Pyx_RefNannyFinishContext();
41119  return -1;
41120 }
41121 
41122 static int __Pyx_modinit_variable_import_code(void) {
41123  __Pyx_RefNannyDeclarations
41124  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
41125  /*--- Variable import code ---*/
41126  __Pyx_RefNannyFinishContext();
41127  return 0;
41128 }
41129 
41130 static int __Pyx_modinit_function_import_code(void) {
41131  __Pyx_RefNannyDeclarations
41132  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
41133  /*--- Function import code ---*/
41134  __Pyx_RefNannyFinishContext();
41135  return 0;
41136 }
41137 
41138 
41139 #ifndef CYTHON_NO_PYINIT_EXPORT
41140 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
41141 #elif PY_MAJOR_VERSION < 3
41142 #ifdef __cplusplus
41143 #define __Pyx_PyMODINIT_FUNC extern "C" void
41144 #else
41145 #define __Pyx_PyMODINIT_FUNC void
41146 #endif
41147 #else
41148 #ifdef __cplusplus
41149 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
41150 #else
41151 #define __Pyx_PyMODINIT_FUNC PyObject *
41152 #endif
41153 #endif
41154 
41155 
41156 #if PY_MAJOR_VERSION < 3
41157 __Pyx_PyMODINIT_FUNC initMeshSmoothing(void) CYTHON_SMALL_CODE; /*proto*/
41158 __Pyx_PyMODINIT_FUNC initMeshSmoothing(void)
41159 #else
41160 __Pyx_PyMODINIT_FUNC PyInit_MeshSmoothing(void) CYTHON_SMALL_CODE; /*proto*/
41161 __Pyx_PyMODINIT_FUNC PyInit_MeshSmoothing(void)
41162 #if CYTHON_PEP489_MULTI_PHASE_INIT
41163 {
41164  return PyModuleDef_Init(&__pyx_moduledef);
41165 }
41166 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
41167  #if PY_VERSION_HEX >= 0x030700A1
41168  static PY_INT64_T main_interpreter_id = -1;
41169  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
41170  if (main_interpreter_id == -1) {
41171  main_interpreter_id = current_id;
41172  return (unlikely(current_id == -1)) ? -1 : 0;
41173  } else if (unlikely(main_interpreter_id != current_id))
41174  #else
41175  static PyInterpreterState *main_interpreter = NULL;
41176  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
41177  if (!main_interpreter) {
41178  main_interpreter = current_interpreter;
41179  } else if (unlikely(main_interpreter != current_interpreter))
41180  #endif
41181  {
41182  PyErr_SetString(
41183  PyExc_ImportError,
41184  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
41185  return -1;
41186  }
41187  return 0;
41188 }
41189 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
41190  PyObject *value = PyObject_GetAttrString(spec, from_name);
41191  int result = 0;
41192  if (likely(value)) {
41193  if (allow_none || value != Py_None) {
41194  result = PyDict_SetItemString(moddict, to_name, value);
41195  }
41196  Py_DECREF(value);
41197  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
41198  PyErr_Clear();
41199  } else {
41200  result = -1;
41201  }
41202  return result;
41203 }
41204 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
41205  PyObject *module = NULL, *moddict, *modname;
41206  if (__Pyx_check_single_interpreter())
41207  return NULL;
41208  if (__pyx_m)
41209  return __Pyx_NewRef(__pyx_m);
41210  modname = PyObject_GetAttrString(spec, "name");
41211  if (unlikely(!modname)) goto bad;
41212  module = PyModule_NewObject(modname);
41213  Py_DECREF(modname);
41214  if (unlikely(!module)) goto bad;
41215  moddict = PyModule_GetDict(module);
41216  if (unlikely(!moddict)) goto bad;
41217  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
41218  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
41219  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
41220  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
41221  return module;
41222 bad:
41223  Py_XDECREF(module);
41224  return NULL;
41225 }
41226 
41227 
41228 static CYTHON_SMALL_CODE int __pyx_pymod_exec_MeshSmoothing(PyObject *__pyx_pyinit_module)
41229 #endif
41230 #endif
41231 {
41232  PyObject *__pyx_t_1 = NULL;
41233  PyObject *__pyx_t_2 = NULL;
41234  __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
41235  static PyThread_type_lock __pyx_t_4[8];
41236  int __pyx_lineno = 0;
41237  const char *__pyx_filename = NULL;
41238  int __pyx_clineno = 0;
41239  __Pyx_RefNannyDeclarations
41240  #if CYTHON_PEP489_MULTI_PHASE_INIT
41241  if (__pyx_m) {
41242  if (__pyx_m == __pyx_pyinit_module) return 0;
41243  PyErr_SetString(PyExc_RuntimeError, "Module 'MeshSmoothing' has already been imported. Re-initialisation is not supported.");
41244  return -1;
41245  }
41246  #elif PY_MAJOR_VERSION >= 3
41247  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
41248  #endif
41249  #if CYTHON_REFNANNY
41250 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
41251 if (!__Pyx_RefNanny) {
41252  PyErr_Clear();
41253  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
41254  if (!__Pyx_RefNanny)
41255  Py_FatalError("failed to import 'refnanny' module");
41256 }
41257 #endif
41258  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_MeshSmoothing(void)", 0);
41259  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41260  #ifdef __Pxy_PyFrame_Initialize_Offsets
41261  __Pxy_PyFrame_Initialize_Offsets();
41262  #endif
41263  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
41264  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
41265  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
41266  #ifdef __Pyx_CyFunction_USED
41267  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41268  #endif
41269  #ifdef __Pyx_FusedFunction_USED
41270  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41271  #endif
41272  #ifdef __Pyx_Coroutine_USED
41273  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41274  #endif
41275  #ifdef __Pyx_Generator_USED
41276  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41277  #endif
41278  #ifdef __Pyx_AsyncGen_USED
41279  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41280  #endif
41281  #ifdef __Pyx_StopAsyncIteration_USED
41282  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41283  #endif
41284  /*--- Library function declarations ---*/
41285  /*--- Threads initialization code ---*/
41286  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
41287  PyEval_InitThreads();
41288  #endif
41289  /*--- Module creation code ---*/
41290  #if CYTHON_PEP489_MULTI_PHASE_INIT
41291  __pyx_m = __pyx_pyinit_module;
41292  Py_INCREF(__pyx_m);
41293  #else
41294  #if PY_MAJOR_VERSION < 3
41295  __pyx_m = Py_InitModule4("MeshSmoothing", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
41296  #else
41297  __pyx_m = PyModule_Create(&__pyx_moduledef);
41298  #endif
41299  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
41300  #endif
41301  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
41302  Py_INCREF(__pyx_d);
41303  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
41304  Py_INCREF(__pyx_b);
41305  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
41306  Py_INCREF(__pyx_cython_runtime);
41307  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
41308  /*--- Initialize various global constants etc. ---*/
41309  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41310  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
41311  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41312  #endif
41313  if (__pyx_module_is_main_mprans__MeshSmoothing) {
41314  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41315  }
41316  #if PY_MAJOR_VERSION >= 3
41317  {
41318  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
41319  if (!PyDict_GetItemString(modules, "mprans.MeshSmoothing")) {
41320  if (unlikely(PyDict_SetItemString(modules, "mprans.MeshSmoothing", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
41321  }
41322  }
41323  #endif
41324  /*--- Builtin init code ---*/
41325  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41326  /*--- Constants init code ---*/
41327  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41328  /*--- Global type/function init code ---*/
41329  (void)__Pyx_modinit_global_init_code();
41330  (void)__Pyx_modinit_variable_export_code();
41331  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
41332  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
41333  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
41334  (void)__Pyx_modinit_variable_import_code();
41335  (void)__Pyx_modinit_function_import_code();
41336  /*--- Execution code ---*/
41337  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
41338  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41339  #endif
41340 
41341  /* "mprans/MeshSmoothing.pyx":4
41342  * #cython: wraparound=True, boundscheck=False, initializedcheck=False, cdivision=True
41343  *
41344  * import numpy as np # <<<<<<<<<<<<<<
41345  * cimport numpy as np
41346  * from libcpp cimport bool
41347  */
41348  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
41349  __Pyx_GOTREF(__pyx_t_1);
41350  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
41351  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41352 
41353  /* "mprans/MeshSmoothing.pyx":8
41354  * from libcpp cimport bool
41355  * from libc.math cimport sin, cos, acos, exp, sqrt, fabs, M_PI, abs
41356  * from mpi4py import MPI # <<<<<<<<<<<<<<
41357  * from proteus.Profiling import logEvent
41358  *
41359  */
41360  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
41361  __Pyx_GOTREF(__pyx_t_1);
41362  __Pyx_INCREF(__pyx_n_s_MPI);
41363  __Pyx_GIVEREF(__pyx_n_s_MPI);
41364  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_MPI);
41365  __pyx_t_2 = __Pyx_Import(__pyx_n_s_mpi4py, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
41366  __Pyx_GOTREF(__pyx_t_2);
41367  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41368  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_MPI); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
41369  __Pyx_GOTREF(__pyx_t_1);
41370  if (PyDict_SetItem(__pyx_d, __pyx_n_s_MPI, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
41371  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41372  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41373 
41374  /* "mprans/MeshSmoothing.pyx":9
41375  * from libc.math cimport sin, cos, acos, exp, sqrt, fabs, M_PI, abs
41376  * from mpi4py import MPI
41377  * from proteus.Profiling import logEvent # <<<<<<<<<<<<<<
41378  *
41379  * def smoothNodesLaplace(double[:,:] nodeArray_,
41380  */
41381  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
41382  __Pyx_GOTREF(__pyx_t_2);
41383  __Pyx_INCREF(__pyx_n_s_logEvent);
41384  __Pyx_GIVEREF(__pyx_n_s_logEvent);
41385  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_logEvent);
41386  __pyx_t_1 = __Pyx_Import(__pyx_n_s_proteus_Profiling, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
41387  __Pyx_GOTREF(__pyx_t_1);
41388  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41389  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_logEvent); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
41390  __Pyx_GOTREF(__pyx_t_2);
41391  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logEvent, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
41392  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
41393  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41394 
41395  /* "mprans/MeshSmoothing.pyx":19
41396  * bool simultaneous=False,
41397  * bool smoothBoundaries=True,
41398  * int[:] fixedNodesBoolArray=None, # <<<<<<<<<<<<<<
41399  * double alpha=0.):
41400  * """
41401  */
41402  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 19, __pyx_L1_error)
41403  __pyx_k_ = __pyx_t_3;
41404  __pyx_t_3.memview = NULL;
41405  __pyx_t_3.data = NULL;
41406 
41407  /* "mprans/MeshSmoothing.pyx":11
41408  * from proteus.Profiling import logEvent
41409  *
41410  * def smoothNodesLaplace(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
41411  * int[:] nodeStarOffsets,
41412  * int[:] nodeStarArray,
41413  */
41414  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_1smoothNodesLaplace, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
41415  __Pyx_GOTREF(__pyx_t_1);
41416  if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothNodesLaplace, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
41417  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41418 
41419  /* "mprans/MeshSmoothing.pyx":74
41420  * bool simultaneous=True,
41421  * bool smoothBoundaries=True,
41422  * int[:] fixedNodesBoolArray=None, # <<<<<<<<<<<<<<
41423  * double alpha=0.):
41424  * """
41425  */
41426  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 74, __pyx_L1_error)
41427  __pyx_k__2 = __pyx_t_3;
41428  __pyx_t_3.memview = NULL;
41429  __pyx_t_3.data = NULL;
41430 
41431  /* "mprans/MeshSmoothing.pyx":64
41432  * alpha=alpha)
41433  *
41434  * def smoothNodesCentroid(double[:,:] nodeArray_, # <<<<<<<<<<<<<<
41435  * int[:] nodeElementOffsets,
41436  * int[:] nodeElementsArray,
41437  */
41438  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_3smoothNodesCentroid, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
41439  __Pyx_GOTREF(__pyx_t_1);
41440  if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothNodesCentroid, __pyx_t_1) < 0) __PYX_ERR(0, 64, __pyx_L1_error)
41441  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41442 
41443  /* "mprans/MeshSmoothing.pyx":127
41444  * alpha=alpha)
41445  *
41446  * def updateDilationElements(double[:] elementDilationArray_, # <<<<<<<<<<<<<<
41447  * double[:] elementVolumeArray,
41448  * double[:] elementVolumeTargetArray,
41449  */
41450  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_5updateDilationElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error)
41451  __Pyx_GOTREF(__pyx_t_1);
41452  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateDilationElements, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error)
41453  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41454 
41455  /* "mprans/MeshSmoothing.pyx":136
41456  * nElements=nElements)
41457  *
41458  * def getDilationElements(double[:] elementVolumeArray, # <<<<<<<<<<<<<<
41459  * double[:] elementVolumeTargetArray):
41460  * cdef int nElements = len(elementVolumeArray)
41461  */
41462  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_7getDilationElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
41463  __Pyx_GOTREF(__pyx_t_1);
41464  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getDilationElements, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
41465  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41466 
41467  /* "mprans/MeshSmoothing.pyx":146
41468  * return elementDilationArray_
41469  *
41470  * def updateDistortionElements(double[:] elementDistortionArray_, # <<<<<<<<<<<<<<
41471  * double[:,:,:,:] J_array,
41472  * double[:,:] detJ_array,
41473  */
41474  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_9updateDistortionElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
41475  __Pyx_GOTREF(__pyx_t_1);
41476  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateDistortionElements, __pyx_t_1) < 0) __PYX_ERR(0, 146, __pyx_L1_error)
41477  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41478 
41479  /* "mprans/MeshSmoothing.pyx":157
41480  * nElements=nElements)
41481  *
41482  * def getDistortionElements(double[:,:,:,:] J_array, # <<<<<<<<<<<<<<
41483  * double[:,:] detJ_array,
41484  * int nd):
41485  */
41486  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_11getDistortionElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
41487  __Pyx_GOTREF(__pyx_t_1);
41488  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getDistortionElements, __pyx_t_1) < 0) __PYX_ERR(0, 157, __pyx_L1_error)
41489  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41490 
41491  /* "mprans/MeshSmoothing.pyx":169
41492  * return elementDistortionArray_
41493  *
41494  * def updateInverseMeanRatioTriangleElements(double[:] IMRElementsArray_, # <<<<<<<<<<<<<<
41495  * double[:,:] nodeArray,
41496  * int[:,:] elementNodesArray,
41497  */
41498  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_13updateInverseMeanRatioTriangleElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error)
41499  __Pyx_GOTREF(__pyx_t_1);
41500  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateInverseMeanRatioTriangleEl, __pyx_t_1) < 0) __PYX_ERR(0, 169, __pyx_L1_error)
41501  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41502 
41503  /* "mprans/MeshSmoothing.pyx":178
41504  * nElements=nElements)
41505  *
41506  * def getInverseMeanRatioTriangleElements(double[:,:] nodeArray, # <<<<<<<<<<<<<<
41507  * int[:,:] elementNodesArray):
41508  * cdef int nElements = len(elementNodesArray)
41509  */
41510  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_15getInverseMeanRatioTriangleElements, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
41511  __Pyx_GOTREF(__pyx_t_1);
41512  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getInverseMeanRatioTriangleEleme, __pyx_t_1) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
41513  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41514 
41515  /* "mprans/MeshSmoothing.pyx":188
41516  * return IMRElementsArray_
41517  *
41518  * def updateInverseMeanRatioTriangleNodes(double[:] IMRNodesArray_, # <<<<<<<<<<<<<<
41519  * double[:,:] nodeArray,
41520  * int[:,:] elementNodesArray,
41521  */
41522  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_17updateInverseMeanRatioTriangleNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error)
41523  __Pyx_GOTREF(__pyx_t_1);
41524  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateInverseMeanRatioTriangleNo, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error)
41525  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41526 
41527  /* "mprans/MeshSmoothing.pyx":205
41528  * nElements=nElements)
41529  *
41530  * def getInverseMeanRatioTriangleNodes(double[:,:] nodeArray, # <<<<<<<<<<<<<<
41531  * int[:,:] elementNodesArray,
41532  * int[:] nodeElementOffsets,
41533  */
41534  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_19getInverseMeanRatioTriangleNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error)
41535  __Pyx_GOTREF(__pyx_t_1);
41536  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getInverseMeanRatioTriangleNodes, __pyx_t_1) < 0) __PYX_ERR(0, 205, __pyx_L1_error)
41537  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41538 
41539  /* "mprans/MeshSmoothing.pyx":223
41540  * return IMRNodesArray_
41541  *
41542  * def getInverseMeanRatioSingleTriangle(int node0, # <<<<<<<<<<<<<<
41543  * double[:,:] nodeArray,
41544  * int[:,:] elementNodesArray,
41545  */
41546  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_21getInverseMeanRatioSingleTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
41547  __Pyx_GOTREF(__pyx_t_1);
41548  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getInverseMeanRatioSingleTriangl, __pyx_t_1) < 0) __PYX_ERR(0, 223, __pyx_L1_error)
41549  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41550 
41551  /* "mprans/MeshSmoothing.pyx":234
41552  * nodeElementsArray=nodeElementsArray)
41553  *
41554  * def smoothNodesQuality(double[:] distortion, # <<<<<<<<<<<<<<
41555  * double[:] dilation,
41556  * double[:,:] nodeArray,
41557  */
41558  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_23smoothNodesQuality, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
41559  __Pyx_GOTREF(__pyx_t_1);
41560  if (PyDict_SetItem(__pyx_d, __pyx_n_s_smoothNodesQuality, __pyx_t_1) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
41561  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41562 
41563  /* "mprans/MeshSmoothing.pyx":254
41564  * apply_directly=False)
41565  *
41566  * def getLocalNearestNode(double[:] coords, # <<<<<<<<<<<<<<
41567  * double[:,:] nodeArray,
41568  * int[:] nodeStarOffsets,
41569  */
41570  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_25getLocalNearestNode, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error)
41571  __Pyx_GOTREF(__pyx_t_1);
41572  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestNode, __pyx_t_1) < 0) __PYX_ERR(0, 254, __pyx_L1_error)
41573  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41574 
41575  /* "mprans/MeshSmoothing.pyx":285
41576  * node)
41577  *
41578  * def getLocalNearestElement(double[:] coords, # <<<<<<<<<<<<<<
41579  * double[:,:] elementBarycentersArray,
41580  * int[:,:] elementNeighborsArray,
41581  */
41582  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_27getLocalNearestElement, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error)
41583  __Pyx_GOTREF(__pyx_t_1);
41584  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestElement, __pyx_t_1) < 0) __PYX_ERR(0, 285, __pyx_L1_error)
41585  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41586 
41587  /* "mprans/MeshSmoothing.pyx":312
41588  * eN)
41589  *
41590  * def getLocalNearestElementAroundNode(double[:] coords, # <<<<<<<<<<<<<<
41591  * int[:] nodeElementOffsets,
41592  * int[:] nodeElementsArray,
41593  */
41594  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_29getLocalNearestElementAroundNode, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
41595  __Pyx_GOTREF(__pyx_t_1);
41596  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestElementAroundNode, __pyx_t_1) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
41597  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41598 
41599  /* "mprans/MeshSmoothing.pyx":343
41600  * node=node)
41601  *
41602  * def getLocalNearestElementIntersection(double[:] coords, # <<<<<<<<<<<<<<
41603  * double[:] starting_coords,
41604  * double[:,:,:] elementBoundaryNormalsArray,
41605  */
41606  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_31getLocalNearestElementIntersection, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error)
41607  __Pyx_GOTREF(__pyx_t_1);
41608  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalNearestElementIntersecti, __pyx_t_1) < 0) __PYX_ERR(0, 343, __pyx_L1_error)
41609  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41610 
41611  /* "mprans/MeshSmoothing.pyx":388
41612  * eN=eN)
41613  *
41614  * def getLocalElement(femSpace, # <<<<<<<<<<<<<<
41615  * coords,
41616  * node):
41617  */
41618  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_33getLocalElement, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
41619  __Pyx_GOTREF(__pyx_t_1);
41620  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getLocalElement, __pyx_t_1) < 0) __PYX_ERR(0, 388, __pyx_L1_error)
41621  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41622 
41623  /* "mprans/MeshSmoothing.pyx":452
41624  *
41625  *
41626  * def updateElementBoundaryNormalsTriangle(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
41627  * double[:,:] nodeArray,
41628  * int[:,:] elementBoundariesArray,
41629  */
41630  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_35updateElementBoundaryNormalsTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 452, __pyx_L1_error)
41631  __Pyx_GOTREF(__pyx_t_1);
41632  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementBoundaryNormalsTria, __pyx_t_1) < 0) __PYX_ERR(0, 452, __pyx_L1_error)
41633  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41634 
41635  /* "mprans/MeshSmoothing.pyx":467
41636  * nElements=nElements)
41637  *
41638  * def getElementBoundaryNormalsTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
41639  * int[:,:] elementBoundariesArray,
41640  * int[:,:] elementBoundaryNodesArray,
41641  */
41642  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_37getElementBoundaryNormalsTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error)
41643  __Pyx_GOTREF(__pyx_t_1);
41644  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getElementBoundaryNormalsTriangl, __pyx_t_1) < 0) __PYX_ERR(0, 467, __pyx_L1_error)
41645  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41646 
41647  /* "mprans/MeshSmoothing.pyx":483
41648  * return elementBoundaryNormalsArray_
41649  *
41650  * def updateElementBoundaryNormalsTetra(double[:,:,:] elementBoundaryNormalsArray_, # <<<<<<<<<<<<<<
41651  * double[:,:] nodeArray,
41652  * int[:,:] elementBoundariesArray,
41653  */
41654  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_39updateElementBoundaryNormalsTetra, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error)
41655  __Pyx_GOTREF(__pyx_t_1);
41656  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementBoundaryNormalsTetr, __pyx_t_1) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
41657  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41658 
41659  /* "mprans/MeshSmoothing.pyx":498
41660  * nElements=nElements)
41661  *
41662  * def getElementBoundaryNormalsTetra(double[:,:] nodeArray, # <<<<<<<<<<<<<<
41663  * int[:,:] elementBoundariesArray,
41664  * int[:,:] elementBoundaryNodesArray,
41665  */
41666  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_41getElementBoundaryNormalsTetra, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error)
41667  __Pyx_GOTREF(__pyx_t_1);
41668  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getElementBoundaryNormalsTetra, __pyx_t_1) < 0) __PYX_ERR(0, 498, __pyx_L1_error)
41669  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41670 
41671  /* "mprans/MeshSmoothing.pyx":514
41672  * return elementBoundaryNormalsArray_
41673  *
41674  * def updateElementVolumesTriangle(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
41675  * int[:,:] elementNodesArray,
41676  * double[:,:] nodeArray,
41677  */
41678  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_43updateElementVolumesTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error)
41679  __Pyx_GOTREF(__pyx_t_1);
41680  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementVolumesTriangle, __pyx_t_1) < 0) __PYX_ERR(0, 514, __pyx_L1_error)
41681  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41682 
41683  /* "mprans/MeshSmoothing.pyx":523
41684  * nElements=nElements)
41685  *
41686  * def getElementVolumeTriangle(double[:] nA, # <<<<<<<<<<<<<<
41687  * double[:] nB,
41688  * double[:] nC):
41689  */
41690  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_45getElementVolumeTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 523, __pyx_L1_error)
41691  __Pyx_GOTREF(__pyx_t_1);
41692  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getElementVolumeTriangle, __pyx_t_1) < 0) __PYX_ERR(0, 523, __pyx_L1_error)
41693  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41694 
41695  /* "mprans/MeshSmoothing.pyx":530
41696  * nC=nC)
41697  *
41698  * def updateElementVolumesTetra(double[:] elementVolumesArray_, # <<<<<<<<<<<<<<
41699  * int[:,:] elementNodesArray,
41700  * double[:,:] nodeArray,
41701  */
41702  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_47updateElementVolumesTetra, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __pyx_L1_error)
41703  __Pyx_GOTREF(__pyx_t_1);
41704  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementVolumesTetra, __pyx_t_1) < 0) __PYX_ERR(0, 530, __pyx_L1_error)
41705  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41706 
41707  /* "mprans/MeshSmoothing.pyx":539
41708  * nElements=nElements)
41709  *
41710  * def updateElementBarycenters(double[:,:] elementBarycentersArray_, # <<<<<<<<<<<<<<
41711  * int[:,:] elementNodesArray,
41712  * double[:,:] nodeArray,
41713  */
41714  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_49updateElementBarycenters, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error)
41715  __Pyx_GOTREF(__pyx_t_1);
41716  if (PyDict_SetItem(__pyx_d, __pyx_n_s_updateElementBarycenters, __pyx_t_1) < 0) __PYX_ERR(0, 539, __pyx_L1_error)
41717  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41718 
41719  /* "mprans/MeshSmoothing.pyx":548
41720  * nElements=nElements)
41721  *
41722  * def getCornerNodesTriangle(double[:,:] nodeArray, # <<<<<<<<<<<<<<
41723  * int[:] nodeStarArray,
41724  * int[:] nodeStarOffsets,
41725  */
41726  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_51getCornerNodesTriangle, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
41727  __Pyx_GOTREF(__pyx_t_1);
41728  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCornerNodesTriangle, __pyx_t_1) < 0) __PYX_ERR(0, 548, __pyx_L1_error)
41729  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41730 
41731  /* "mprans/MeshSmoothing.pyx":559
41732  * nNodes=nNodes)
41733  *
41734  * def getNonOwnedNodeValues(args_, # <<<<<<<<<<<<<<
41735  * int nNodes_owned,
41736  * int nNodes_global,
41737  */
41738  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_53getNonOwnedNodeValues, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
41739  __Pyx_GOTREF(__pyx_t_1);
41740  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getNonOwnedNodeValues, __pyx_t_1) < 0) __PYX_ERR(0, 559, __pyx_L1_error)
41741  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41742 
41743  /* "mprans/MeshSmoothing.pyx":690
41744  * # nproc=str(comm_size)))
41745  *
41746  * def checkOwnedVariable(int variable_nb_local, # <<<<<<<<<<<<<<
41747  * int rank,
41748  * int nVariables_owned,
41749  */
41750  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_55checkOwnedVariable, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 690, __pyx_L1_error)
41751  __Pyx_GOTREF(__pyx_t_1);
41752  if (PyDict_SetItem(__pyx_d, __pyx_n_s_checkOwnedVariable, __pyx_t_1) < 0) __PYX_ERR(0, 690, __pyx_L1_error)
41753  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41754 
41755  /* "mprans/MeshSmoothing.pyx":701
41756  * variableOffsets_subdomain_owned=variableOffsets_subdomain_owned)
41757  *
41758  * def pyScalarRecoveryAtNodes(double[:] scalars, # <<<<<<<<<<<<<<
41759  * int[:] nodeElementsArray,
41760  * int[:] nodeElementOffsets):
41761  */
41762  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_57pyScalarRecoveryAtNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 701, __pyx_L1_error)
41763  __Pyx_GOTREF(__pyx_t_1);
41764  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyScalarRecoveryAtNodes, __pyx_t_1) < 0) __PYX_ERR(0, 701, __pyx_L1_error)
41765  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41766 
41767  /* "mprans/MeshSmoothing.pyx":708
41768  * nodeElementOffsets=nodeElementOffsets)
41769  *
41770  * def pyScalarRecoveryAtNodesWeighted(double[:] scalars, # <<<<<<<<<<<<<<
41771  * int[:] nodeElementsArray,
41772  * int[:] nodeElementOffsets,
41773  */
41774  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_59pyScalarRecoveryAtNodesWeighted, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 708, __pyx_L1_error)
41775  __Pyx_GOTREF(__pyx_t_1);
41776  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyScalarRecoveryAtNodesWeighted, __pyx_t_1) < 0) __PYX_ERR(0, 708, __pyx_L1_error)
41777  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41778 
41779  /* "mprans/MeshSmoothing.pyx":719
41780  * nNodes=nNodes)
41781  *
41782  * def pyVectorRecoveryAtNodes(vectors, # <<<<<<<<<<<<<<
41783  * nodeElementsArray,
41784  * nodeElementOffsets,
41785  */
41786  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_61pyVectorRecoveryAtNodes, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 719, __pyx_L1_error)
41787  __Pyx_GOTREF(__pyx_t_1);
41788  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyVectorRecoveryAtNodes, __pyx_t_1) < 0) __PYX_ERR(0, 719, __pyx_L1_error)
41789  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41790 
41791  /* "mprans/MeshSmoothing.pyx":728
41792  * nd=nd)
41793  *
41794  * def pyVectorRecoveryAtNodesWeighted(double[:,:] vectors, # <<<<<<<<<<<<<<
41795  * int[:] nodeElementsArray,
41796  * int[:] nodeElementOffsets,
41797  */
41798  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6mprans_13MeshSmoothing_63pyVectorRecoveryAtNodesWeighted, NULL, __pyx_n_s_mprans_MeshSmoothing); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error)
41799  __Pyx_GOTREF(__pyx_t_1);
41800  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyVectorRecoveryAtNodesWeighted, __pyx_t_1) < 0) __PYX_ERR(0, 728, __pyx_L1_error)
41801  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41802 
41803  /* "mprans/MeshSmoothing.pyx":749
41804  * bool simultaneous=False,
41805  * bool smoothBoundaries=True,
41806  * int[:] fixedNodesBoolArray=None, # <<<<<<<<<<<<<<
41807  * double alpha=0.):
41808  * cdef double[:,:] nodeArray0
41809  */
41810  __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(Py_None, PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 749, __pyx_L1_error)
41811  __pyx_k__5 = __pyx_t_3;
41812  __pyx_t_3.memview = NULL;
41813  __pyx_t_3.data = NULL;
41814 
41815  /* "mprans/MeshSmoothing.pyx":1
41816  * #!python # <<<<<<<<<<<<<<
41817  * #cython: wraparound=True, boundscheck=False, initializedcheck=False, cdivision=True
41818  *
41819  */
41820  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
41821  __Pyx_GOTREF(__pyx_t_1);
41822  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
41823  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41824 
41825  /* "View.MemoryView":209
41826  * info.obj = self
41827  *
41828  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
41829  *
41830  * def __dealloc__(array self):
41831  */
41832  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error)
41833  __Pyx_GOTREF(__pyx_t_1);
41834  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
41835  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41836  PyType_Modified(__pyx_array_type);
41837 
41838  /* "View.MemoryView":286
41839  * return self.name
41840  *
41841  * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
41842  * cdef strided = Enum("<strided and direct>") # default
41843  * cdef indirect = Enum("<strided and indirect>")
41844  */
41845  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__96, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
41846  __Pyx_GOTREF(__pyx_t_1);
41847  __Pyx_XGOTREF(generic);
41848  __Pyx_DECREF_SET(generic, __pyx_t_1);
41849  __Pyx_GIVEREF(__pyx_t_1);
41850  __pyx_t_1 = 0;
41851 
41852  /* "View.MemoryView":287
41853  *
41854  * cdef generic = Enum("<strided and direct or indirect>")
41855  * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
41856  * cdef indirect = Enum("<strided and indirect>")
41857  *
41858  */
41859  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
41860  __Pyx_GOTREF(__pyx_t_1);
41861  __Pyx_XGOTREF(strided);
41862  __Pyx_DECREF_SET(strided, __pyx_t_1);
41863  __Pyx_GIVEREF(__pyx_t_1);
41864  __pyx_t_1 = 0;
41865 
41866  /* "View.MemoryView":288
41867  * cdef generic = Enum("<strided and direct or indirect>")
41868  * cdef strided = Enum("<strided and direct>") # default
41869  * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
41870  *
41871  *
41872  */
41873  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__98, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
41874  __Pyx_GOTREF(__pyx_t_1);
41875  __Pyx_XGOTREF(indirect);
41876  __Pyx_DECREF_SET(indirect, __pyx_t_1);
41877  __Pyx_GIVEREF(__pyx_t_1);
41878  __pyx_t_1 = 0;
41879 
41880  /* "View.MemoryView":291
41881  *
41882  *
41883  * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
41884  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
41885  *
41886  */
41887  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
41888  __Pyx_GOTREF(__pyx_t_1);
41889  __Pyx_XGOTREF(contiguous);
41890  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
41891  __Pyx_GIVEREF(__pyx_t_1);
41892  __pyx_t_1 = 0;
41893 
41894  /* "View.MemoryView":292
41895  *
41896  * cdef contiguous = Enum("<contiguous and direct>")
41897  * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
41898  *
41899  *
41900  */
41901  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__100, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
41902  __Pyx_GOTREF(__pyx_t_1);
41903  __Pyx_XGOTREF(indirect_contiguous);
41904  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
41905  __Pyx_GIVEREF(__pyx_t_1);
41906  __pyx_t_1 = 0;
41907 
41908  /* "View.MemoryView":316
41909  *
41910  * DEF THREAD_LOCKS_PREALLOCATED = 8
41911  * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
41912  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
41913  * PyThread_allocate_lock(),
41914  */
41915  __pyx_memoryview_thread_locks_used = 0;
41916 
41917  /* "View.MemoryView":317
41918  * DEF THREAD_LOCKS_PREALLOCATED = 8
41919  * cdef int __pyx_memoryview_thread_locks_used = 0
41920  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
41921  * PyThread_allocate_lock(),
41922  * PyThread_allocate_lock(),
41923  */
41924  __pyx_t_4[0] = PyThread_allocate_lock();
41925  __pyx_t_4[1] = PyThread_allocate_lock();
41926  __pyx_t_4[2] = PyThread_allocate_lock();
41927  __pyx_t_4[3] = PyThread_allocate_lock();
41928  __pyx_t_4[4] = PyThread_allocate_lock();
41929  __pyx_t_4[5] = PyThread_allocate_lock();
41930  __pyx_t_4[6] = PyThread_allocate_lock();
41931  __pyx_t_4[7] = PyThread_allocate_lock();
41932  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
41933 
41934  /* "View.MemoryView":549
41935  * info.obj = self
41936  *
41937  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
41938  *
41939  *
41940  */
41941  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error)
41942  __Pyx_GOTREF(__pyx_t_1);
41943  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
41944  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41945  PyType_Modified(__pyx_memoryview_type);
41946 
41947  /* "View.MemoryView":995
41948  * return self.from_object
41949  *
41950  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
41951  *
41952  *
41953  */
41954  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error)
41955  __Pyx_GOTREF(__pyx_t_1);
41956  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
41957  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41958  PyType_Modified(__pyx_memoryviewslice_type);
41959 
41960  /* "(tree fragment)":1
41961  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
41962  * cdef object __pyx_PickleError
41963  * cdef object __pyx_result
41964  */
41965  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
41966  __Pyx_GOTREF(__pyx_t_1);
41967  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
41968  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
41969 
41970  /* "BufferFormatFromTypeInfo":1463
41971  *
41972  * @cname('__pyx_format_from_typeinfo')
41973  * cdef bytes format_from_typeinfo(__Pyx_TypeInfo *type): # <<<<<<<<<<<<<<
41974  * cdef __Pyx_StructField *field
41975  * cdef __pyx_typeinfo_string fmt
41976  */
41977 
41978  /*--- Wrapped vars code ---*/
41979 
41980  goto __pyx_L0;
41981  __pyx_L1_error:;
41982  __Pyx_XDECREF(__pyx_t_1);
41983  __Pyx_XDECREF(__pyx_t_2);
41984  __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
41985  if (__pyx_m) {
41986  if (__pyx_d) {
41987  __Pyx_AddTraceback("init mprans.MeshSmoothing", __pyx_clineno, __pyx_lineno, __pyx_filename);
41988  }
41989  Py_CLEAR(__pyx_m);
41990  } else if (!PyErr_Occurred()) {
41991  PyErr_SetString(PyExc_ImportError, "init mprans.MeshSmoothing");
41992  }
41993  __pyx_L0:;
41994  __Pyx_RefNannyFinishContext();
41995  #if CYTHON_PEP489_MULTI_PHASE_INIT
41996  return (__pyx_m != NULL) ? 0 : -1;
41997  #elif PY_MAJOR_VERSION >= 3
41998  return __pyx_m;
41999  #else
42000  return;
42001  #endif
42002 }
42003 
42004 /* --- Runtime support code --- */
42005 /* Refnanny */
42006 #if CYTHON_REFNANNY
42007 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
42008  PyObject *m = NULL, *p = NULL;
42009  void *r = NULL;
42010  m = PyImport_ImportModule(modname);
42011  if (!m) goto end;
42012  p = PyObject_GetAttrString(m, "RefNannyAPI");
42013  if (!p) goto end;
42014  r = PyLong_AsVoidPtr(p);
42015 end:
42016  Py_XDECREF(p);
42017  Py_XDECREF(m);
42018  return (__Pyx_RefNannyAPIStruct *)r;
42019 }
42020 #endif
42021 
42022 /* PyObjectGetAttrStr */
42023 #if CYTHON_USE_TYPE_SLOTS
42024 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
42025  PyTypeObject* tp = Py_TYPE(obj);
42026  if (likely(tp->tp_getattro))
42027  return tp->tp_getattro(obj, attr_name);
42028 #if PY_MAJOR_VERSION < 3
42029  if (likely(tp->tp_getattr))
42030  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
42031 #endif
42032  return PyObject_GetAttr(obj, attr_name);
42033 }
42034 #endif
42035 
42036 /* GetBuiltinName */
42037 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
42038  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
42039  if (unlikely(!result)) {
42040  PyErr_Format(PyExc_NameError,
42041 #if PY_MAJOR_VERSION >= 3
42042  "name '%U' is not defined", name);
42043 #else
42044  "name '%.200s' is not defined", PyString_AS_STRING(name));
42045 #endif
42046  }
42047  return result;
42048 }
42049 
42050 /* RaiseArgTupleInvalid */
42051 static void __Pyx_RaiseArgtupleInvalid(
42052  const char* func_name,
42053  int exact,
42054  Py_ssize_t num_min,
42055  Py_ssize_t num_max,
42056  Py_ssize_t num_found)
42057 {
42058  Py_ssize_t num_expected;
42059  const char *more_or_less;
42060  if (num_found < num_min) {
42061  num_expected = num_min;
42062  more_or_less = "at least";
42063  } else {
42064  num_expected = num_max;
42065  more_or_less = "at most";
42066  }
42067  if (exact) {
42068  more_or_less = "exactly";
42069  }
42070  PyErr_Format(PyExc_TypeError,
42071  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
42072  func_name, more_or_less, num_expected,
42073  (num_expected == 1) ? "" : "s", num_found);
42074 }
42075 
42076 /* RaiseDoubleKeywords */
42077 static void __Pyx_RaiseDoubleKeywordsError(
42078  const char* func_name,
42079  PyObject* kw_name)
42080 {
42081  PyErr_Format(PyExc_TypeError,
42082  #if PY_MAJOR_VERSION >= 3
42083  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
42084  #else
42085  "%s() got multiple values for keyword argument '%s'", func_name,
42086  PyString_AsString(kw_name));
42087  #endif
42088 }
42089 
42090 /* ParseKeywords */
42091 static int __Pyx_ParseOptionalKeywords(
42092  PyObject *kwds,
42093  PyObject **argnames[],
42094  PyObject *kwds2,
42095  PyObject *values[],
42096  Py_ssize_t num_pos_args,
42097  const char* function_name)
42098 {
42099  PyObject *key = 0, *value = 0;
42100  Py_ssize_t pos = 0;
42101  PyObject*** name;
42102  PyObject*** first_kw_arg = argnames + num_pos_args;
42103  while (PyDict_Next(kwds, &pos, &key, &value)) {
42104  name = first_kw_arg;
42105  while (*name && (**name != key)) name++;
42106  if (*name) {
42107  values[name-argnames] = value;
42108  continue;
42109  }
42110  name = first_kw_arg;
42111  #if PY_MAJOR_VERSION < 3
42112  if (likely(PyString_Check(key))) {
42113  while (*name) {
42114  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
42115  && _PyString_Eq(**name, key)) {
42116  values[name-argnames] = value;
42117  break;
42118  }
42119  name++;
42120  }
42121  if (*name) continue;
42122  else {
42123  PyObject*** argname = argnames;
42124  while (argname != first_kw_arg) {
42125  if ((**argname == key) || (
42126  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
42127  && _PyString_Eq(**argname, key))) {
42128  goto arg_passed_twice;
42129  }
42130  argname++;
42131  }
42132  }
42133  } else
42134  #endif
42135  if (likely(PyUnicode_Check(key))) {
42136  while (*name) {
42137  int cmp = (**name == key) ? 0 :
42138  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
42139  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
42140  #endif
42141  PyUnicode_Compare(**name, key);
42142  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
42143  if (cmp == 0) {
42144  values[name-argnames] = value;
42145  break;
42146  }
42147  name++;
42148  }
42149  if (*name) continue;
42150  else {
42151  PyObject*** argname = argnames;
42152  while (argname != first_kw_arg) {
42153  int cmp = (**argname == key) ? 0 :
42154  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
42155  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
42156  #endif
42157  PyUnicode_Compare(**argname, key);
42158  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
42159  if (cmp == 0) goto arg_passed_twice;
42160  argname++;
42161  }
42162  }
42163  } else
42164  goto invalid_keyword_type;
42165  if (kwds2) {
42166  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
42167  } else {
42168  goto invalid_keyword;
42169  }
42170  }
42171  return 0;
42172 arg_passed_twice:
42173  __Pyx_RaiseDoubleKeywordsError(function_name, key);
42174  goto bad;
42175 invalid_keyword_type:
42176  PyErr_Format(PyExc_TypeError,
42177  "%.200s() keywords must be strings", function_name);
42178  goto bad;
42179 invalid_keyword:
42180  PyErr_Format(PyExc_TypeError,
42181  #if PY_MAJOR_VERSION < 3
42182  "%.200s() got an unexpected keyword argument '%.200s'",
42183  function_name, PyString_AsString(key));
42184  #else
42185  "%s() got an unexpected keyword argument '%U'",
42186  function_name, key);
42187  #endif
42188 bad:
42189  return -1;
42190 }
42191 
42192 /* MemviewSliceInit */
42193 static int
42194 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
42195  int ndim,
42196  __Pyx_memviewslice *memviewslice,
42197  int memview_is_new_reference)
42198 {
42199  __Pyx_RefNannyDeclarations
42200  int i, retval=-1;
42201  Py_buffer *buf = &memview->view;
42202  __Pyx_RefNannySetupContext("init_memviewslice", 0);
42203  if (unlikely(memviewslice->memview || memviewslice->data)) {
42204  PyErr_SetString(PyExc_ValueError,
42205  "memviewslice is already initialized!");
42206  goto fail;
42207  }
42208  if (buf->strides) {
42209  for (i = 0; i < ndim; i++) {
42210  memviewslice->strides[i] = buf->strides[i];
42211  }
42212  } else {
42213  Py_ssize_t stride = buf->itemsize;
42214  for (i = ndim - 1; i >= 0; i--) {
42215  memviewslice->strides[i] = stride;
42216  stride *= buf->shape[i];
42217  }
42218  }
42219  for (i = 0; i < ndim; i++) {
42220  memviewslice->shape[i] = buf->shape[i];
42221  if (buf->suboffsets) {
42222  memviewslice->suboffsets[i] = buf->suboffsets[i];
42223  } else {
42224  memviewslice->suboffsets[i] = -1;
42225  }
42226  }
42227  memviewslice->memview = memview;
42228  memviewslice->data = (char *)buf->buf;
42229  if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
42230  Py_INCREF(memview);
42231  }
42232  retval = 0;
42233  goto no_fail;
42234 fail:
42235  memviewslice->memview = 0;
42236  memviewslice->data = 0;
42237  retval = -1;
42238 no_fail:
42239  __Pyx_RefNannyFinishContext();
42240  return retval;
42241 }
42242 #ifndef Py_NO_RETURN
42243 #define Py_NO_RETURN
42244 #endif
42245 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
42246  va_list vargs;
42247  char msg[200];
42248 #ifdef HAVE_STDARG_PROTOTYPES
42249  va_start(vargs, fmt);
42250 #else
42251  va_start(vargs);
42252 #endif
42253  vsnprintf(msg, 200, fmt, vargs);
42254  va_end(vargs);
42255  Py_FatalError(msg);
42256 }
42257 static CYTHON_INLINE int
42258 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
42259  PyThread_type_lock lock)
42260 {
42261  int result;
42262  PyThread_acquire_lock(lock, 1);
42263  result = (*acquisition_count)++;
42264  PyThread_release_lock(lock);
42265  return result;
42266 }
42267 static CYTHON_INLINE int
42268 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
42269  PyThread_type_lock lock)
42270 {
42271  int result;
42272  PyThread_acquire_lock(lock, 1);
42273  result = (*acquisition_count)--;
42274  PyThread_release_lock(lock);
42275  return result;
42276 }
42277 static CYTHON_INLINE void
42278 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
42279 {
42280  int first_time;
42281  struct __pyx_memoryview_obj *memview = memslice->memview;
42282  if (unlikely(!memview || (PyObject *) memview == Py_None))
42283  return;
42284  if (unlikely(__pyx_get_slice_count(memview) < 0))
42285  __pyx_fatalerror("Acquisition count is %d (line %d)",
42286  __pyx_get_slice_count(memview), lineno);
42287  first_time = __pyx_add_acquisition_count(memview) == 0;
42288  if (unlikely(first_time)) {
42289  if (have_gil) {
42290  Py_INCREF((PyObject *) memview);
42291  } else {
42292  PyGILState_STATE _gilstate = PyGILState_Ensure();
42293  Py_INCREF((PyObject *) memview);
42294  PyGILState_Release(_gilstate);
42295  }
42296  }
42297 }
42298 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
42299  int have_gil, int lineno) {
42300  int last_time;
42301  struct __pyx_memoryview_obj *memview = memslice->memview;
42302  if (unlikely(!memview || (PyObject *) memview == Py_None)) {
42303  memslice->memview = NULL;
42304  return;
42305  }
42306  if (unlikely(__pyx_get_slice_count(memview) <= 0))
42307  __pyx_fatalerror("Acquisition count is %d (line %d)",
42308  __pyx_get_slice_count(memview), lineno);
42309  last_time = __pyx_sub_acquisition_count(memview) == 1;
42310  memslice->data = NULL;
42311  if (unlikely(last_time)) {
42312  if (have_gil) {
42313  Py_CLEAR(memslice->memview);
42314  } else {
42315  PyGILState_STATE _gilstate = PyGILState_Ensure();
42316  Py_CLEAR(memslice->memview);
42317  PyGILState_Release(_gilstate);
42318  }
42319  } else {
42320  memslice->memview = NULL;
42321  }
42322 }
42323 
42324 /* PyDictVersioning */
42325 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
42326 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
42327  PyObject *dict = Py_TYPE(obj)->tp_dict;
42328  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
42329 }
42330 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
42331  PyObject **dictptr = NULL;
42332  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
42333  if (offset) {
42334 #if CYTHON_COMPILING_IN_CPYTHON
42335  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
42336 #else
42337  dictptr = _PyObject_GetDictPtr(obj);
42338 #endif
42339  }
42340  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
42341 }
42342 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
42343  PyObject *dict = Py_TYPE(obj)->tp_dict;
42344  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
42345  return 0;
42346  return obj_dict_version == __Pyx_get_object_dict_version(obj);
42347 }
42348 #endif
42349 
42350 /* GetModuleGlobalName */
42351 #if CYTHON_USE_DICT_VERSIONS
42352 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
42353 #else
42354 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
42355 #endif
42356 {
42357  PyObject *result;
42358 #if !CYTHON_AVOID_BORROWED_REFS
42359 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
42360  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
42361  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
42362  if (likely(result)) {
42363  return __Pyx_NewRef(result);
42364  } else if (unlikely(PyErr_Occurred())) {
42365  return NULL;
42366  }
42367 #else
42368  result = PyDict_GetItem(__pyx_d, name);
42369  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
42370  if (likely(result)) {
42371  return __Pyx_NewRef(result);
42372  }
42373 #endif
42374 #else
42375  result = PyObject_GetItem(__pyx_d, name);
42376  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
42377  if (likely(result)) {
42378  return __Pyx_NewRef(result);
42379  }
42380  PyErr_Clear();
42381 #endif
42382  return __Pyx_GetBuiltinName(name);
42383 }
42384 
42385 /* PyCFunctionFastCall */
42386 #if CYTHON_FAST_PYCCALL
42387 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
42388  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
42389  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
42390  PyObject *self = PyCFunction_GET_SELF(func);
42391  int flags = PyCFunction_GET_FLAGS(func);
42392  assert(PyCFunction_Check(func));
42393  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
42394  assert(nargs >= 0);
42395  assert(nargs == 0 || args != NULL);
42396  /* _PyCFunction_FastCallDict() must not be called with an exception set,
42397  because it may clear it (directly or indirectly) and so the
42398  caller loses its exception */
42399  assert(!PyErr_Occurred());
42400  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
42401  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
42402  } else {
42403  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
42404  }
42405 }
42406 #endif
42407 
42408 /* PyFunctionFastCall */
42409 #if CYTHON_FAST_PYCALL
42410 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
42411  PyObject *globals) {
42412  PyFrameObject *f;
42413  PyThreadState *tstate = __Pyx_PyThreadState_Current;
42414  PyObject **fastlocals;
42415  Py_ssize_t i;
42416  PyObject *result;
42417  assert(globals != NULL);
42418  /* XXX Perhaps we should create a specialized
42419  PyFrame_New() that doesn't take locals, but does
42420  take builtins without sanity checking them.
42421  */
42422  assert(tstate != NULL);
42423  f = PyFrame_New(tstate, co, globals, NULL);
42424  if (f == NULL) {
42425  return NULL;
42426  }
42427  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
42428  for (i = 0; i < na; i++) {
42429  Py_INCREF(*args);
42430  fastlocals[i] = *args++;
42431  }
42432  result = PyEval_EvalFrameEx(f,0);
42433  ++tstate->recursion_depth;
42434  Py_DECREF(f);
42435  --tstate->recursion_depth;
42436  return result;
42437 }
42438 #if 1 || PY_VERSION_HEX < 0x030600B1
42439 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
42440  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
42441  PyObject *globals = PyFunction_GET_GLOBALS(func);
42442  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
42443  PyObject *closure;
42444 #if PY_MAJOR_VERSION >= 3
42445  PyObject *kwdefs;
42446 #endif
42447  PyObject *kwtuple, **k;
42448  PyObject **d;
42449  Py_ssize_t nd;
42450  Py_ssize_t nk;
42451  PyObject *result;
42452  assert(kwargs == NULL || PyDict_Check(kwargs));
42453  nk = kwargs ? PyDict_Size(kwargs) : 0;
42454  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
42455  return NULL;
42456  }
42457  if (
42458 #if PY_MAJOR_VERSION >= 3
42459  co->co_kwonlyargcount == 0 &&
42460 #endif
42461  likely(kwargs == NULL || nk == 0) &&
42462  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
42463  if (argdefs == NULL && co->co_argcount == nargs) {
42464  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
42465  goto done;
42466  }
42467  else if (nargs == 0 && argdefs != NULL
42468  && co->co_argcount == Py_SIZE(argdefs)) {
42469  /* function called with no arguments, but all parameters have
42470  a default value: use default values as arguments .*/
42471  args = &PyTuple_GET_ITEM(argdefs, 0);
42472  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
42473  goto done;
42474  }
42475  }
42476  if (kwargs != NULL) {
42477  Py_ssize_t pos, i;
42478  kwtuple = PyTuple_New(2 * nk);
42479  if (kwtuple == NULL) {
42480  result = NULL;
42481  goto done;
42482  }
42483  k = &PyTuple_GET_ITEM(kwtuple, 0);
42484  pos = i = 0;
42485  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
42486  Py_INCREF(k[i]);
42487  Py_INCREF(k[i+1]);
42488  i += 2;
42489  }
42490  nk = i / 2;
42491  }
42492  else {
42493  kwtuple = NULL;
42494  k = NULL;
42495  }
42496  closure = PyFunction_GET_CLOSURE(func);
42497 #if PY_MAJOR_VERSION >= 3
42498  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
42499 #endif
42500  if (argdefs != NULL) {
42501  d = &PyTuple_GET_ITEM(argdefs, 0);
42502  nd = Py_SIZE(argdefs);
42503  }
42504  else {
42505  d = NULL;
42506  nd = 0;
42507  }
42508 #if PY_MAJOR_VERSION >= 3
42509  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
42510  args, (int)nargs,
42511  k, (int)nk,
42512  d, (int)nd, kwdefs, closure);
42513 #else
42514  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
42515  args, (int)nargs,
42516  k, (int)nk,
42517  d, (int)nd, closure);
42518 #endif
42519  Py_XDECREF(kwtuple);
42520 done:
42521  Py_LeaveRecursiveCall();
42522  return result;
42523 }
42524 #endif
42525 #endif
42526 
42527 /* PyObjectCall */
42528 #if CYTHON_COMPILING_IN_CPYTHON
42529 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
42530  PyObject *result;
42531  ternaryfunc call = Py_TYPE(func)->tp_call;
42532  if (unlikely(!call))
42533  return PyObject_Call(func, arg, kw);
42534  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
42535  return NULL;
42536  result = (*call)(func, arg, kw);
42537  Py_LeaveRecursiveCall();
42538  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
42539  PyErr_SetString(
42540  PyExc_SystemError,
42541  "NULL result without error in PyObject_Call");
42542  }
42543  return result;
42544 }
42545 #endif
42546 
42547 /* PyObjectCall2Args */
42548 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
42549  PyObject *args, *result = NULL;
42550  #if CYTHON_FAST_PYCALL
42551  if (PyFunction_Check(function)) {
42552  PyObject *args[2] = {arg1, arg2};
42553  return __Pyx_PyFunction_FastCall(function, args, 2);
42554  }
42555  #endif
42556  #if CYTHON_FAST_PYCCALL
42557  if (__Pyx_PyFastCFunction_Check(function)) {
42558  PyObject *args[2] = {arg1, arg2};
42559  return __Pyx_PyCFunction_FastCall(function, args, 2);
42560  }
42561  #endif
42562  args = PyTuple_New(2);
42563  if (unlikely(!args)) goto done;
42564  Py_INCREF(arg1);
42565  PyTuple_SET_ITEM(args, 0, arg1);
42566  Py_INCREF(arg2);
42567  PyTuple_SET_ITEM(args, 1, arg2);
42568  Py_INCREF(function);
42569  result = __Pyx_PyObject_Call(function, args, NULL);
42570  Py_DECREF(args);
42571  Py_DECREF(function);
42572 done:
42573  return result;
42574 }
42575 
42576 /* PyObjectCallMethO */
42577 #if CYTHON_COMPILING_IN_CPYTHON
42578 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
42579  PyObject *self, *result;
42580  PyCFunction cfunc;
42581  cfunc = PyCFunction_GET_FUNCTION(func);
42582  self = PyCFunction_GET_SELF(func);
42583  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
42584  return NULL;
42585  result = cfunc(self, arg);
42586  Py_LeaveRecursiveCall();
42587  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
42588  PyErr_SetString(
42589  PyExc_SystemError,
42590  "NULL result without error in PyObject_Call");
42591  }
42592  return result;
42593 }
42594 #endif
42595 
42596 /* PyObjectCallOneArg */
42597 #if CYTHON_COMPILING_IN_CPYTHON
42598 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
42599  PyObject *result;
42600  PyObject *args = PyTuple_New(1);
42601  if (unlikely(!args)) return NULL;
42602  Py_INCREF(arg);
42603  PyTuple_SET_ITEM(args, 0, arg);
42604  result = __Pyx_PyObject_Call(func, args, NULL);
42605  Py_DECREF(args);
42606  return result;
42607 }
42608 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
42609 #if CYTHON_FAST_PYCALL
42610  if (PyFunction_Check(func)) {
42611  return __Pyx_PyFunction_FastCall(func, &arg, 1);
42612  }
42613 #endif
42614  if (likely(PyCFunction_Check(func))) {
42615  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
42616  return __Pyx_PyObject_CallMethO(func, arg);
42617 #if CYTHON_FAST_PYCCALL
42618  } else if (__Pyx_PyFastCFunction_Check(func)) {
42619  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
42620 #endif
42621  }
42622  }
42623  return __Pyx__PyObject_CallOneArg(func, arg);
42624 }
42625 #else
42626 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
42627  PyObject *result;
42628  PyObject *args = PyTuple_Pack(1, arg);
42629  if (unlikely(!args)) return NULL;
42630  result = __Pyx_PyObject_Call(func, args, NULL);
42631  Py_DECREF(args);
42632  return result;
42633 }
42634 #endif
42635 
42636 /* PyIntBinop */
42637 #if !CYTHON_COMPILING_IN_PYPY
42638 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
42639  (void)inplace;
42640  (void)zerodivision_check;
42641  #if PY_MAJOR_VERSION < 3
42642  if (likely(PyInt_CheckExact(op1))) {
42643  const long b = intval;
42644  long x;
42645  long a = PyInt_AS_LONG(op1);
42646  x = (long)((unsigned long)a + b);
42647  if (likely((x^a) >= 0 || (x^b) >= 0))
42648  return PyInt_FromLong(x);
42649  return PyLong_Type.tp_as_number->nb_add(op1, op2);
42650  }
42651  #endif
42652  #if CYTHON_USE_PYLONG_INTERNALS
42653  if (likely(PyLong_CheckExact(op1))) {
42654  const long b = intval;
42655  long a, x;
42656 #ifdef HAVE_LONG_LONG
42657  const PY_LONG_LONG llb = intval;
42658  PY_LONG_LONG lla, llx;
42659 #endif
42660  const digit* digits = ((PyLongObject*)op1)->ob_digit;
42661  const Py_ssize_t size = Py_SIZE(op1);
42662  if (likely(__Pyx_sst_abs(size) <= 1)) {
42663  a = likely(size) ? digits[0] : 0;
42664  if (size == -1) a = -a;
42665  } else {
42666  switch (size) {
42667  case -2:
42668  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
42669  a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
42670  break;
42671 #ifdef HAVE_LONG_LONG
42672  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
42673  lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
42674  goto long_long;
42675 #endif
42676  }
42677  CYTHON_FALLTHROUGH;
42678  case 2:
42679  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
42680  a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
42681  break;
42682 #ifdef HAVE_LONG_LONG
42683  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
42684  lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
42685  goto long_long;
42686 #endif
42687  }
42688  CYTHON_FALLTHROUGH;
42689  case -3:
42690  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
42691  a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
42692  break;
42693 #ifdef HAVE_LONG_LONG
42694  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
42695  lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
42696  goto long_long;
42697 #endif
42698  }
42699  CYTHON_FALLTHROUGH;
42700  case 3:
42701  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
42702  a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
42703  break;
42704 #ifdef HAVE_LONG_LONG
42705  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
42706  lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
42707  goto long_long;
42708 #endif
42709  }
42710  CYTHON_FALLTHROUGH;
42711  case -4:
42712  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
42713  a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
42714  break;
42715 #ifdef HAVE_LONG_LONG
42716  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
42717  lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
42718  goto long_long;
42719 #endif
42720  }
42721  CYTHON_FALLTHROUGH;
42722  case 4:
42723  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
42724  a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
42725  break;
42726 #ifdef HAVE_LONG_LONG
42727  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
42728  lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
42729  goto long_long;
42730 #endif
42731  }
42732  CYTHON_FALLTHROUGH;
42733  default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
42734  }
42735  }
42736  x = a + b;
42737  return PyLong_FromLong(x);
42738 #ifdef HAVE_LONG_LONG
42739  long_long:
42740  llx = lla + llb;
42741  return PyLong_FromLongLong(llx);
42742 #endif
42743 
42744 
42745  }
42746  #endif
42747  if (PyFloat_CheckExact(op1)) {
42748  const long b = intval;
42749  double a = PyFloat_AS_DOUBLE(op1);
42750  double result;
42751  PyFPE_START_PROTECT("add", return NULL)
42752  result = ((double)a) + (double)b;
42753  PyFPE_END_PROTECT(result)
42754  return PyFloat_FromDouble(result);
42755  }
42756  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
42757 }
42758 #endif
42759 
42760 /* GetItemInt */
42761 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
42762  PyObject *r;
42763  if (!j) return NULL;
42764  r = PyObject_GetItem(o, j);
42765  Py_DECREF(j);
42766  return r;
42767 }
42768 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
42769  CYTHON_NCP_UNUSED int wraparound,
42770  CYTHON_NCP_UNUSED int boundscheck) {
42771 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
42772  Py_ssize_t wrapped_i = i;
42773  if (wraparound & unlikely(i < 0)) {
42774  wrapped_i += PyList_GET_SIZE(o);
42775  }
42776  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
42777  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
42778  Py_INCREF(r);
42779  return r;
42780  }
42781  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
42782 #else
42783  return PySequence_GetItem(o, i);
42784 #endif
42785 }
42786 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
42787  CYTHON_NCP_UNUSED int wraparound,
42788  CYTHON_NCP_UNUSED int boundscheck) {
42789 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
42790  Py_ssize_t wrapped_i = i;
42791  if (wraparound & unlikely(i < 0)) {
42792  wrapped_i += PyTuple_GET_SIZE(o);
42793  }
42794  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
42795  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
42796  Py_INCREF(r);
42797  return r;
42798  }
42799  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
42800 #else
42801  return PySequence_GetItem(o, i);
42802 #endif
42803 }
42804 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
42805  CYTHON_NCP_UNUSED int wraparound,
42806  CYTHON_NCP_UNUSED int boundscheck) {
42807 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
42808  if (is_list || PyList_CheckExact(o)) {
42809  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
42810  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
42811  PyObject *r = PyList_GET_ITEM(o, n);
42812  Py_INCREF(r);
42813  return r;
42814  }
42815  }
42816  else if (PyTuple_CheckExact(o)) {
42817  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
42818  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
42819  PyObject *r = PyTuple_GET_ITEM(o, n);
42820  Py_INCREF(r);
42821  return r;
42822  }
42823  } else {
42824  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
42825  if (likely(m && m->sq_item)) {
42826  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
42827  Py_ssize_t l = m->sq_length(o);
42828  if (likely(l >= 0)) {
42829  i += l;
42830  } else {
42831  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
42832  return NULL;
42833  PyErr_Clear();
42834  }
42835  }
42836  return m->sq_item(o, i);
42837  }
42838  }
42839 #else
42840  if (is_list || PySequence_Check(o)) {
42841  return PySequence_GetItem(o, i);
42842  }
42843 #endif
42844  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
42845 }
42846 
42847 /* ObjectGetItem */
42848 #if CYTHON_USE_TYPE_SLOTS
42849 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
42850  PyObject *runerr;
42851  Py_ssize_t key_value;
42852  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
42853  if (unlikely(!(m && m->sq_item))) {
42854  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
42855  return NULL;
42856  }
42857  key_value = __Pyx_PyIndex_AsSsize_t(index);
42858  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
42859  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
42860  }
42861  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
42862  PyErr_Clear();
42863  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
42864  }
42865  return NULL;
42866 }
42867 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
42868  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
42869  if (likely(m && m->mp_subscript)) {
42870  return m->mp_subscript(obj, key);
42871  }
42872  return __Pyx_PyObject_GetIndex(obj, key);
42873 }
42874 #endif
42875 
42876 /* IterFinish */
42877 static CYTHON_INLINE int __Pyx_IterFinish(void) {
42878 #if CYTHON_FAST_THREAD_STATE
42879  PyThreadState *tstate = __Pyx_PyThreadState_Current;
42880  PyObject* exc_type = tstate->curexc_type;
42881  if (unlikely(exc_type)) {
42882  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
42883  PyObject *exc_value, *exc_tb;
42884  exc_value = tstate->curexc_value;
42885  exc_tb = tstate->curexc_traceback;
42886  tstate->curexc_type = 0;
42887  tstate->curexc_value = 0;
42888  tstate->curexc_traceback = 0;
42889  Py_DECREF(exc_type);
42890  Py_XDECREF(exc_value);
42891  Py_XDECREF(exc_tb);
42892  return 0;
42893  } else {
42894  return -1;
42895  }
42896  }
42897  return 0;
42898 #else
42899  if (unlikely(PyErr_Occurred())) {
42900  if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
42901  PyErr_Clear();
42902  return 0;
42903  } else {
42904  return -1;
42905  }
42906  }
42907  return 0;
42908 #endif
42909 }
42910 
42911 /* set_iter */
42912 static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
42913  Py_ssize_t* p_orig_length, int* p_source_is_set) {
42914 #if CYTHON_COMPILING_IN_CPYTHON
42915  is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
42916  *p_source_is_set = is_set;
42917  if (likely(is_set)) {
42918  *p_orig_length = PySet_Size(iterable);
42919  Py_INCREF(iterable);
42920  return iterable;
42921  }
42922 #else
42923  (void)is_set;
42924  *p_source_is_set = 0;
42925 #endif
42926  *p_orig_length = 0;
42927  return PyObject_GetIter(iterable);
42928 }
42929 static CYTHON_INLINE int __Pyx_set_iter_next(
42930  PyObject* iter_obj, Py_ssize_t orig_length,
42931  Py_ssize_t* ppos, PyObject **value,
42932  int source_is_set) {
42933  if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
42934  *value = PyIter_Next(iter_obj);
42935  if (unlikely(!*value)) {
42936  return __Pyx_IterFinish();
42937  }
42938  (void)orig_length;
42939  (void)ppos;
42940  return 1;
42941  }
42942 #if CYTHON_COMPILING_IN_CPYTHON
42943  if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
42944  PyErr_SetString(
42945  PyExc_RuntimeError,
42946  "set changed size during iteration");
42947  return -1;
42948  }
42949  {
42950  Py_hash_t hash;
42951  int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
42952  assert (ret != -1);
42953  if (likely(ret)) {
42954  Py_INCREF(*value);
42955  return 1;
42956  }
42957  }
42958 #endif
42959  return 0;
42960 }
42961 
42962 /* Import */
42963 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
42964  PyObject *empty_list = 0;
42965  PyObject *module = 0;
42966  PyObject *global_dict = 0;
42967  PyObject *empty_dict = 0;
42968  PyObject *list;
42969  #if PY_MAJOR_VERSION < 3
42970  PyObject *py_import;
42971  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
42972  if (!py_import)
42973  goto bad;
42974  #endif
42975  if (from_list)
42976  list = from_list;
42977  else {
42978  empty_list = PyList_New(0);
42979  if (!empty_list)
42980  goto bad;
42981  list = empty_list;
42982  }
42983  global_dict = PyModule_GetDict(__pyx_m);
42984  if (!global_dict)
42985  goto bad;
42986  empty_dict = PyDict_New();
42987  if (!empty_dict)
42988  goto bad;
42989  {
42990  #if PY_MAJOR_VERSION >= 3
42991  if (level == -1) {
42992  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
42993  module = PyImport_ImportModuleLevelObject(
42994  name, global_dict, empty_dict, list, 1);
42995  if (!module) {
42996  if (!PyErr_ExceptionMatches(PyExc_ImportError))
42997  goto bad;
42998  PyErr_Clear();
42999  }
43000  }
43001  level = 0;
43002  }
43003  #endif
43004  if (!module) {
43005  #if PY_MAJOR_VERSION < 3
43006  PyObject *py_level = PyInt_FromLong(level);
43007  if (!py_level)
43008  goto bad;
43009  module = PyObject_CallFunctionObjArgs(py_import,
43010  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
43011  Py_DECREF(py_level);
43012  #else
43013  module = PyImport_ImportModuleLevelObject(
43014  name, global_dict, empty_dict, list, level);
43015  #endif
43016  }
43017  }
43018 bad:
43019  #if PY_MAJOR_VERSION < 3
43020  Py_XDECREF(py_import);
43021  #endif
43022  Py_XDECREF(empty_list);
43023  Py_XDECREF(empty_dict);
43024  return module;
43025 }
43026 
43027 /* ImportFrom */
43028 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
43029  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
43030  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
43031  PyErr_Format(PyExc_ImportError,
43032  #if PY_MAJOR_VERSION < 3
43033  "cannot import name %.230s", PyString_AS_STRING(name));
43034  #else
43035  "cannot import name %S", name);
43036  #endif
43037  }
43038  return value;
43039 }
43040 
43041 /* PyObjectCallNoArg */
43042 #if CYTHON_COMPILING_IN_CPYTHON
43043 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
43044 #if CYTHON_FAST_PYCALL
43045  if (PyFunction_Check(func)) {
43046  return __Pyx_PyFunction_FastCall(func, NULL, 0);
43047  }
43048 #endif
43049 #ifdef __Pyx_CyFunction_USED
43050  if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
43051 #else
43052  if (likely(PyCFunction_Check(func)))
43053 #endif
43054  {
43055  if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
43056  return __Pyx_PyObject_CallMethO(func, NULL);
43057  }
43058  }
43059  return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
43060 }
43061 #endif
43062 
43063 /* DictGetItem */
43064 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
43065 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
43066  PyObject *value;
43067  value = PyDict_GetItemWithError(d, key);
43068  if (unlikely(!value)) {
43069  if (!PyErr_Occurred()) {
43070  if (unlikely(PyTuple_Check(key))) {
43071  PyObject* args = PyTuple_Pack(1, key);
43072  if (likely(args)) {
43073  PyErr_SetObject(PyExc_KeyError, args);
43074  Py_DECREF(args);
43075  }
43076  } else {
43077  PyErr_SetObject(PyExc_KeyError, key);
43078  }
43079  }
43080  return NULL;
43081  }
43082  Py_INCREF(value);
43083  return value;
43084 }
43085 #endif
43086 
43087 /* SliceObject */
43088 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
43089  Py_ssize_t cstart, Py_ssize_t cstop,
43090  PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
43091  int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
43092 #if CYTHON_USE_TYPE_SLOTS
43093  PyMappingMethods* mp;
43094 #if PY_MAJOR_VERSION < 3
43095  PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
43096  if (likely(ms && ms->sq_slice)) {
43097  if (!has_cstart) {
43098  if (_py_start && (*_py_start != Py_None)) {
43099  cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
43100  if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
43101  } else
43102  cstart = 0;
43103  }
43104  if (!has_cstop) {
43105  if (_py_stop && (*_py_stop != Py_None)) {
43106  cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
43107  if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
43108  } else
43109  cstop = PY_SSIZE_T_MAX;
43110  }
43111  if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
43112  Py_ssize_t l = ms->sq_length(obj);
43113  if (likely(l >= 0)) {
43114  if (cstop < 0) {
43115  cstop += l;
43116  if (cstop < 0) cstop = 0;
43117  }
43118  if (cstart < 0) {
43119  cstart += l;
43120  if (cstart < 0) cstart = 0;
43121  }
43122  } else {
43123  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
43124  goto bad;
43125  PyErr_Clear();
43126  }
43127  }
43128  return ms->sq_slice(obj, cstart, cstop);
43129  }
43130 #endif
43131  mp = Py_TYPE(obj)->tp_as_mapping;
43132  if (likely(mp && mp->mp_subscript))
43133 #endif
43134  {
43135  PyObject* result;
43136  PyObject *py_slice, *py_start, *py_stop;
43137  if (_py_slice) {
43138  py_slice = *_py_slice;
43139  } else {
43140  PyObject* owned_start = NULL;
43141  PyObject* owned_stop = NULL;
43142  if (_py_start) {
43143  py_start = *_py_start;
43144  } else {
43145  if (has_cstart) {
43146  owned_start = py_start = PyInt_FromSsize_t(cstart);
43147  if (unlikely(!py_start)) goto bad;
43148  } else
43149  py_start = Py_None;
43150  }
43151  if (_py_stop) {
43152  py_stop = *_py_stop;
43153  } else {
43154  if (has_cstop) {
43155  owned_stop = py_stop = PyInt_FromSsize_t(cstop);
43156  if (unlikely(!py_stop)) {
43157  Py_XDECREF(owned_start);
43158  goto bad;
43159  }
43160  } else
43161  py_stop = Py_None;
43162  }
43163  py_slice = PySlice_New(py_start, py_stop, Py_None);
43164  Py_XDECREF(owned_start);
43165  Py_XDECREF(owned_stop);
43166  if (unlikely(!py_slice)) goto bad;
43167  }
43168 #if CYTHON_USE_TYPE_SLOTS
43169  result = mp->mp_subscript(obj, py_slice);
43170 #else
43171  result = PyObject_GetItem(obj, py_slice);
43172 #endif
43173  if (!_py_slice) {
43174  Py_DECREF(py_slice);
43175  }
43176  return result;
43177  }
43178  PyErr_Format(PyExc_TypeError,
43179  "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
43180 bad:
43181  return NULL;
43182 }
43183 
43184 /* SetItemInt */
43185 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
43186  int r;
43187  if (!j) return -1;
43188  r = PyObject_SetItem(o, j, v);
43189  Py_DECREF(j);
43190  return r;
43191 }
43192 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
43193  CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
43194 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
43195  if (is_list || PyList_CheckExact(o)) {
43196  Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
43197  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
43198  PyObject* old = PyList_GET_ITEM(o, n);
43199  Py_INCREF(v);
43200  PyList_SET_ITEM(o, n, v);
43201  Py_DECREF(old);
43202  return 1;
43203  }
43204  } else {
43205  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
43206  if (likely(m && m->sq_ass_item)) {
43207  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
43208  Py_ssize_t l = m->sq_length(o);
43209  if (likely(l >= 0)) {
43210  i += l;
43211  } else {
43212  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
43213  return -1;
43214  PyErr_Clear();
43215  }
43216  }
43217  return m->sq_ass_item(o, i, v);
43218  }
43219  }
43220 #else
43221 #if CYTHON_COMPILING_IN_PYPY
43222  if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
43223 #else
43224  if (is_list || PySequence_Check(o))
43225 #endif
43226  {
43227  return PySequence_SetItem(o, i, v);
43228  }
43229 #endif
43230  return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
43231 }
43232 
43233 /* PyErrFetchRestore */
43234 #if CYTHON_FAST_THREAD_STATE
43235 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
43236  PyObject *tmp_type, *tmp_value, *tmp_tb;
43237  tmp_type = tstate->curexc_type;
43238  tmp_value = tstate->curexc_value;
43239  tmp_tb = tstate->curexc_traceback;
43240  tstate->curexc_type = type;
43241  tstate->curexc_value = value;
43242  tstate->curexc_traceback = tb;
43243  Py_XDECREF(tmp_type);
43244  Py_XDECREF(tmp_value);
43245  Py_XDECREF(tmp_tb);
43246 }
43247 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
43248  *type = tstate->curexc_type;
43249  *value = tstate->curexc_value;
43250  *tb = tstate->curexc_traceback;
43251  tstate->curexc_type = 0;
43252  tstate->curexc_value = 0;
43253  tstate->curexc_traceback = 0;
43254 }
43255 #endif
43256 
43257 /* WriteUnraisableException */
43258 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
43259  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
43260  int full_traceback, CYTHON_UNUSED int nogil) {
43261  PyObject *old_exc, *old_val, *old_tb;
43262  PyObject *ctx;
43263  __Pyx_PyThreadState_declare
43264 #ifdef WITH_THREAD
43265  PyGILState_STATE state;
43266  if (nogil)
43267  state = PyGILState_Ensure();
43268 #ifdef _MSC_VER
43269  else state = (PyGILState_STATE)-1;
43270 #endif
43271 #endif
43272  __Pyx_PyThreadState_assign
43273  __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
43274  if (full_traceback) {
43275  Py_XINCREF(old_exc);
43276  Py_XINCREF(old_val);
43277  Py_XINCREF(old_tb);
43278  __Pyx_ErrRestore(old_exc, old_val, old_tb);
43279  PyErr_PrintEx(1);
43280  }
43281  #if PY_MAJOR_VERSION < 3
43282  ctx = PyString_FromString(name);
43283  #else
43284  ctx = PyUnicode_FromString(name);
43285  #endif
43286  __Pyx_ErrRestore(old_exc, old_val, old_tb);
43287  if (!ctx) {
43288  PyErr_WriteUnraisable(Py_None);
43289  } else {
43290  PyErr_WriteUnraisable(ctx);
43291  Py_DECREF(ctx);
43292  }
43293 #ifdef WITH_THREAD
43294  if (nogil)
43295  PyGILState_Release(state);
43296 #endif
43297 }
43298 
43299 /* ExtTypeTest */
43300 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
43301  if (unlikely(!type)) {
43302  PyErr_SetString(PyExc_SystemError, "Missing type object");
43303  return 0;
43304  }
43305  if (likely(__Pyx_TypeCheck(obj, type)))
43306  return 1;
43307  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
43308  Py_TYPE(obj)->tp_name, type->tp_name);
43309  return 0;
43310 }
43311 
43312 /* GetTopmostException */
43313 #if CYTHON_USE_EXC_INFO_STACK
43314 static _PyErr_StackItem *
43315 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
43316 {
43317  _PyErr_StackItem *exc_info = tstate->exc_info;
43318  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
43319  exc_info->previous_item != NULL)
43320  {
43321  exc_info = exc_info->previous_item;
43322  }
43323  return exc_info;
43324 }
43325 #endif
43326 
43327 /* SaveResetException */
43328 #if CYTHON_FAST_THREAD_STATE
43329 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
43330  #if CYTHON_USE_EXC_INFO_STACK
43331  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
43332  *type = exc_info->exc_type;
43333  *value = exc_info->exc_value;
43334  *tb = exc_info->exc_traceback;
43335  #else
43336  *type = tstate->exc_type;
43337  *value = tstate->exc_value;
43338  *tb = tstate->exc_traceback;
43339  #endif
43340  Py_XINCREF(*type);
43341  Py_XINCREF(*value);
43342  Py_XINCREF(*tb);
43343 }
43344 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
43345  PyObject *tmp_type, *tmp_value, *tmp_tb;
43346  #if CYTHON_USE_EXC_INFO_STACK
43347  _PyErr_StackItem *exc_info = tstate->exc_info;
43348  tmp_type = exc_info->exc_type;
43349  tmp_value = exc_info->exc_value;
43350  tmp_tb = exc_info->exc_traceback;
43351  exc_info->exc_type = type;
43352  exc_info->exc_value = value;
43353  exc_info->exc_traceback = tb;
43354  #else
43355  tmp_type = tstate->exc_type;
43356  tmp_value = tstate->exc_value;
43357  tmp_tb = tstate->exc_traceback;
43358  tstate->exc_type = type;
43359  tstate->exc_value = value;
43360  tstate->exc_traceback = tb;
43361  #endif
43362  Py_XDECREF(tmp_type);
43363  Py_XDECREF(tmp_value);
43364  Py_XDECREF(tmp_tb);
43365 }
43366 #endif
43367 
43368 /* PyErrExceptionMatches */
43369 #if CYTHON_FAST_THREAD_STATE
43370 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
43371  Py_ssize_t i, n;
43372  n = PyTuple_GET_SIZE(tuple);
43373 #if PY_MAJOR_VERSION >= 3
43374  for (i=0; i<n; i++) {
43375  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
43376  }
43377 #endif
43378  for (i=0; i<n; i++) {
43379  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
43380  }
43381  return 0;
43382 }
43383 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
43384  PyObject *exc_type = tstate->curexc_type;
43385  if (exc_type == err) return 1;
43386  if (unlikely(!exc_type)) return 0;
43387  if (unlikely(PyTuple_Check(err)))
43388  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
43389  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
43390 }
43391 #endif
43392 
43393 /* GetException */
43394 #if CYTHON_FAST_THREAD_STATE
43395 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
43396 #else
43397 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
43398 #endif
43399 {
43400  PyObject *local_type, *local_value, *local_tb;
43401 #if CYTHON_FAST_THREAD_STATE
43402  PyObject *tmp_type, *tmp_value, *tmp_tb;
43403  local_type = tstate->curexc_type;
43404  local_value = tstate->curexc_value;
43405  local_tb = tstate->curexc_traceback;
43406  tstate->curexc_type = 0;
43407  tstate->curexc_value = 0;
43408  tstate->curexc_traceback = 0;
43409 #else
43410  PyErr_Fetch(&local_type, &local_value, &local_tb);
43411 #endif
43412  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
43413 #if CYTHON_FAST_THREAD_STATE
43414  if (unlikely(tstate->curexc_type))
43415 #else
43416  if (unlikely(PyErr_Occurred()))
43417 #endif
43418  goto bad;
43419  #if PY_MAJOR_VERSION >= 3
43420  if (local_tb) {
43421  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
43422  goto bad;
43423  }
43424  #endif
43425  Py_XINCREF(local_tb);
43426  Py_XINCREF(local_type);
43427  Py_XINCREF(local_value);
43428  *type = local_type;
43429  *value = local_value;
43430  *tb = local_tb;
43431 #if CYTHON_FAST_THREAD_STATE
43432  #if CYTHON_USE_EXC_INFO_STACK
43433  {
43434  _PyErr_StackItem *exc_info = tstate->exc_info;
43435  tmp_type = exc_info->exc_type;
43436  tmp_value = exc_info->exc_value;
43437  tmp_tb = exc_info->exc_traceback;
43438  exc_info->exc_type = local_type;
43439  exc_info->exc_value = local_value;
43440  exc_info->exc_traceback = local_tb;
43441  }
43442  #else
43443  tmp_type = tstate->exc_type;
43444  tmp_value = tstate->exc_value;
43445  tmp_tb = tstate->exc_traceback;
43446  tstate->exc_type = local_type;
43447  tstate->exc_value = local_value;
43448  tstate->exc_traceback = local_tb;
43449  #endif
43450  Py_XDECREF(tmp_type);
43451  Py_XDECREF(tmp_value);
43452  Py_XDECREF(tmp_tb);
43453 #else
43454  PyErr_SetExcInfo(local_type, local_value, local_tb);
43455 #endif
43456  return 0;
43457 bad:
43458  *type = 0;
43459  *value = 0;
43460  *tb = 0;
43461  Py_XDECREF(local_type);
43462  Py_XDECREF(local_value);
43463  Py_XDECREF(local_tb);
43464  return -1;
43465 }
43466 
43467 /* RaiseException */
43468 #if PY_MAJOR_VERSION < 3
43469 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
43470  CYTHON_UNUSED PyObject *cause) {
43471  __Pyx_PyThreadState_declare
43472  Py_XINCREF(type);
43473  if (!value || value == Py_None)
43474  value = NULL;
43475  else
43476  Py_INCREF(value);
43477  if (!tb || tb == Py_None)
43478  tb = NULL;
43479  else {
43480  Py_INCREF(tb);
43481  if (!PyTraceBack_Check(tb)) {
43482  PyErr_SetString(PyExc_TypeError,
43483  "raise: arg 3 must be a traceback or None");
43484  goto raise_error;
43485  }
43486  }
43487  if (PyType_Check(type)) {
43488 #if CYTHON_COMPILING_IN_PYPY
43489  if (!value) {
43490  Py_INCREF(Py_None);
43491  value = Py_None;
43492  }
43493 #endif
43494  PyErr_NormalizeException(&type, &value, &tb);
43495  } else {
43496  if (value) {
43497  PyErr_SetString(PyExc_TypeError,
43498  "instance exception may not have a separate value");
43499  goto raise_error;
43500  }
43501  value = type;
43502  type = (PyObject*) Py_TYPE(type);
43503  Py_INCREF(type);
43504  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
43505  PyErr_SetString(PyExc_TypeError,
43506  "raise: exception class must be a subclass of BaseException");
43507  goto raise_error;
43508  }
43509  }
43510  __Pyx_PyThreadState_assign
43511  __Pyx_ErrRestore(type, value, tb);
43512  return;
43513 raise_error:
43514  Py_XDECREF(value);
43515  Py_XDECREF(type);
43516  Py_XDECREF(tb);
43517  return;
43518 }
43519 #else
43520 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
43521  PyObject* owned_instance = NULL;
43522  if (tb == Py_None) {
43523  tb = 0;
43524  } else if (tb && !PyTraceBack_Check(tb)) {
43525  PyErr_SetString(PyExc_TypeError,
43526  "raise: arg 3 must be a traceback or None");
43527  goto bad;
43528  }
43529  if (value == Py_None)
43530  value = 0;
43531  if (PyExceptionInstance_Check(type)) {
43532  if (value) {
43533  PyErr_SetString(PyExc_TypeError,
43534  "instance exception may not have a separate value");
43535  goto bad;
43536  }
43537  value = type;
43538  type = (PyObject*) Py_TYPE(value);
43539  } else if (PyExceptionClass_Check(type)) {
43540  PyObject *instance_class = NULL;
43541  if (value && PyExceptionInstance_Check(value)) {
43542  instance_class = (PyObject*) Py_TYPE(value);
43543  if (instance_class != type) {
43544  int is_subclass = PyObject_IsSubclass(instance_class, type);
43545  if (!is_subclass) {
43546  instance_class = NULL;
43547  } else if (unlikely(is_subclass == -1)) {
43548  goto bad;
43549  } else {
43550  type = instance_class;
43551  }
43552  }
43553  }
43554  if (!instance_class) {
43555  PyObject *args;
43556  if (!value)
43557  args = PyTuple_New(0);
43558  else if (PyTuple_Check(value)) {
43559  Py_INCREF(value);
43560  args = value;
43561  } else
43562  args = PyTuple_Pack(1, value);
43563  if (!args)
43564  goto bad;
43565  owned_instance = PyObject_Call(type, args, NULL);
43566  Py_DECREF(args);
43567  if (!owned_instance)
43568  goto bad;
43569  value = owned_instance;
43570  if (!PyExceptionInstance_Check(value)) {
43571  PyErr_Format(PyExc_TypeError,
43572  "calling %R should have returned an instance of "
43573  "BaseException, not %R",
43574  type, Py_TYPE(value));
43575  goto bad;
43576  }
43577  }
43578  } else {
43579  PyErr_SetString(PyExc_TypeError,
43580  "raise: exception class must be a subclass of BaseException");
43581  goto bad;
43582  }
43583  if (cause) {
43584  PyObject *fixed_cause;
43585  if (cause == Py_None) {
43586  fixed_cause = NULL;
43587  } else if (PyExceptionClass_Check(cause)) {
43588  fixed_cause = PyObject_CallObject(cause, NULL);
43589  if (fixed_cause == NULL)
43590  goto bad;
43591  } else if (PyExceptionInstance_Check(cause)) {
43592  fixed_cause = cause;
43593  Py_INCREF(fixed_cause);
43594  } else {
43595  PyErr_SetString(PyExc_TypeError,
43596  "exception causes must derive from "
43597  "BaseException");
43598  goto bad;
43599  }
43600  PyException_SetCause(value, fixed_cause);
43601  }
43602  PyErr_SetObject(type, value);
43603  if (tb) {
43604 #if CYTHON_COMPILING_IN_PYPY
43605  PyObject *tmp_type, *tmp_value, *tmp_tb;
43606  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
43607  Py_INCREF(tb);
43608  PyErr_Restore(tmp_type, tmp_value, tb);
43609  Py_XDECREF(tmp_tb);
43610 #else
43611  PyThreadState *tstate = __Pyx_PyThreadState_Current;
43612  PyObject* tmp_tb = tstate->curexc_traceback;
43613  if (tb != tmp_tb) {
43614  Py_INCREF(tb);
43615  tstate->curexc_traceback = tb;
43616  Py_XDECREF(tmp_tb);
43617  }
43618 #endif
43619  }
43620 bad:
43621  Py_XDECREF(owned_instance);
43622  return;
43623 }
43624 #endif
43625 
43626 /* ArgTypeTest */
43627 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
43628 {
43629  if (unlikely(!type)) {
43630  PyErr_SetString(PyExc_SystemError, "Missing type object");
43631  return 0;
43632  }
43633  else if (exact) {
43634  #if PY_MAJOR_VERSION == 2
43635  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
43636  #endif
43637  }
43638  else {
43639  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
43640  }
43641  PyErr_Format(PyExc_TypeError,
43642  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
43643  name, type->tp_name, Py_TYPE(obj)->tp_name);
43644  return 0;
43645 }
43646 
43647 /* BytesEquals */
43648 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
43649 #if CYTHON_COMPILING_IN_PYPY
43650  return PyObject_RichCompareBool(s1, s2, equals);
43651 #else
43652  if (s1 == s2) {
43653  return (equals == Py_EQ);
43654  } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
43655  const char *ps1, *ps2;
43656  Py_ssize_t length = PyBytes_GET_SIZE(s1);
43657  if (length != PyBytes_GET_SIZE(s2))
43658  return (equals == Py_NE);
43659  ps1 = PyBytes_AS_STRING(s1);
43660  ps2 = PyBytes_AS_STRING(s2);
43661  if (ps1[0] != ps2[0]) {
43662  return (equals == Py_NE);
43663  } else if (length == 1) {
43664  return (equals == Py_EQ);
43665  } else {
43666  int result;
43667 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
43668  Py_hash_t hash1, hash2;
43669  hash1 = ((PyBytesObject*)s1)->ob_shash;
43670  hash2 = ((PyBytesObject*)s2)->ob_shash;
43671  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
43672  return (equals == Py_NE);
43673  }
43674 #endif
43675  result = memcmp(ps1, ps2, (size_t)length);
43676  return (equals == Py_EQ) ? (result == 0) : (result != 0);
43677  }
43678  } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
43679  return (equals == Py_NE);
43680  } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
43681  return (equals == Py_NE);
43682  } else {
43683  int result;
43684  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
43685  if (!py_result)
43686  return -1;
43687  result = __Pyx_PyObject_IsTrue(py_result);
43688  Py_DECREF(py_result);
43689  return result;
43690  }
43691 #endif
43692 }
43693 
43694 /* UnicodeEquals */
43695 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
43696 #if CYTHON_COMPILING_IN_PYPY
43697  return PyObject_RichCompareBool(s1, s2, equals);
43698 #else
43699 #if PY_MAJOR_VERSION < 3
43700  PyObject* owned_ref = NULL;
43701 #endif
43702  int s1_is_unicode, s2_is_unicode;
43703  if (s1 == s2) {
43704  goto return_eq;
43705  }
43706  s1_is_unicode = PyUnicode_CheckExact(s1);
43707  s2_is_unicode = PyUnicode_CheckExact(s2);
43708 #if PY_MAJOR_VERSION < 3
43709  if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
43710  owned_ref = PyUnicode_FromObject(s2);
43711  if (unlikely(!owned_ref))
43712  return -1;
43713  s2 = owned_ref;
43714  s2_is_unicode = 1;
43715  } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
43716  owned_ref = PyUnicode_FromObject(s1);
43717  if (unlikely(!owned_ref))
43718  return -1;
43719  s1 = owned_ref;
43720  s1_is_unicode = 1;
43721  } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
43722  return __Pyx_PyBytes_Equals(s1, s2, equals);
43723  }
43724 #endif
43725  if (s1_is_unicode & s2_is_unicode) {
43726  Py_ssize_t length;
43727  int kind;
43728  void *data1, *data2;
43729  if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
43730  return -1;
43731  length = __Pyx_PyUnicode_GET_LENGTH(s1);
43732  if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
43733  goto return_ne;
43734  }
43735 #if CYTHON_USE_UNICODE_INTERNALS
43736  {
43737  Py_hash_t hash1, hash2;
43738  #if CYTHON_PEP393_ENABLED
43739  hash1 = ((PyASCIIObject*)s1)->hash;
43740  hash2 = ((PyASCIIObject*)s2)->hash;
43741  #else
43742  hash1 = ((PyUnicodeObject*)s1)->hash;
43743  hash2 = ((PyUnicodeObject*)s2)->hash;
43744  #endif
43745  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
43746  goto return_ne;
43747  }
43748  }
43749 #endif
43750  kind = __Pyx_PyUnicode_KIND(s1);
43751  if (kind != __Pyx_PyUnicode_KIND(s2)) {
43752  goto return_ne;
43753  }
43754  data1 = __Pyx_PyUnicode_DATA(s1);
43755  data2 = __Pyx_PyUnicode_DATA(s2);
43756  if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
43757  goto return_ne;
43758  } else if (length == 1) {
43759  goto return_eq;
43760  } else {
43761  int result = memcmp(data1, data2, (size_t)(length * kind));
43762  #if PY_MAJOR_VERSION < 3
43763  Py_XDECREF(owned_ref);
43764  #endif
43765  return (equals == Py_EQ) ? (result == 0) : (result != 0);
43766  }
43767  } else if ((s1 == Py_None) & s2_is_unicode) {
43768  goto return_ne;
43769  } else if ((s2 == Py_None) & s1_is_unicode) {
43770  goto return_ne;
43771  } else {
43772  int result;
43773  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
43774  #if PY_MAJOR_VERSION < 3
43775  Py_XDECREF(owned_ref);
43776  #endif
43777  if (!py_result)
43778  return -1;
43779  result = __Pyx_PyObject_IsTrue(py_result);
43780  Py_DECREF(py_result);
43781  return result;
43782  }
43783 return_eq:
43784  #if PY_MAJOR_VERSION < 3
43785  Py_XDECREF(owned_ref);
43786  #endif
43787  return (equals == Py_EQ);
43788 return_ne:
43789  #if PY_MAJOR_VERSION < 3
43790  Py_XDECREF(owned_ref);
43791  #endif
43792  return (equals == Py_NE);
43793 #endif
43794 }
43795 
43796 /* GetAttr */
43797 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
43798 #if CYTHON_USE_TYPE_SLOTS
43799 #if PY_MAJOR_VERSION >= 3
43800  if (likely(PyUnicode_Check(n)))
43801 #else
43802  if (likely(PyString_Check(n)))
43803 #endif
43804  return __Pyx_PyObject_GetAttrStr(o, n);
43805 #endif
43806  return PyObject_GetAttr(o, n);
43807 }
43808 
43809 /* decode_c_string */
43810 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
43811  const char* cstring, Py_ssize_t start, Py_ssize_t stop,
43812  const char* encoding, const char* errors,
43813  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
43814  Py_ssize_t length;
43815  if (unlikely((start < 0) | (stop < 0))) {
43816  size_t slen = strlen(cstring);
43817  if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
43818  PyErr_SetString(PyExc_OverflowError,
43819  "c-string too long to convert to Python");
43820  return NULL;
43821  }
43822  length = (Py_ssize_t) slen;
43823  if (start < 0) {
43824  start += length;
43825  if (start < 0)
43826  start = 0;
43827  }
43828  if (stop < 0)
43829  stop += length;
43830  }
43831  if (unlikely(stop <= start))
43832  return __Pyx_NewRef(__pyx_empty_unicode);
43833  length = stop - start;
43834  cstring += start;
43835  if (decode_func) {
43836  return decode_func(cstring, length, errors);
43837  } else {
43838  return PyUnicode_Decode(cstring, length, encoding, errors);
43839  }
43840 }
43841 
43842 /* GetAttr3 */
43843 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
43844  __Pyx_PyThreadState_declare
43845  __Pyx_PyThreadState_assign
43846  if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
43847  return NULL;
43848  __Pyx_PyErr_Clear();
43849  Py_INCREF(d);
43850  return d;
43851 }
43852 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
43853  PyObject *r = __Pyx_GetAttr(o, n);
43854  return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
43855 }
43856 
43857 /* RaiseTooManyValuesToUnpack */
43858 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
43859  PyErr_Format(PyExc_ValueError,
43860  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
43861 }
43862 
43863 /* RaiseNeedMoreValuesToUnpack */
43864 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
43865  PyErr_Format(PyExc_ValueError,
43866  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
43867  index, (index == 1) ? "" : "s");
43868 }
43869 
43870 /* RaiseNoneIterError */
43871 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
43872  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
43873 }
43874 
43875 /* SwapException */
43876 #if CYTHON_FAST_THREAD_STATE
43877 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
43878  PyObject *tmp_type, *tmp_value, *tmp_tb;
43879  #if CYTHON_USE_EXC_INFO_STACK
43880  _PyErr_StackItem *exc_info = tstate->exc_info;
43881  tmp_type = exc_info->exc_type;
43882  tmp_value = exc_info->exc_value;
43883  tmp_tb = exc_info->exc_traceback;
43884  exc_info->exc_type = *type;
43885  exc_info->exc_value = *value;
43886  exc_info->exc_traceback = *tb;
43887  #else
43888  tmp_type = tstate->exc_type;
43889  tmp_value = tstate->exc_value;
43890  tmp_tb = tstate->exc_traceback;
43891  tstate->exc_type = *type;
43892  tstate->exc_value = *value;
43893  tstate->exc_traceback = *tb;
43894  #endif
43895  *type = tmp_type;
43896  *value = tmp_value;
43897  *tb = tmp_tb;
43898 }
43899 #else
43900 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
43901  PyObject *tmp_type, *tmp_value, *tmp_tb;
43902  PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
43903  PyErr_SetExcInfo(*type, *value, *tb);
43904  *type = tmp_type;
43905  *value = tmp_value;
43906  *tb = tmp_tb;
43907 }
43908 #endif
43909 
43910 /* FastTypeChecks */
43911 #if CYTHON_COMPILING_IN_CPYTHON
43912 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
43913  while (a) {
43914  a = a->tp_base;
43915  if (a == b)
43916  return 1;
43917  }
43918  return b == &PyBaseObject_Type;
43919 }
43920 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
43921  PyObject *mro;
43922  if (a == b) return 1;
43923  mro = a->tp_mro;
43924  if (likely(mro)) {
43925  Py_ssize_t i, n;
43926  n = PyTuple_GET_SIZE(mro);
43927  for (i = 0; i < n; i++) {
43928  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
43929  return 1;
43930  }
43931  return 0;
43932  }
43933  return __Pyx_InBases(a, b);
43934 }
43935 #if PY_MAJOR_VERSION == 2
43936 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
43937  PyObject *exception, *value, *tb;
43938  int res;
43939  __Pyx_PyThreadState_declare
43940  __Pyx_PyThreadState_assign
43941  __Pyx_ErrFetch(&exception, &value, &tb);
43942  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
43943  if (unlikely(res == -1)) {
43944  PyErr_WriteUnraisable(err);
43945  res = 0;
43946  }
43947  if (!res) {
43948  res = PyObject_IsSubclass(err, exc_type2);
43949  if (unlikely(res == -1)) {
43950  PyErr_WriteUnraisable(err);
43951  res = 0;
43952  }
43953  }
43954  __Pyx_ErrRestore(exception, value, tb);
43955  return res;
43956 }
43957 #else
43958 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
43959  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
43960  if (!res) {
43961  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
43962  }
43963  return res;
43964 }
43965 #endif
43966 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
43967  Py_ssize_t i, n;
43968  assert(PyExceptionClass_Check(exc_type));
43969  n = PyTuple_GET_SIZE(tuple);
43970 #if PY_MAJOR_VERSION >= 3
43971  for (i=0; i<n; i++) {
43972  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
43973  }
43974 #endif
43975  for (i=0; i<n; i++) {
43976  PyObject *t = PyTuple_GET_ITEM(tuple, i);
43977  #if PY_MAJOR_VERSION < 3
43978  if (likely(exc_type == t)) return 1;
43979  #endif
43980  if (likely(PyExceptionClass_Check(t))) {
43981  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
43982  } else {
43983  }
43984  }
43985  return 0;
43986 }
43987 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
43988  if (likely(err == exc_type)) return 1;
43989  if (likely(PyExceptionClass_Check(err))) {
43990  if (likely(PyExceptionClass_Check(exc_type))) {
43991  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
43992  } else if (likely(PyTuple_Check(exc_type))) {
43993  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
43994  } else {
43995  }
43996  }
43997  return PyErr_GivenExceptionMatches(err, exc_type);
43998 }
43999 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
44000  assert(PyExceptionClass_Check(exc_type1));
44001  assert(PyExceptionClass_Check(exc_type2));
44002  if (likely(err == exc_type1 || err == exc_type2)) return 1;
44003  if (likely(PyExceptionClass_Check(err))) {
44004  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
44005  }
44006  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
44007 }
44008 #endif
44009 
44010 /* None */
44011 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
44012  PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
44013 }
44014 
44015 /* HasAttr */
44016 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
44017  PyObject *r;
44018  if (unlikely(!__Pyx_PyBaseString_Check(n))) {
44019  PyErr_SetString(PyExc_TypeError,
44020  "hasattr(): attribute name must be string");
44021  return -1;
44022  }
44023  r = __Pyx_GetAttr(o, n);
44024  if (unlikely(!r)) {
44025  PyErr_Clear();
44026  return 0;
44027  } else {
44028  Py_DECREF(r);
44029  return 1;
44030  }
44031 }
44032 
44033 /* StringJoin */
44034 #if !CYTHON_COMPILING_IN_CPYTHON
44035 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
44036  return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
44037 }
44038 #endif
44039 
44040 /* PyObject_GenericGetAttrNoDict */
44041 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
44042 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
44043  PyErr_Format(PyExc_AttributeError,
44044 #if PY_MAJOR_VERSION >= 3
44045  "'%.50s' object has no attribute '%U'",
44046  tp->tp_name, attr_name);
44047 #else
44048  "'%.50s' object has no attribute '%.400s'",
44049  tp->tp_name, PyString_AS_STRING(attr_name));
44050 #endif
44051  return NULL;
44052 }
44053 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
44054  PyObject *descr;
44055  PyTypeObject *tp = Py_TYPE(obj);
44056  if (unlikely(!PyString_Check(attr_name))) {
44057  return PyObject_GenericGetAttr(obj, attr_name);
44058  }
44059  assert(!tp->tp_dictoffset);
44060  descr = _PyType_Lookup(tp, attr_name);
44061  if (unlikely(!descr)) {
44062  return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
44063  }
44064  Py_INCREF(descr);
44065  #if PY_MAJOR_VERSION < 3
44066  if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
44067  #endif
44068  {
44069  descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
44070  if (unlikely(f)) {
44071  PyObject *res = f(descr, obj, (PyObject *)tp);
44072  Py_DECREF(descr);
44073  return res;
44074  }
44075  }
44076  return descr;
44077 }
44078 #endif
44079 
44080 /* PyObject_GenericGetAttr */
44081 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
44082 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
44083  if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
44084  return PyObject_GenericGetAttr(obj, attr_name);
44085  }
44086  return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
44087 }
44088 #endif
44089 
44090 /* SetVTable */
44091 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
44092 #if PY_VERSION_HEX >= 0x02070000
44093  PyObject *ob = PyCapsule_New(vtable, 0, 0);
44094 #else
44095  PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
44096 #endif
44097  if (!ob)
44098  goto bad;
44099  if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
44100  goto bad;
44101  Py_DECREF(ob);
44102  return 0;
44103 bad:
44104  Py_XDECREF(ob);
44105  return -1;
44106 }
44107 
44108 /* PyObjectGetAttrStrNoError */
44109 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
44110  __Pyx_PyThreadState_declare
44111  __Pyx_PyThreadState_assign
44112  if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
44113  __Pyx_PyErr_Clear();
44114 }
44115 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
44116  PyObject *result;
44117 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
44118  PyTypeObject* tp = Py_TYPE(obj);
44119  if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
44120  return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
44121  }
44122 #endif
44123  result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
44124  if (unlikely(!result)) {
44125  __Pyx_PyObject_GetAttrStr_ClearAttributeError();
44126  }
44127  return result;
44128 }
44129 
44130 /* SetupReduce */
44131 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
44132  int ret;
44133  PyObject *name_attr;
44134  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
44135  if (likely(name_attr)) {
44136  ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
44137  } else {
44138  ret = -1;
44139  }
44140  if (unlikely(ret < 0)) {
44141  PyErr_Clear();
44142  ret = 0;
44143  }
44144  Py_XDECREF(name_attr);
44145  return ret;
44146 }
44147 static int __Pyx_setup_reduce(PyObject* type_obj) {
44148  int ret = 0;
44149  PyObject *object_reduce = NULL;
44150  PyObject *object_getstate = NULL;
44151  PyObject *object_reduce_ex = NULL;
44152  PyObject *reduce = NULL;
44153  PyObject *reduce_ex = NULL;
44154  PyObject *reduce_cython = NULL;
44155  PyObject *setstate = NULL;
44156  PyObject *setstate_cython = NULL;
44157  PyObject *getstate = NULL;
44158 #if CYTHON_USE_PYTYPE_LOOKUP
44159  getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
44160 #else
44161  getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
44162  if (!getstate && PyErr_Occurred()) {
44163  goto __PYX_BAD;
44164  }
44165 #endif
44166  if (getstate) {
44167 #if CYTHON_USE_PYTYPE_LOOKUP
44168  object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
44169 #else
44170  object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
44171  if (!object_getstate && PyErr_Occurred()) {
44172  goto __PYX_BAD;
44173  }
44174 #endif
44175  if (object_getstate != getstate) {
44176  goto __PYX_GOOD;
44177  }
44178  }
44179 #if CYTHON_USE_PYTYPE_LOOKUP
44180  object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
44181 #else
44182  object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
44183 #endif
44184  reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
44185  if (reduce_ex == object_reduce_ex) {
44186 #if CYTHON_USE_PYTYPE_LOOKUP
44187  object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
44188 #else
44189  object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
44190 #endif
44191  reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
44192  if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
44193  reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
44194  if (likely(reduce_cython)) {
44195  ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
44196  ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
44197  } else if (reduce == object_reduce || PyErr_Occurred()) {
44198  goto __PYX_BAD;
44199  }
44200  setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
44201  if (!setstate) PyErr_Clear();
44202  if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
44203  setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
44204  if (likely(setstate_cython)) {
44205  ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
44206  ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
44207  } else if (!setstate || PyErr_Occurred()) {
44208  goto __PYX_BAD;
44209  }
44210  }
44211  PyType_Modified((PyTypeObject*)type_obj);
44212  }
44213  }
44214  goto __PYX_GOOD;
44215 __PYX_BAD:
44216  if (!PyErr_Occurred())
44217  PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
44218  ret = -1;
44219 __PYX_GOOD:
44220 #if !CYTHON_USE_PYTYPE_LOOKUP
44221  Py_XDECREF(object_reduce);
44222  Py_XDECREF(object_reduce_ex);
44223  Py_XDECREF(object_getstate);
44224  Py_XDECREF(getstate);
44225 #endif
44226  Py_XDECREF(reduce);
44227  Py_XDECREF(reduce_ex);
44228  Py_XDECREF(reduce_cython);
44229  Py_XDECREF(setstate);
44230  Py_XDECREF(setstate_cython);
44231  return ret;
44232 }
44233 
44234 /* TypeImport */
44235 #ifndef __PYX_HAVE_RT_ImportType
44236 #define __PYX_HAVE_RT_ImportType
44237 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
44238  size_t size, enum __Pyx_ImportType_CheckSize check_size)
44239 {
44240  PyObject *result = 0;
44241  char warning[200];
44242  Py_ssize_t basicsize;
44243 #ifdef Py_LIMITED_API
44244  PyObject *py_basicsize;
44245 #endif
44246  result = PyObject_GetAttrString(module, class_name);
44247  if (!result)
44248  goto bad;
44249  if (!PyType_Check(result)) {
44250  PyErr_Format(PyExc_TypeError,
44251  "%.200s.%.200s is not a type object",
44252  module_name, class_name);
44253  goto bad;
44254  }
44255 #ifndef Py_LIMITED_API
44256  basicsize = ((PyTypeObject *)result)->tp_basicsize;
44257 #else
44258  py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
44259  if (!py_basicsize)
44260  goto bad;
44261  basicsize = PyLong_AsSsize_t(py_basicsize);
44262  Py_DECREF(py_basicsize);
44263  py_basicsize = 0;
44264  if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
44265  goto bad;
44266 #endif
44267  if ((size_t)basicsize < size) {
44268  PyErr_Format(PyExc_ValueError,
44269  "%.200s.%.200s size changed, may indicate binary incompatibility. "
44270  "Expected %zd from C header, got %zd from PyObject",
44271  module_name, class_name, size, basicsize);
44272  goto bad;
44273  }
44274  if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
44275  PyErr_Format(PyExc_ValueError,
44276  "%.200s.%.200s size changed, may indicate binary incompatibility. "
44277  "Expected %zd from C header, got %zd from PyObject",
44278  module_name, class_name, size, basicsize);
44279  goto bad;
44280  }
44281  else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
44282  PyOS_snprintf(warning, sizeof(warning),
44283  "%s.%s size changed, may indicate binary incompatibility. "
44284  "Expected %zd from C header, got %zd from PyObject",
44285  module_name, class_name, size, basicsize);
44286  if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
44287  }
44288  return (PyTypeObject *)result;
44289 bad:
44290  Py_XDECREF(result);
44291  return NULL;
44292 }
44293 #endif
44294 
44295 /* CLineInTraceback */
44296 #ifndef CYTHON_CLINE_IN_TRACEBACK
44297 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
44298  PyObject *use_cline;
44299  PyObject *ptype, *pvalue, *ptraceback;
44300 #if CYTHON_COMPILING_IN_CPYTHON
44301  PyObject **cython_runtime_dict;
44302 #endif
44303  if (unlikely(!__pyx_cython_runtime)) {
44304  return c_line;
44305  }
44306  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
44307 #if CYTHON_COMPILING_IN_CPYTHON
44308  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
44309  if (likely(cython_runtime_dict)) {
44310  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
44311  use_cline, *cython_runtime_dict,
44312  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
44313  } else
44314 #endif
44315  {
44316  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
44317  if (use_cline_obj) {
44318  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
44319  Py_DECREF(use_cline_obj);
44320  } else {
44321  PyErr_Clear();
44322  use_cline = NULL;
44323  }
44324  }
44325  if (!use_cline) {
44326  c_line = 0;
44327  (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
44328  }
44329  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
44330  c_line = 0;
44331  }
44332  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
44333  return c_line;
44334 }
44335 #endif
44336 
44337 /* CodeObjectCache */
44338 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
44339  int start = 0, mid = 0, end = count - 1;
44340  if (end >= 0 && code_line > entries[end].code_line) {
44341  return count;
44342  }
44343  while (start < end) {
44344  mid = start + (end - start) / 2;
44345  if (code_line < entries[mid].code_line) {
44346  end = mid;
44347  } else if (code_line > entries[mid].code_line) {
44348  start = mid + 1;
44349  } else {
44350  return mid;
44351  }
44352  }
44353  if (code_line <= entries[mid].code_line) {
44354  return mid;
44355  } else {
44356  return mid + 1;
44357  }
44358 }
44359 static PyCodeObject *__pyx_find_code_object(int code_line) {
44360  PyCodeObject* code_object;
44361  int pos;
44362  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
44363  return NULL;
44364  }
44365  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
44366  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
44367  return NULL;
44368  }
44369  code_object = __pyx_code_cache.entries[pos].code_object;
44370  Py_INCREF(code_object);
44371  return code_object;
44372 }
44373 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
44374  int pos, i;
44375  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
44376  if (unlikely(!code_line)) {
44377  return;
44378  }
44379  if (unlikely(!entries)) {
44380  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
44381  if (likely(entries)) {
44382  __pyx_code_cache.entries = entries;
44383  __pyx_code_cache.max_count = 64;
44384  __pyx_code_cache.count = 1;
44385  entries[0].code_line = code_line;
44386  entries[0].code_object = code_object;
44387  Py_INCREF(code_object);
44388  }
44389  return;
44390  }
44391  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
44392  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
44393  PyCodeObject* tmp = entries[pos].code_object;
44394  entries[pos].code_object = code_object;
44395  Py_DECREF(tmp);
44396  return;
44397  }
44398  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
44399  int new_max = __pyx_code_cache.max_count + 64;
44400  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
44401  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
44402  if (unlikely(!entries)) {
44403  return;
44404  }
44405  __pyx_code_cache.entries = entries;
44406  __pyx_code_cache.max_count = new_max;
44407  }
44408  for (i=__pyx_code_cache.count; i>pos; i--) {
44409  entries[i] = entries[i-1];
44410  }
44411  entries[pos].code_line = code_line;
44412  entries[pos].code_object = code_object;
44413  __pyx_code_cache.count++;
44414  Py_INCREF(code_object);
44415 }
44416 
44417 /* AddTraceback */
44418 #include "compile.h"
44419 #include "frameobject.h"
44420 #include "traceback.h"
44421 #if PY_VERSION_HEX >= 0x030b00a6
44422  #ifndef Py_BUILD_CORE
44423  #define Py_BUILD_CORE 1
44424  #endif
44425  #include "internal/pycore_frame.h"
44426 #endif
44427 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
44428  const char *funcname, int c_line,
44429  int py_line, const char *filename) {
44430  PyCodeObject *py_code = NULL;
44431  PyObject *py_funcname = NULL;
44432  #if PY_MAJOR_VERSION < 3
44433  PyObject *py_srcfile = NULL;
44434  py_srcfile = PyString_FromString(filename);
44435  if (!py_srcfile) goto bad;
44436  #endif
44437  if (c_line) {
44438  #if PY_MAJOR_VERSION < 3
44439  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
44440  if (!py_funcname) goto bad;
44441  #else
44442  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
44443  if (!py_funcname) goto bad;
44444  funcname = PyUnicode_AsUTF8(py_funcname);
44445  if (!funcname) goto bad;
44446  #endif
44447  }
44448  else {
44449  #if PY_MAJOR_VERSION < 3
44450  py_funcname = PyString_FromString(funcname);
44451  if (!py_funcname) goto bad;
44452  #endif
44453  }
44454  #if PY_MAJOR_VERSION < 3
44455  py_code = __Pyx_PyCode_New(
44456  0,
44457  0,
44458  0,
44459  0,
44460  0,
44461  __pyx_empty_bytes, /*PyObject *code,*/
44462  __pyx_empty_tuple, /*PyObject *consts,*/
44463  __pyx_empty_tuple, /*PyObject *names,*/
44464  __pyx_empty_tuple, /*PyObject *varnames,*/
44465  __pyx_empty_tuple, /*PyObject *freevars,*/
44466  __pyx_empty_tuple, /*PyObject *cellvars,*/
44467  py_srcfile, /*PyObject *filename,*/
44468  py_funcname, /*PyObject *name,*/
44469  py_line,
44470  __pyx_empty_bytes /*PyObject *lnotab*/
44471  );
44472  Py_DECREF(py_srcfile);
44473  #else
44474  py_code = PyCode_NewEmpty(filename, funcname, py_line);
44475  #endif
44476  Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
44477  return py_code;
44478 bad:
44479  Py_XDECREF(py_funcname);
44480  #if PY_MAJOR_VERSION < 3
44481  Py_XDECREF(py_srcfile);
44482  #endif
44483  return NULL;
44484 }
44485 static void __Pyx_AddTraceback(const char *funcname, int c_line,
44486  int py_line, const char *filename) {
44487  PyCodeObject *py_code = 0;
44488  PyFrameObject *py_frame = 0;
44489  PyThreadState *tstate = __Pyx_PyThreadState_Current;
44490  PyObject *ptype, *pvalue, *ptraceback;
44491  if (c_line) {
44492  c_line = __Pyx_CLineForTraceback(tstate, c_line);
44493  }
44494  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
44495  if (!py_code) {
44496  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
44497  py_code = __Pyx_CreateCodeObjectForTraceback(
44498  funcname, c_line, py_line, filename);
44499  if (!py_code) {
44500  /* If the code object creation fails, then we should clear the
44501  fetched exception references and propagate the new exception */
44502  Py_XDECREF(ptype);
44503  Py_XDECREF(pvalue);
44504  Py_XDECREF(ptraceback);
44505  goto bad;
44506  }
44507  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
44508  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
44509  }
44510  py_frame = PyFrame_New(
44511  tstate, /*PyThreadState *tstate,*/
44512  py_code, /*PyCodeObject *code,*/
44513  __pyx_d, /*PyObject *globals,*/
44514  0 /*PyObject *locals*/
44515  );
44516  if (!py_frame) goto bad;
44517  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
44518  PyTraceBack_Here(py_frame);
44519 bad:
44520  Py_XDECREF(py_code);
44521  Py_XDECREF(py_frame);
44522 }
44523 
44524 #if PY_MAJOR_VERSION < 3
44525 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
44526  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
44527  if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
44528  if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
44529  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
44530  return -1;
44531 }
44532 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
44533  PyObject *obj = view->obj;
44534  if (!obj) return;
44535  if (PyObject_CheckBuffer(obj)) {
44536  PyBuffer_Release(view);
44537  return;
44538  }
44539  if ((0)) {}
44540  view->obj = NULL;
44541  Py_DECREF(obj);
44542 }
44543 #endif
44544 
44545 
44546 /* MemviewSliceIsContig */
44547 static int
44548 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
44549 {
44550  int i, index, step, start;
44551  Py_ssize_t itemsize = mvs.memview->view.itemsize;
44552  if (order == 'F') {
44553  step = 1;
44554  start = 0;
44555  } else {
44556  step = -1;
44557  start = ndim - 1;
44558  }
44559  for (i = 0; i < ndim; i++) {
44560  index = start + step * i;
44561  if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
44562  return 0;
44563  itemsize *= mvs.shape[index];
44564  }
44565  return 1;
44566 }
44567 
44568 /* OverlappingSlices */
44569 static void
44570 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
44571  void **out_start, void **out_end,
44572  int ndim, size_t itemsize)
44573 {
44574  char *start, *end;
44575  int i;
44576  start = end = slice->data;
44577  for (i = 0; i < ndim; i++) {
44578  Py_ssize_t stride = slice->strides[i];
44579  Py_ssize_t extent = slice->shape[i];
44580  if (extent == 0) {
44581  *out_start = *out_end = start;
44582  return;
44583  } else {
44584  if (stride > 0)
44585  end += stride * (extent - 1);
44586  else
44587  start += stride * (extent - 1);
44588  }
44589  }
44590  *out_start = start;
44591  *out_end = end + itemsize;
44592 }
44593 static int
44594 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
44595  __Pyx_memviewslice *slice2,
44596  int ndim, size_t itemsize)
44597 {
44598  void *start1, *end1, *start2, *end2;
44599  __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
44600  __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
44601  return (start1 < end2) && (start2 < end1);
44602 }
44603 
44604 /* Capsule */
44605 static CYTHON_INLINE PyObject *
44606 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
44607 {
44608  PyObject *cobj;
44609 #if PY_VERSION_HEX >= 0x02070000
44610  cobj = PyCapsule_New(p, sig, NULL);
44611 #else
44612  cobj = PyCObject_FromVoidPtr(p, NULL);
44613 #endif
44614  return cobj;
44615 }
44616 
44617 /* IsLittleEndian */
44618 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
44619 {
44620  union {
44621  uint32_t u32;
44622  uint8_t u8[4];
44623  } S;
44624  S.u32 = 0x01020304;
44625  return S.u8[0] == 4;
44626 }
44627 
44628 /* BufferFormatCheck */
44629 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
44630  __Pyx_BufFmt_StackElem* stack,
44631  __Pyx_TypeInfo* type) {
44632  stack[0].field = &ctx->root;
44633  stack[0].parent_offset = 0;
44634  ctx->root.type = type;
44635  ctx->root.name = "buffer dtype";
44636  ctx->root.offset = 0;
44637  ctx->head = stack;
44638  ctx->head->field = &ctx->root;
44639  ctx->fmt_offset = 0;
44640  ctx->head->parent_offset = 0;
44641  ctx->new_packmode = '@';
44642  ctx->enc_packmode = '@';
44643  ctx->new_count = 1;
44644  ctx->enc_count = 0;
44645  ctx->enc_type = 0;
44646  ctx->is_complex = 0;
44647  ctx->is_valid_array = 0;
44648  ctx->struct_alignment = 0;
44649  while (type->typegroup == 'S') {
44650  ++ctx->head;
44651  ctx->head->field = type->fields;
44652  ctx->head->parent_offset = 0;
44653  type = type->fields->type;
44654  }
44655 }
44656 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
44657  int count;
44658  const char* t = *ts;
44659  if (*t < '0' || *t > '9') {
44660  return -1;
44661  } else {
44662  count = *t++ - '0';
44663  while (*t >= '0' && *t <= '9') {
44664  count *= 10;
44665  count += *t++ - '0';
44666  }
44667  }
44668  *ts = t;
44669  return count;
44670 }
44671 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
44672  int number = __Pyx_BufFmt_ParseNumber(ts);
44673  if (number == -1)
44674  PyErr_Format(PyExc_ValueError,\
44675  "Does not understand character buffer dtype format string ('%c')", **ts);
44676  return number;
44677 }
44678 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
44679  PyErr_Format(PyExc_ValueError,
44680  "Unexpected format string character: '%c'", ch);
44681 }
44682 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
44683  switch (ch) {
44684  case '?': return "'bool'";
44685  case 'c': return "'char'";
44686  case 'b': return "'signed char'";
44687  case 'B': return "'unsigned char'";
44688  case 'h': return "'short'";
44689  case 'H': return "'unsigned short'";
44690  case 'i': return "'int'";
44691  case 'I': return "'unsigned int'";
44692  case 'l': return "'long'";
44693  case 'L': return "'unsigned long'";
44694  case 'q': return "'long long'";
44695  case 'Q': return "'unsigned long long'";
44696  case 'f': return (is_complex ? "'complex float'" : "'float'");
44697  case 'd': return (is_complex ? "'complex double'" : "'double'");
44698  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
44699  case 'T': return "a struct";
44700  case 'O': return "Python object";
44701  case 'P': return "a pointer";
44702  case 's': case 'p': return "a string";
44703  case 0: return "end";
44704  default: return "unparseable format string";
44705  }
44706 }
44707 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
44708  switch (ch) {
44709  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
44710  case 'h': case 'H': return 2;
44711  case 'i': case 'I': case 'l': case 'L': return 4;
44712  case 'q': case 'Q': return 8;
44713  case 'f': return (is_complex ? 8 : 4);
44714  case 'd': return (is_complex ? 16 : 8);
44715  case 'g': {
44716  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
44717  return 0;
44718  }
44719  case 'O': case 'P': return sizeof(void*);
44720  default:
44721  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
44722  return 0;
44723  }
44724 }
44725 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
44726  switch (ch) {
44727  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
44728  case 'h': case 'H': return sizeof(short);
44729  case 'i': case 'I': return sizeof(int);
44730  case 'l': case 'L': return sizeof(long);
44731  #ifdef HAVE_LONG_LONG
44732  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
44733  #endif
44734  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
44735  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
44736  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
44737  case 'O': case 'P': return sizeof(void*);
44738  default: {
44739  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
44740  return 0;
44741  }
44742  }
44743 }
44744 typedef struct { char c; short x; } __Pyx_st_short;
44745 typedef struct { char c; int x; } __Pyx_st_int;
44746 typedef struct { char c; long x; } __Pyx_st_long;
44747 typedef struct { char c; float x; } __Pyx_st_float;
44748 typedef struct { char c; double x; } __Pyx_st_double;
44749 typedef struct { char c; long double x; } __Pyx_st_longdouble;
44750 typedef struct { char c; void *x; } __Pyx_st_void_p;
44751 #ifdef HAVE_LONG_LONG
44752 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
44753 #endif
44754 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
44755  switch (ch) {
44756  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
44757  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
44758  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
44759  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
44760 #ifdef HAVE_LONG_LONG
44761  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
44762 #endif
44763  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
44764  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
44765  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
44766  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
44767  default:
44768  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
44769  return 0;
44770  }
44771 }
44772 /* These are for computing the padding at the end of the struct to align
44773  on the first member of the struct. This will probably the same as above,
44774  but we don't have any guarantees.
44775  */
44776 typedef struct { short x; char c; } __Pyx_pad_short;
44777 typedef struct { int x; char c; } __Pyx_pad_int;
44778 typedef struct { long x; char c; } __Pyx_pad_long;
44779 typedef struct { float x; char c; } __Pyx_pad_float;
44780 typedef struct { double x; char c; } __Pyx_pad_double;
44781 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
44782 typedef struct { void *x; char c; } __Pyx_pad_void_p;
44783 #ifdef HAVE_LONG_LONG
44784 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
44785 #endif
44786 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
44787  switch (ch) {
44788  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
44789  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
44790  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
44791  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
44792 #ifdef HAVE_LONG_LONG
44793  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
44794 #endif
44795  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
44796  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
44797  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
44798  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
44799  default:
44800  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
44801  return 0;
44802  }
44803 }
44804 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
44805  switch (ch) {
44806  case 'c':
44807  return 'H';
44808  case 'b': case 'h': case 'i':
44809  case 'l': case 'q': case 's': case 'p':
44810  return 'I';
44811  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
44812  return 'U';
44813  case 'f': case 'd': case 'g':
44814  return (is_complex ? 'C' : 'R');
44815  case 'O':
44816  return 'O';
44817  case 'P':
44818  return 'P';
44819  default: {
44820  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
44821  return 0;
44822  }
44823  }
44824 }
44825 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
44826  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
44827  const char* expected;
44828  const char* quote;
44829  if (ctx->head == NULL) {
44830  expected = "end";
44831  quote = "";
44832  } else {
44833  expected = ctx->head->field->type->name;
44834  quote = "'";
44835  }
44836  PyErr_Format(PyExc_ValueError,
44837  "Buffer dtype mismatch, expected %s%s%s but got %s",
44838  quote, expected, quote,
44839  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
44840  } else {
44841  __Pyx_StructField* field = ctx->head->field;
44842  __Pyx_StructField* parent = (ctx->head - 1)->field;
44843  PyErr_Format(PyExc_ValueError,
44844  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
44845  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
44846  parent->type->name, field->name);
44847  }
44848 }
44849 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
44850  char group;
44851  size_t size, offset, arraysize = 1;
44852  if (ctx->enc_type == 0) return 0;
44853  if (ctx->head->field->type->arraysize[0]) {
44854  int i, ndim = 0;
44855  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
44856  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
44857  ndim = 1;
44858  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
44859  PyErr_Format(PyExc_ValueError,
44860  "Expected a dimension of size %zu, got %zu",
44861  ctx->head->field->type->arraysize[0], ctx->enc_count);
44862  return -1;
44863  }
44864  }
44865  if (!ctx->is_valid_array) {
44866  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
44867  ctx->head->field->type->ndim, ndim);
44868  return -1;
44869  }
44870  for (i = 0; i < ctx->head->field->type->ndim; i++) {
44871  arraysize *= ctx->head->field->type->arraysize[i];
44872  }
44873  ctx->is_valid_array = 0;
44874  ctx->enc_count = 1;
44875  }
44876  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
44877  do {
44878  __Pyx_StructField* field = ctx->head->field;
44879  __Pyx_TypeInfo* type = field->type;
44880  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
44881  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
44882  } else {
44883  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
44884  }
44885  if (ctx->enc_packmode == '@') {
44886  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
44887  size_t align_mod_offset;
44888  if (align_at == 0) return -1;
44889  align_mod_offset = ctx->fmt_offset % align_at;
44890  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
44891  if (ctx->struct_alignment == 0)
44892  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
44893  ctx->is_complex);
44894  }
44895  if (type->size != size || type->typegroup != group) {
44896  if (type->typegroup == 'C' && type->fields != NULL) {
44897  size_t parent_offset = ctx->head->parent_offset + field->offset;
44898  ++ctx->head;
44899  ctx->head->field = type->fields;
44900  ctx->head->parent_offset = parent_offset;
44901  continue;
44902  }
44903  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
44904  } else {
44905  __Pyx_BufFmt_RaiseExpected(ctx);
44906  return -1;
44907  }
44908  }
44909  offset = ctx->head->parent_offset + field->offset;
44910  if (ctx->fmt_offset != offset) {
44911  PyErr_Format(PyExc_ValueError,
44912  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
44913  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
44914  return -1;
44915  }
44916  ctx->fmt_offset += size;
44917  if (arraysize)
44918  ctx->fmt_offset += (arraysize - 1) * size;
44919  --ctx->enc_count;
44920  while (1) {
44921  if (field == &ctx->root) {
44922  ctx->head = NULL;
44923  if (ctx->enc_count != 0) {
44924  __Pyx_BufFmt_RaiseExpected(ctx);
44925  return -1;
44926  }
44927  break;
44928  }
44929  ctx->head->field = ++field;
44930  if (field->type == NULL) {
44931  --ctx->head;
44932  field = ctx->head->field;
44933  continue;
44934  } else if (field->type->typegroup == 'S') {
44935  size_t parent_offset = ctx->head->parent_offset + field->offset;
44936  if (field->type->fields->type == NULL) continue;
44937  field = field->type->fields;
44938  ++ctx->head;
44939  ctx->head->field = field;
44940  ctx->head->parent_offset = parent_offset;
44941  break;
44942  } else {
44943  break;
44944  }
44945  }
44946  } while (ctx->enc_count);
44947  ctx->enc_type = 0;
44948  ctx->is_complex = 0;
44949  return 0;
44950 }
44951 static PyObject *
44952 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
44953 {
44954  const char *ts = *tsp;
44955  int i = 0, number, ndim;
44956  ++ts;
44957  if (ctx->new_count != 1) {
44958  PyErr_SetString(PyExc_ValueError,
44959  "Cannot handle repeated arrays in format string");
44960  return NULL;
44961  }
44962  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
44963  ndim = ctx->head->field->type->ndim;
44964  while (*ts && *ts != ')') {
44965  switch (*ts) {
44966  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
44967  default: break;
44968  }
44969  number = __Pyx_BufFmt_ExpectNumber(&ts);
44970  if (number == -1) return NULL;
44971  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
44972  return PyErr_Format(PyExc_ValueError,
44973  "Expected a dimension of size %zu, got %d",
44974  ctx->head->field->type->arraysize[i], number);
44975  if (*ts != ',' && *ts != ')')
44976  return PyErr_Format(PyExc_ValueError,
44977  "Expected a comma in format string, got '%c'", *ts);
44978  if (*ts == ',') ts++;
44979  i++;
44980  }
44981  if (i != ndim)
44982  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
44983  ctx->head->field->type->ndim, i);
44984  if (!*ts) {
44985  PyErr_SetString(PyExc_ValueError,
44986  "Unexpected end of format string, expected ')'");
44987  return NULL;
44988  }
44989  ctx->is_valid_array = 1;
44990  ctx->new_count = 1;
44991  *tsp = ++ts;
44992  return Py_None;
44993 }
44994 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
44995  int got_Z = 0;
44996  while (1) {
44997  switch(*ts) {
44998  case 0:
44999  if (ctx->enc_type != 0 && ctx->head == NULL) {
45000  __Pyx_BufFmt_RaiseExpected(ctx);
45001  return NULL;
45002  }
45003  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
45004  if (ctx->head != NULL) {
45005  __Pyx_BufFmt_RaiseExpected(ctx);
45006  return NULL;
45007  }
45008  return ts;
45009  case ' ':
45010  case '\r':
45011  case '\n':
45012  ++ts;
45013  break;
45014  case '<':
45015  if (!__Pyx_Is_Little_Endian()) {
45016  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
45017  return NULL;
45018  }
45019  ctx->new_packmode = '=';
45020  ++ts;
45021  break;
45022  case '>':
45023  case '!':
45024  if (__Pyx_Is_Little_Endian()) {
45025  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
45026  return NULL;
45027  }
45028  ctx->new_packmode = '=';
45029  ++ts;
45030  break;
45031  case '=':
45032  case '@':
45033  case '^':
45034  ctx->new_packmode = *ts++;
45035  break;
45036  case 'T':
45037  {
45038  const char* ts_after_sub;
45039  size_t i, struct_count = ctx->new_count;
45040  size_t struct_alignment = ctx->struct_alignment;
45041  ctx->new_count = 1;
45042  ++ts;
45043  if (*ts != '{') {
45044  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
45045  return NULL;
45046  }
45047  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
45048  ctx->enc_type = 0;
45049  ctx->enc_count = 0;
45050  ctx->struct_alignment = 0;
45051  ++ts;
45052  ts_after_sub = ts;
45053  for (i = 0; i != struct_count; ++i) {
45054  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
45055  if (!ts_after_sub) return NULL;
45056  }
45057  ts = ts_after_sub;
45058  if (struct_alignment) ctx->struct_alignment = struct_alignment;
45059  }
45060  break;
45061  case '}':
45062  {
45063  size_t alignment = ctx->struct_alignment;
45064  ++ts;
45065  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
45066  ctx->enc_type = 0;
45067  if (alignment && ctx->fmt_offset % alignment) {
45068  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
45069  }
45070  }
45071  return ts;
45072  case 'x':
45073  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
45074  ctx->fmt_offset += ctx->new_count;
45075  ctx->new_count = 1;
45076  ctx->enc_count = 0;
45077  ctx->enc_type = 0;
45078  ctx->enc_packmode = ctx->new_packmode;
45079  ++ts;
45080  break;
45081  case 'Z':
45082  got_Z = 1;
45083  ++ts;
45084  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
45085  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
45086  return NULL;
45087  }
45088  CYTHON_FALLTHROUGH;
45089  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
45090  case 'l': case 'L': case 'q': case 'Q':
45091  case 'f': case 'd': case 'g':
45092  case 'O': case 'p':
45093  if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
45094  (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
45095  ctx->enc_count += ctx->new_count;
45096  ctx->new_count = 1;
45097  got_Z = 0;
45098  ++ts;
45099  break;
45100  }
45101  CYTHON_FALLTHROUGH;
45102  case 's':
45103  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
45104  ctx->enc_count = ctx->new_count;
45105  ctx->enc_packmode = ctx->new_packmode;
45106  ctx->enc_type = *ts;
45107  ctx->is_complex = got_Z;
45108  ++ts;
45109  ctx->new_count = 1;
45110  got_Z = 0;
45111  break;
45112  case ':':
45113  ++ts;
45114  while(*ts != ':') ++ts;
45115  ++ts;
45116  break;
45117  case '(':
45118  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
45119  break;
45120  default:
45121  {
45122  int number = __Pyx_BufFmt_ExpectNumber(&ts);
45123  if (number == -1) return NULL;
45124  ctx->new_count = (size_t)number;
45125  }
45126  }
45127  }
45128 }
45129 
45130 /* TypeInfoCompare */
45131  static int
45132 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
45133 {
45134  int i;
45135  if (!a || !b)
45136  return 0;
45137  if (a == b)
45138  return 1;
45139  if (a->size != b->size || a->typegroup != b->typegroup ||
45140  a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
45141  if (a->typegroup == 'H' || b->typegroup == 'H') {
45142  return a->size == b->size;
45143  } else {
45144  return 0;
45145  }
45146  }
45147  if (a->ndim) {
45148  for (i = 0; i < a->ndim; i++)
45149  if (a->arraysize[i] != b->arraysize[i])
45150  return 0;
45151  }
45152  if (a->typegroup == 'S') {
45153  if (a->flags != b->flags)
45154  return 0;
45155  if (a->fields || b->fields) {
45156  if (!(a->fields && b->fields))
45157  return 0;
45158  for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
45159  __Pyx_StructField *field_a = a->fields + i;
45160  __Pyx_StructField *field_b = b->fields + i;
45161  if (field_a->offset != field_b->offset ||
45162  !__pyx_typeinfo_cmp(field_a->type, field_b->type))
45163  return 0;
45164  }
45165  return !a->fields[i].type && !b->fields[i].type;
45166  }
45167  }
45168  return 1;
45169 }
45170 
45171 /* MemviewSliceValidateAndInit */
45172  static int
45173 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
45174 {
45175  if (buf->shape[dim] <= 1)
45176  return 1;
45177  if (buf->strides) {
45178  if (spec & __Pyx_MEMVIEW_CONTIG) {
45179  if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
45180  if (unlikely(buf->strides[dim] != sizeof(void *))) {
45181  PyErr_Format(PyExc_ValueError,
45182  "Buffer is not indirectly contiguous "
45183  "in dimension %d.", dim);
45184  goto fail;
45185  }
45186  } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
45187  PyErr_SetString(PyExc_ValueError,
45188  "Buffer and memoryview are not contiguous "
45189  "in the same dimension.");
45190  goto fail;
45191  }
45192  }
45193  if (spec & __Pyx_MEMVIEW_FOLLOW) {
45194  Py_ssize_t stride = buf->strides[dim];
45195  if (stride < 0)
45196  stride = -stride;
45197  if (unlikely(stride < buf->itemsize)) {
45198  PyErr_SetString(PyExc_ValueError,
45199  "Buffer and memoryview are not contiguous "
45200  "in the same dimension.");
45201  goto fail;
45202  }
45203  }
45204  } else {
45205  if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
45206  PyErr_Format(PyExc_ValueError,
45207  "C-contiguous buffer is not contiguous in "
45208  "dimension %d", dim);
45209  goto fail;
45210  } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
45211  PyErr_Format(PyExc_ValueError,
45212  "C-contiguous buffer is not indirect in "
45213  "dimension %d", dim);
45214  goto fail;
45215  } else if (unlikely(buf->suboffsets)) {
45216  PyErr_SetString(PyExc_ValueError,
45217  "Buffer exposes suboffsets but no strides");
45218  goto fail;
45219  }
45220  }
45221  return 1;
45222 fail:
45223  return 0;
45224 }
45225 static int
45226 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
45227 {
45228  if (spec & __Pyx_MEMVIEW_DIRECT) {
45229  if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
45230  PyErr_Format(PyExc_ValueError,
45231  "Buffer not compatible with direct access "
45232  "in dimension %d.", dim);
45233  goto fail;
45234  }
45235  }
45236  if (spec & __Pyx_MEMVIEW_PTR) {
45237  if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
45238  PyErr_Format(PyExc_ValueError,
45239  "Buffer is not indirectly accessible "
45240  "in dimension %d.", dim);
45241  goto fail;
45242  }
45243  }
45244  return 1;
45245 fail:
45246  return 0;
45247 }
45248 static int
45249 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
45250 {
45251  int i;
45252  if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
45253  Py_ssize_t stride = 1;
45254  for (i = 0; i < ndim; i++) {
45255  if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
45256  PyErr_SetString(PyExc_ValueError,
45257  "Buffer not fortran contiguous.");
45258  goto fail;
45259  }
45260  stride = stride * buf->shape[i];
45261  }
45262  } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
45263  Py_ssize_t stride = 1;
45264  for (i = ndim - 1; i >- 1; i--) {
45265  if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
45266  PyErr_SetString(PyExc_ValueError,
45267  "Buffer not C contiguous.");
45268  goto fail;
45269  }
45270  stride = stride * buf->shape[i];
45271  }
45272  }
45273  return 1;
45274 fail:
45275  return 0;
45276 }
45277 static int __Pyx_ValidateAndInit_memviewslice(
45278  int *axes_specs,
45279  int c_or_f_flag,
45280  int buf_flags,
45281  int ndim,
45282  __Pyx_TypeInfo *dtype,
45283  __Pyx_BufFmt_StackElem stack[],
45284  __Pyx_memviewslice *memviewslice,
45285  PyObject *original_obj)
45286 {
45287  struct __pyx_memoryview_obj *memview, *new_memview;
45288  __Pyx_RefNannyDeclarations
45289  Py_buffer *buf;
45290  int i, spec = 0, retval = -1;
45291  __Pyx_BufFmt_Context ctx;
45292  int from_memoryview = __pyx_memoryview_check(original_obj);
45293  __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
45294  if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
45295  original_obj)->typeinfo)) {
45296  memview = (struct __pyx_memoryview_obj *) original_obj;
45297  new_memview = NULL;
45298  } else {
45299  memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
45300  original_obj, buf_flags, 0, dtype);
45301  new_memview = memview;
45302  if (unlikely(!memview))
45303  goto fail;
45304  }
45305  buf = &memview->view;
45306  if (unlikely(buf->ndim != ndim)) {
45307  PyErr_Format(PyExc_ValueError,
45308  "Buffer has wrong number of dimensions (expected %d, got %d)",
45309  ndim, buf->ndim);
45310  goto fail;
45311  }
45312  if (new_memview) {
45313  __Pyx_BufFmt_Init(&ctx, stack, dtype);
45314  if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
45315  }
45316  if (unlikely((unsigned) buf->itemsize != dtype->size)) {
45317  PyErr_Format(PyExc_ValueError,
45318  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
45319  "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
45320  buf->itemsize,
45321  (buf->itemsize > 1) ? "s" : "",
45322  dtype->name,
45323  dtype->size,
45324  (dtype->size > 1) ? "s" : "");
45325  goto fail;
45326  }
45327  if (buf->len > 0) {
45328  for (i = 0; i < ndim; i++) {
45329  spec = axes_specs[i];
45330  if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
45331  goto fail;
45332  if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
45333  goto fail;
45334  }
45335  if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
45336  goto fail;
45337  }
45338  if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
45339  new_memview != NULL) == -1)) {
45340  goto fail;
45341  }
45342  retval = 0;
45343  goto no_fail;
45344 fail:
45345  Py_XDECREF(new_memview);
45346  retval = -1;
45347 no_fail:
45348  __Pyx_RefNannyFinishContext();
45349  return retval;
45350 }
45351 
45352 /* ObjectToMemviewSlice */
45353  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj, int writable_flag) {
45354  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
45355  __Pyx_BufFmt_StackElem stack[1];
45356  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
45357  int retcode;
45358  if (obj == Py_None) {
45359  result.memview = (struct __pyx_memoryview_obj *) Py_None;
45360  return result;
45361  }
45362  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
45363  PyBUF_RECORDS_RO | writable_flag, 1,
45364  &__Pyx_TypeInfo_int, stack,
45365  &result, obj);
45366  if (unlikely(retcode == -1))
45367  goto __pyx_fail;
45368  return result;
45369 __pyx_fail:
45370  result.memview = NULL;
45371  result.data = NULL;
45372  return result;
45373 }
45374 
45375 /* ObjectToMemviewSlice */
45376  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) {
45377  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
45378  __Pyx_BufFmt_StackElem stack[1];
45379  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
45380  int retcode;
45381  if (obj == Py_None) {
45382  result.memview = (struct __pyx_memoryview_obj *) Py_None;
45383  return result;
45384  }
45385  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
45386  PyBUF_RECORDS_RO | writable_flag, 2,
45387  &__Pyx_TypeInfo_double, stack,
45388  &result, obj);
45389  if (unlikely(retcode == -1))
45390  goto __pyx_fail;
45391  return result;
45392 __pyx_fail:
45393  result.memview = NULL;
45394  result.data = NULL;
45395  return result;
45396 }
45397 
45398 /* CIntFromPyVerify */
45399  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
45400  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
45401 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
45402  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
45403 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
45404  {\
45405  func_type value = func_value;\
45406  if (sizeof(target_type) < sizeof(func_type)) {\
45407  if (unlikely(value != (func_type) (target_type) value)) {\
45408  func_type zero = 0;\
45409  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
45410  return (target_type) -1;\
45411  if (is_unsigned && unlikely(value < zero))\
45412  goto raise_neg_overflow;\
45413  else\
45414  goto raise_overflow;\
45415  }\
45416  }\
45417  return (target_type) value;\
45418  }
45419 
45420 /* ObjectToMemviewSlice */
45421  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) {
45422  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
45423  __Pyx_BufFmt_StackElem stack[1];
45424  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
45425  int retcode;
45426  if (obj == Py_None) {
45427  result.memview = (struct __pyx_memoryview_obj *) Py_None;
45428  return result;
45429  }
45430  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
45431  PyBUF_RECORDS_RO | writable_flag, 1,
45432  &__Pyx_TypeInfo_double, stack,
45433  &result, obj);
45434  if (unlikely(retcode == -1))
45435  goto __pyx_fail;
45436  return result;
45437 __pyx_fail:
45438  result.memview = NULL;
45439  result.data = NULL;
45440  return result;
45441 }
45442 
45443 /* ObjectToMemviewSlice */
45444  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj, int writable_flag) {
45445  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
45446  __Pyx_BufFmt_StackElem stack[1];
45447  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
45448  int retcode;
45449  if (obj == Py_None) {
45450  result.memview = (struct __pyx_memoryview_obj *) Py_None;
45451  return result;
45452  }
45453  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
45454  PyBUF_RECORDS_RO | writable_flag, 2,
45455  &__Pyx_TypeInfo_int, stack,
45456  &result, obj);
45457  if (unlikely(retcode == -1))
45458  goto __pyx_fail;
45459  return result;
45460 __pyx_fail:
45461  result.memview = NULL;
45462  result.data = NULL;
45463  return result;
45464 }
45465 
45466 /* ObjectToMemviewSlice */
45467  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsdsds_double(PyObject *obj, int writable_flag) {
45468  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
45469  __Pyx_BufFmt_StackElem stack[1];
45470  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
45471  int retcode;
45472  if (obj == Py_None) {
45473  result.memview = (struct __pyx_memoryview_obj *) Py_None;
45474  return result;
45475  }
45476  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
45477  PyBUF_RECORDS_RO | writable_flag, 4,
45478  &__Pyx_TypeInfo_double, stack,
45479  &result, obj);
45480  if (unlikely(retcode == -1))
45481  goto __pyx_fail;
45482  return result;
45483 __pyx_fail:
45484  result.memview = NULL;
45485  result.data = NULL;
45486  return result;
45487 }
45488 
45489 /* ObjectToMemviewSlice */
45490  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsdsds_double(PyObject *obj, int writable_flag) {
45491  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
45492  __Pyx_BufFmt_StackElem stack[1];
45493  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
45494  int retcode;
45495  if (obj == Py_None) {
45496  result.memview = (struct __pyx_memoryview_obj *) Py_None;
45497  return result;
45498  }
45499  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
45500  PyBUF_RECORDS_RO | writable_flag, 3,
45501  &__Pyx_TypeInfo_double, stack,
45502  &result, obj);
45503  if (unlikely(retcode == -1))
45504  goto __pyx_fail;
45505  return result;
45506 __pyx_fail:
45507  result.memview = NULL;
45508  result.data = NULL;
45509  return result;
45510 }
45511 
45512 /* MemviewDtypeToObject */
45513  static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
45514  return (PyObject *) PyFloat_FromDouble(*(double *) itemp);
45515 }
45516 static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) {
45517  double value = __pyx_PyFloat_AsDouble(obj);
45518  if ((value == (double)-1) && PyErr_Occurred())
45519  return 0;
45520  *(double *) itemp = value;
45521  return 1;
45522 }
45523 
45524 /* MemviewDtypeToObject */
45525  static CYTHON_INLINE PyObject *__pyx_memview_get_int(const char *itemp) {
45526  return (PyObject *) __Pyx_PyInt_From_int(*(int *) itemp);
45527 }
45528 static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) {
45529  int value = __Pyx_PyInt_As_int(obj);
45530  if ((value == (int)-1) && PyErr_Occurred())
45531  return 0;
45532  *(int *) itemp = value;
45533  return 1;
45534 }
45535 
45536 /* Declarations */
45537  #if CYTHON_CCOMPLEX
45538  #ifdef __cplusplus
45539  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
45540  return ::std::complex< float >(x, y);
45541  }
45542  #else
45543  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
45544  return x + y*(__pyx_t_float_complex)_Complex_I;
45545  }
45546  #endif
45547 #else
45548  static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
45549  __pyx_t_float_complex z;
45550  z.real = x;
45551  z.imag = y;
45552  return z;
45553  }
45554 #endif
45555 
45556 /* Arithmetic */
45557  #if CYTHON_CCOMPLEX
45558 #else
45559  static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45560  return (a.real == b.real) && (a.imag == b.imag);
45561  }
45562  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45563  __pyx_t_float_complex z;
45564  z.real = a.real + b.real;
45565  z.imag = a.imag + b.imag;
45566  return z;
45567  }
45568  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45569  __pyx_t_float_complex z;
45570  z.real = a.real - b.real;
45571  z.imag = a.imag - b.imag;
45572  return z;
45573  }
45574  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45575  __pyx_t_float_complex z;
45576  z.real = a.real * b.real - a.imag * b.imag;
45577  z.imag = a.real * b.imag + a.imag * b.real;
45578  return z;
45579  }
45580  #if 1
45581  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45582  if (b.imag == 0) {
45583  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
45584  } else if (fabsf(b.real) >= fabsf(b.imag)) {
45585  if (b.real == 0 && b.imag == 0) {
45586  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
45587  } else {
45588  float r = b.imag / b.real;
45589  float s = (float)(1.0) / (b.real + b.imag * r);
45590  return __pyx_t_float_complex_from_parts(
45591  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
45592  }
45593  } else {
45594  float r = b.real / b.imag;
45595  float s = (float)(1.0) / (b.imag + b.real * r);
45596  return __pyx_t_float_complex_from_parts(
45597  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
45598  }
45599  }
45600  #else
45601  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45602  if (b.imag == 0) {
45603  return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
45604  } else {
45605  float denom = b.real * b.real + b.imag * b.imag;
45606  return __pyx_t_float_complex_from_parts(
45607  (a.real * b.real + a.imag * b.imag) / denom,
45608  (a.imag * b.real - a.real * b.imag) / denom);
45609  }
45610  }
45611  #endif
45612  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
45613  __pyx_t_float_complex z;
45614  z.real = -a.real;
45615  z.imag = -a.imag;
45616  return z;
45617  }
45618  static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
45619  return (a.real == 0) && (a.imag == 0);
45620  }
45621  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
45622  __pyx_t_float_complex z;
45623  z.real = a.real;
45624  z.imag = -a.imag;
45625  return z;
45626  }
45627  #if 1
45628  static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
45629  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
45630  return sqrtf(z.real*z.real + z.imag*z.imag);
45631  #else
45632  return hypotf(z.real, z.imag);
45633  #endif
45634  }
45635  static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
45636  __pyx_t_float_complex z;
45637  float r, lnr, theta, z_r, z_theta;
45638  if (b.imag == 0 && b.real == (int)b.real) {
45639  if (b.real < 0) {
45640  float denom = a.real * a.real + a.imag * a.imag;
45641  a.real = a.real / denom;
45642  a.imag = -a.imag / denom;
45643  b.real = -b.real;
45644  }
45645  switch ((int)b.real) {
45646  case 0:
45647  z.real = 1;
45648  z.imag = 0;
45649  return z;
45650  case 1:
45651  return a;
45652  case 2:
45653  return __Pyx_c_prod_float(a, a);
45654  case 3:
45655  z = __Pyx_c_prod_float(a, a);
45656  return __Pyx_c_prod_float(z, a);
45657  case 4:
45658  z = __Pyx_c_prod_float(a, a);
45659  return __Pyx_c_prod_float(z, z);
45660  }
45661  }
45662  if (a.imag == 0) {
45663  if (a.real == 0) {
45664  return a;
45665  } else if (b.imag == 0) {
45666  z.real = powf(a.real, b.real);
45667  z.imag = 0;
45668  return z;
45669  } else if (a.real > 0) {
45670  r = a.real;
45671  theta = 0;
45672  } else {
45673  r = -a.real;
45674  theta = atan2f(0.0, -1.0);
45675  }
45676  } else {
45677  r = __Pyx_c_abs_float(a);
45678  theta = atan2f(a.imag, a.real);
45679  }
45680  lnr = logf(r);
45681  z_r = expf(lnr * b.real - theta * b.imag);
45682  z_theta = theta * b.real + lnr * b.imag;
45683  z.real = z_r * cosf(z_theta);
45684  z.imag = z_r * sinf(z_theta);
45685  return z;
45686  }
45687  #endif
45688 #endif
45689 
45690 /* Declarations */
45691  #if CYTHON_CCOMPLEX
45692  #ifdef __cplusplus
45693  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
45694  return ::std::complex< double >(x, y);
45695  }
45696  #else
45697  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
45698  return x + y*(__pyx_t_double_complex)_Complex_I;
45699  }
45700  #endif
45701 #else
45702  static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
45703  __pyx_t_double_complex z;
45704  z.real = x;
45705  z.imag = y;
45706  return z;
45707  }
45708 #endif
45709 
45710 /* Arithmetic */
45711  #if CYTHON_CCOMPLEX
45712 #else
45713  static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45714  return (a.real == b.real) && (a.imag == b.imag);
45715  }
45716  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45717  __pyx_t_double_complex z;
45718  z.real = a.real + b.real;
45719  z.imag = a.imag + b.imag;
45720  return z;
45721  }
45722  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45723  __pyx_t_double_complex z;
45724  z.real = a.real - b.real;
45725  z.imag = a.imag - b.imag;
45726  return z;
45727  }
45728  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45729  __pyx_t_double_complex z;
45730  z.real = a.real * b.real - a.imag * b.imag;
45731  z.imag = a.real * b.imag + a.imag * b.real;
45732  return z;
45733  }
45734  #if 1
45735  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45736  if (b.imag == 0) {
45737  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
45738  } else if (fabs(b.real) >= fabs(b.imag)) {
45739  if (b.real == 0 && b.imag == 0) {
45740  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
45741  } else {
45742  double r = b.imag / b.real;
45743  double s = (double)(1.0) / (b.real + b.imag * r);
45744  return __pyx_t_double_complex_from_parts(
45745  (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
45746  }
45747  } else {
45748  double r = b.real / b.imag;
45749  double s = (double)(1.0) / (b.imag + b.real * r);
45750  return __pyx_t_double_complex_from_parts(
45751  (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
45752  }
45753  }
45754  #else
45755  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45756  if (b.imag == 0) {
45757  return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
45758  } else {
45759  double denom = b.real * b.real + b.imag * b.imag;
45760  return __pyx_t_double_complex_from_parts(
45761  (a.real * b.real + a.imag * b.imag) / denom,
45762  (a.imag * b.real - a.real * b.imag) / denom);
45763  }
45764  }
45765  #endif
45766  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
45767  __pyx_t_double_complex z;
45768  z.real = -a.real;
45769  z.imag = -a.imag;
45770  return z;
45771  }
45772  static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
45773  return (a.real == 0) && (a.imag == 0);
45774  }
45775  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
45776  __pyx_t_double_complex z;
45777  z.real = a.real;
45778  z.imag = -a.imag;
45779  return z;
45780  }
45781  #if 1
45782  static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
45783  #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
45784  return sqrt(z.real*z.real + z.imag*z.imag);
45785  #else
45786  return hypot(z.real, z.imag);
45787  #endif
45788  }
45789  static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
45790  __pyx_t_double_complex z;
45791  double r, lnr, theta, z_r, z_theta;
45792  if (b.imag == 0 && b.real == (int)b.real) {
45793  if (b.real < 0) {
45794  double denom = a.real * a.real + a.imag * a.imag;
45795  a.real = a.real / denom;
45796  a.imag = -a.imag / denom;
45797  b.real = -b.real;
45798  }
45799  switch ((int)b.real) {
45800  case 0:
45801  z.real = 1;
45802  z.imag = 0;
45803  return z;
45804  case 1:
45805  return a;
45806  case 2:
45807  return __Pyx_c_prod_double(a, a);
45808  case 3:
45809  z = __Pyx_c_prod_double(a, a);
45810  return __Pyx_c_prod_double(z, a);
45811  case 4:
45812  z = __Pyx_c_prod_double(a, a);
45813  return __Pyx_c_prod_double(z, z);
45814  }
45815  }
45816  if (a.imag == 0) {
45817  if (a.real == 0) {
45818  return a;
45819  } else if (b.imag == 0) {
45820  z.real = pow(a.real, b.real);
45821  z.imag = 0;
45822  return z;
45823  } else if (a.real > 0) {
45824  r = a.real;
45825  theta = 0;
45826  } else {
45827  r = -a.real;
45828  theta = atan2(0.0, -1.0);
45829  }
45830  } else {
45831  r = __Pyx_c_abs_double(a);
45832  theta = atan2(a.imag, a.real);
45833  }
45834  lnr = log(r);
45835  z_r = exp(lnr * b.real - theta * b.imag);
45836  z_theta = theta * b.real + lnr * b.imag;
45837  z.real = z_r * cos(z_theta);
45838  z.imag = z_r * sin(z_theta);
45839  return z;
45840  }
45841  #endif
45842 #endif
45843 
45844 /* MemviewSliceCopyTemplate */
45845  static __Pyx_memviewslice
45846 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
45847  const char *mode, int ndim,
45848  size_t sizeof_dtype, int contig_flag,
45849  int dtype_is_object)
45850 {
45851  __Pyx_RefNannyDeclarations
45852  int i;
45853  __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
45854  struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
45855  Py_buffer *buf = &from_memview->view;
45856  PyObject *shape_tuple = NULL;
45857  PyObject *temp_int = NULL;
45858  struct __pyx_array_obj *array_obj = NULL;
45859  struct __pyx_memoryview_obj *memview_obj = NULL;
45860  __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
45861  for (i = 0; i < ndim; i++) {
45862  if (unlikely(from_mvs->suboffsets[i] >= 0)) {
45863  PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
45864  "indirect dimensions (axis %d)", i);
45865  goto fail;
45866  }
45867  }
45868  shape_tuple = PyTuple_New(ndim);
45869  if (unlikely(!shape_tuple)) {
45870  goto fail;
45871  }
45872  __Pyx_GOTREF(shape_tuple);
45873  for(i = 0; i < ndim; i++) {
45874  temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
45875  if(unlikely(!temp_int)) {
45876  goto fail;
45877  } else {
45878  PyTuple_SET_ITEM(shape_tuple, i, temp_int);
45879  temp_int = NULL;
45880  }
45881  }
45882  array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
45883  if (unlikely(!array_obj)) {
45884  goto fail;
45885  }
45886  __Pyx_GOTREF(array_obj);
45887  memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
45888  (PyObject *) array_obj, contig_flag,
45889  dtype_is_object,
45890  from_mvs->memview->typeinfo);
45891  if (unlikely(!memview_obj))
45892  goto fail;
45893  if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
45894  goto fail;
45895  if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
45896  dtype_is_object) < 0))
45897  goto fail;
45898  goto no_fail;
45899 fail:
45900  __Pyx_XDECREF(new_mvs.memview);
45901  new_mvs.memview = NULL;
45902  new_mvs.data = NULL;
45903 no_fail:
45904  __Pyx_XDECREF(shape_tuple);
45905  __Pyx_XDECREF(temp_int);
45906  __Pyx_XDECREF(array_obj);
45907  __Pyx_RefNannyFinishContext();
45908  return new_mvs;
45909 }
45910 
45911 /* CIntFromPy */
45912  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
45913 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
45914 #pragma GCC diagnostic push
45915 #pragma GCC diagnostic ignored "-Wconversion"
45916 #endif
45917  const int neg_one = (int) -1, const_zero = (int) 0;
45918 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
45919 #pragma GCC diagnostic pop
45920 #endif
45921  const int is_unsigned = neg_one > const_zero;
45922 #if PY_MAJOR_VERSION < 3
45923  if (likely(PyInt_Check(x))) {
45924  if (sizeof(int) < sizeof(long)) {
45925  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
45926  } else {
45927  long val = PyInt_AS_LONG(x);
45928  if (is_unsigned && unlikely(val < 0)) {
45929  goto raise_neg_overflow;
45930  }
45931  return (int) val;
45932  }
45933  } else
45934 #endif
45935  if (likely(PyLong_Check(x))) {
45936  if (is_unsigned) {
45937 #if CYTHON_USE_PYLONG_INTERNALS
45938  const digit* digits = ((PyLongObject*)x)->ob_digit;
45939  switch (Py_SIZE(x)) {
45940  case 0: return (int) 0;
45941  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
45942  case 2:
45943  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
45944  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
45945  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
45946  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
45947  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
45948  }
45949  }
45950  break;
45951  case 3:
45952  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
45953  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
45954  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
45955  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
45956  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
45957  }
45958  }
45959  break;
45960  case 4:
45961  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
45962  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
45963  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
45964  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
45965  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
45966  }
45967  }
45968  break;
45969  }
45970 #endif
45971 #if CYTHON_COMPILING_IN_CPYTHON
45972  if (unlikely(Py_SIZE(x) < 0)) {
45973  goto raise_neg_overflow;
45974  }
45975 #else
45976  {
45977  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
45978  if (unlikely(result < 0))
45979  return (int) -1;
45980  if (unlikely(result == 1))
45981  goto raise_neg_overflow;
45982  }
45983 #endif
45984  if (sizeof(int) <= sizeof(unsigned long)) {
45985  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
45986 #ifdef HAVE_LONG_LONG
45987  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
45988  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
45989 #endif
45990  }
45991  } else {
45992 #if CYTHON_USE_PYLONG_INTERNALS
45993  const digit* digits = ((PyLongObject*)x)->ob_digit;
45994  switch (Py_SIZE(x)) {
45995  case 0: return (int) 0;
45996  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
45997  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
45998  case -2:
45999  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
46000  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46001  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46002  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
46003  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
46004  }
46005  }
46006  break;
46007  case 2:
46008  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
46009  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46010  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46011  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
46012  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
46013  }
46014  }
46015  break;
46016  case -3:
46017  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
46018  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46019  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46020  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
46021  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
46022  }
46023  }
46024  break;
46025  case 3:
46026  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
46027  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46028  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46029  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
46030  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
46031  }
46032  }
46033  break;
46034  case -4:
46035  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
46036  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46037  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46038  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
46039  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
46040  }
46041  }
46042  break;
46043  case 4:
46044  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
46045  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46046  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46047  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
46048  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
46049  }
46050  }
46051  break;
46052  }
46053 #endif
46054  if (sizeof(int) <= sizeof(long)) {
46055  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
46056 #ifdef HAVE_LONG_LONG
46057  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
46058  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
46059 #endif
46060  }
46061  }
46062  {
46063 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
46064  PyErr_SetString(PyExc_RuntimeError,
46065  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
46066 #else
46067  int val;
46068  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
46069  #if PY_MAJOR_VERSION < 3
46070  if (likely(v) && !PyLong_Check(v)) {
46071  PyObject *tmp = v;
46072  v = PyNumber_Long(tmp);
46073  Py_DECREF(tmp);
46074  }
46075  #endif
46076  if (likely(v)) {
46077  int one = 1; int is_little = (int)*(unsigned char *)&one;
46078  unsigned char *bytes = (unsigned char *)&val;
46079  int ret = _PyLong_AsByteArray((PyLongObject *)v,
46080  bytes, sizeof(val),
46081  is_little, !is_unsigned);
46082  Py_DECREF(v);
46083  if (likely(!ret))
46084  return val;
46085  }
46086 #endif
46087  return (int) -1;
46088  }
46089  } else {
46090  int val;
46091  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
46092  if (!tmp) return (int) -1;
46093  val = __Pyx_PyInt_As_int(tmp);
46094  Py_DECREF(tmp);
46095  return val;
46096  }
46097 raise_overflow:
46098  PyErr_SetString(PyExc_OverflowError,
46099  "value too large to convert to int");
46100  return (int) -1;
46101 raise_neg_overflow:
46102  PyErr_SetString(PyExc_OverflowError,
46103  "can't convert negative value to int");
46104  return (int) -1;
46105 }
46106 
46107 /* CIntToPy */
46108  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
46109 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46110 #pragma GCC diagnostic push
46111 #pragma GCC diagnostic ignored "-Wconversion"
46112 #endif
46113  const int neg_one = (int) -1, const_zero = (int) 0;
46114 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46115 #pragma GCC diagnostic pop
46116 #endif
46117  const int is_unsigned = neg_one > const_zero;
46118  if (is_unsigned) {
46119  if (sizeof(int) < sizeof(long)) {
46120  return PyInt_FromLong((long) value);
46121  } else if (sizeof(int) <= sizeof(unsigned long)) {
46122  return PyLong_FromUnsignedLong((unsigned long) value);
46123 #ifdef HAVE_LONG_LONG
46124  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
46125  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
46126 #endif
46127  }
46128  } else {
46129  if (sizeof(int) <= sizeof(long)) {
46130  return PyInt_FromLong((long) value);
46131 #ifdef HAVE_LONG_LONG
46132  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
46133  return PyLong_FromLongLong((PY_LONG_LONG) value);
46134 #endif
46135  }
46136  }
46137  {
46138  int one = 1; int little = (int)*(unsigned char *)&one;
46139  unsigned char *bytes = (unsigned char *)&value;
46140  return _PyLong_FromByteArray(bytes, sizeof(int),
46141  little, !is_unsigned);
46142  }
46143 }
46144 
46145 /* CIntFromPy */
46146  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
46147 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46148 #pragma GCC diagnostic push
46149 #pragma GCC diagnostic ignored "-Wconversion"
46150 #endif
46151  const long neg_one = (long) -1, const_zero = (long) 0;
46152 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46153 #pragma GCC diagnostic pop
46154 #endif
46155  const int is_unsigned = neg_one > const_zero;
46156 #if PY_MAJOR_VERSION < 3
46157  if (likely(PyInt_Check(x))) {
46158  if (sizeof(long) < sizeof(long)) {
46159  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
46160  } else {
46161  long val = PyInt_AS_LONG(x);
46162  if (is_unsigned && unlikely(val < 0)) {
46163  goto raise_neg_overflow;
46164  }
46165  return (long) val;
46166  }
46167  } else
46168 #endif
46169  if (likely(PyLong_Check(x))) {
46170  if (is_unsigned) {
46171 #if CYTHON_USE_PYLONG_INTERNALS
46172  const digit* digits = ((PyLongObject*)x)->ob_digit;
46173  switch (Py_SIZE(x)) {
46174  case 0: return (long) 0;
46175  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
46176  case 2:
46177  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
46178  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46179  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46180  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
46181  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
46182  }
46183  }
46184  break;
46185  case 3:
46186  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
46187  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46188  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46189  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
46190  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
46191  }
46192  }
46193  break;
46194  case 4:
46195  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
46196  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46197  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46198  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
46199  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
46200  }
46201  }
46202  break;
46203  }
46204 #endif
46205 #if CYTHON_COMPILING_IN_CPYTHON
46206  if (unlikely(Py_SIZE(x) < 0)) {
46207  goto raise_neg_overflow;
46208  }
46209 #else
46210  {
46211  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
46212  if (unlikely(result < 0))
46213  return (long) -1;
46214  if (unlikely(result == 1))
46215  goto raise_neg_overflow;
46216  }
46217 #endif
46218  if (sizeof(long) <= sizeof(unsigned long)) {
46219  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
46220 #ifdef HAVE_LONG_LONG
46221  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
46222  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
46223 #endif
46224  }
46225  } else {
46226 #if CYTHON_USE_PYLONG_INTERNALS
46227  const digit* digits = ((PyLongObject*)x)->ob_digit;
46228  switch (Py_SIZE(x)) {
46229  case 0: return (long) 0;
46230  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
46231  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
46232  case -2:
46233  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
46234  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46235  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46236  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
46237  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
46238  }
46239  }
46240  break;
46241  case 2:
46242  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
46243  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46244  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46245  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
46246  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
46247  }
46248  }
46249  break;
46250  case -3:
46251  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
46252  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46253  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46254  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
46255  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
46256  }
46257  }
46258  break;
46259  case 3:
46260  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
46261  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46262  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46263  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
46264  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
46265  }
46266  }
46267  break;
46268  case -4:
46269  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
46270  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46271  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46272  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
46273  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
46274  }
46275  }
46276  break;
46277  case 4:
46278  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
46279  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46280  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46281  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
46282  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
46283  }
46284  }
46285  break;
46286  }
46287 #endif
46288  if (sizeof(long) <= sizeof(long)) {
46289  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
46290 #ifdef HAVE_LONG_LONG
46291  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
46292  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
46293 #endif
46294  }
46295  }
46296  {
46297 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
46298  PyErr_SetString(PyExc_RuntimeError,
46299  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
46300 #else
46301  long val;
46302  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
46303  #if PY_MAJOR_VERSION < 3
46304  if (likely(v) && !PyLong_Check(v)) {
46305  PyObject *tmp = v;
46306  v = PyNumber_Long(tmp);
46307  Py_DECREF(tmp);
46308  }
46309  #endif
46310  if (likely(v)) {
46311  int one = 1; int is_little = (int)*(unsigned char *)&one;
46312  unsigned char *bytes = (unsigned char *)&val;
46313  int ret = _PyLong_AsByteArray((PyLongObject *)v,
46314  bytes, sizeof(val),
46315  is_little, !is_unsigned);
46316  Py_DECREF(v);
46317  if (likely(!ret))
46318  return val;
46319  }
46320 #endif
46321  return (long) -1;
46322  }
46323  } else {
46324  long val;
46325  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
46326  if (!tmp) return (long) -1;
46327  val = __Pyx_PyInt_As_long(tmp);
46328  Py_DECREF(tmp);
46329  return val;
46330  }
46331 raise_overflow:
46332  PyErr_SetString(PyExc_OverflowError,
46333  "value too large to convert to long");
46334  return (long) -1;
46335 raise_neg_overflow:
46336  PyErr_SetString(PyExc_OverflowError,
46337  "can't convert negative value to long");
46338  return (long) -1;
46339 }
46340 
46341 /* TypeInfoToFormat */
46342  static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type) {
46343  struct __pyx_typeinfo_string result = { {0} };
46344  char *buf = (char *) result.string;
46345  size_t size = type->size;
46346  switch (type->typegroup) {
46347  case 'H':
46348  *buf = 'c';
46349  break;
46350  case 'I':
46351  case 'U':
46352  if (size == 1)
46353  *buf = (type->is_unsigned) ? 'B' : 'b';
46354  else if (size == 2)
46355  *buf = (type->is_unsigned) ? 'H' : 'h';
46356  else if (size == 4)
46357  *buf = (type->is_unsigned) ? 'I' : 'i';
46358  else if (size == 8)
46359  *buf = (type->is_unsigned) ? 'Q' : 'q';
46360  break;
46361  case 'P':
46362  *buf = 'P';
46363  break;
46364  case 'C':
46365  {
46366  __Pyx_TypeInfo complex_type = *type;
46367  complex_type.typegroup = 'R';
46368  complex_type.size /= 2;
46369  *buf++ = 'Z';
46370  *buf = __Pyx_TypeInfoToFormat(&complex_type).string[0];
46371  break;
46372  }
46373  case 'R':
46374  if (size == 4)
46375  *buf = 'f';
46376  else if (size == 8)
46377  *buf = 'd';
46378  else
46379  *buf = 'g';
46380  break;
46381  }
46382  return result;
46383 }
46384 
46385 /* CIntToPy */
46386  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
46387 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46388 #pragma GCC diagnostic push
46389 #pragma GCC diagnostic ignored "-Wconversion"
46390 #endif
46391  const long neg_one = (long) -1, const_zero = (long) 0;
46392 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46393 #pragma GCC diagnostic pop
46394 #endif
46395  const int is_unsigned = neg_one > const_zero;
46396  if (is_unsigned) {
46397  if (sizeof(long) < sizeof(long)) {
46398  return PyInt_FromLong((long) value);
46399  } else if (sizeof(long) <= sizeof(unsigned long)) {
46400  return PyLong_FromUnsignedLong((unsigned long) value);
46401 #ifdef HAVE_LONG_LONG
46402  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
46403  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
46404 #endif
46405  }
46406  } else {
46407  if (sizeof(long) <= sizeof(long)) {
46408  return PyInt_FromLong((long) value);
46409 #ifdef HAVE_LONG_LONG
46410  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
46411  return PyLong_FromLongLong((PY_LONG_LONG) value);
46412 #endif
46413  }
46414  }
46415  {
46416  int one = 1; int little = (int)*(unsigned char *)&one;
46417  unsigned char *bytes = (unsigned char *)&value;
46418  return _PyLong_FromByteArray(bytes, sizeof(long),
46419  little, !is_unsigned);
46420  }
46421 }
46422 
46423 /* CIntFromPy */
46424  static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
46425 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46426 #pragma GCC diagnostic push
46427 #pragma GCC diagnostic ignored "-Wconversion"
46428 #endif
46429  const char neg_one = (char) -1, const_zero = (char) 0;
46430 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
46431 #pragma GCC diagnostic pop
46432 #endif
46433  const int is_unsigned = neg_one > const_zero;
46434 #if PY_MAJOR_VERSION < 3
46435  if (likely(PyInt_Check(x))) {
46436  if (sizeof(char) < sizeof(long)) {
46437  __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
46438  } else {
46439  long val = PyInt_AS_LONG(x);
46440  if (is_unsigned && unlikely(val < 0)) {
46441  goto raise_neg_overflow;
46442  }
46443  return (char) val;
46444  }
46445  } else
46446 #endif
46447  if (likely(PyLong_Check(x))) {
46448  if (is_unsigned) {
46449 #if CYTHON_USE_PYLONG_INTERNALS
46450  const digit* digits = ((PyLongObject*)x)->ob_digit;
46451  switch (Py_SIZE(x)) {
46452  case 0: return (char) 0;
46453  case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
46454  case 2:
46455  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
46456  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46457  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46458  } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
46459  return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
46460  }
46461  }
46462  break;
46463  case 3:
46464  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
46465  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46466  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46467  } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
46468  return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
46469  }
46470  }
46471  break;
46472  case 4:
46473  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
46474  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46475  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46476  } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
46477  return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
46478  }
46479  }
46480  break;
46481  }
46482 #endif
46483 #if CYTHON_COMPILING_IN_CPYTHON
46484  if (unlikely(Py_SIZE(x) < 0)) {
46485  goto raise_neg_overflow;
46486  }
46487 #else
46488  {
46489  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
46490  if (unlikely(result < 0))
46491  return (char) -1;
46492  if (unlikely(result == 1))
46493  goto raise_neg_overflow;
46494  }
46495 #endif
46496  if (sizeof(char) <= sizeof(unsigned long)) {
46497  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
46498 #ifdef HAVE_LONG_LONG
46499  } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
46500  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
46501 #endif
46502  }
46503  } else {
46504 #if CYTHON_USE_PYLONG_INTERNALS
46505  const digit* digits = ((PyLongObject*)x)->ob_digit;
46506  switch (Py_SIZE(x)) {
46507  case 0: return (char) 0;
46508  case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
46509  case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
46510  case -2:
46511  if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
46512  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46513  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46514  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
46515  return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
46516  }
46517  }
46518  break;
46519  case 2:
46520  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
46521  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
46522  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46523  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
46524  return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
46525  }
46526  }
46527  break;
46528  case -3:
46529  if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
46530  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46531  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46532  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
46533  return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
46534  }
46535  }
46536  break;
46537  case 3:
46538  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
46539  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
46540  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46541  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
46542  return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
46543  }
46544  }
46545  break;
46546  case -4:
46547  if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
46548  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46549  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46550  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
46551  return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
46552  }
46553  }
46554  break;
46555  case 4:
46556  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
46557  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
46558  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
46559  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
46560  return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
46561  }
46562  }
46563  break;
46564  }
46565 #endif
46566  if (sizeof(char) <= sizeof(long)) {
46567  __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
46568 #ifdef HAVE_LONG_LONG
46569  } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
46570  __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
46571 #endif
46572  }
46573  }
46574  {
46575 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
46576  PyErr_SetString(PyExc_RuntimeError,
46577  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
46578 #else
46579  char val;
46580  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
46581  #if PY_MAJOR_VERSION < 3
46582  if (likely(v) && !PyLong_Check(v)) {
46583  PyObject *tmp = v;
46584  v = PyNumber_Long(tmp);
46585  Py_DECREF(tmp);
46586  }
46587  #endif
46588  if (likely(v)) {
46589  int one = 1; int is_little = (int)*(unsigned char *)&one;
46590  unsigned char *bytes = (unsigned char *)&val;
46591  int ret = _PyLong_AsByteArray((PyLongObject *)v,
46592  bytes, sizeof(val),
46593  is_little, !is_unsigned);
46594  Py_DECREF(v);
46595  if (likely(!ret))
46596  return val;
46597  }
46598 #endif
46599  return (char) -1;
46600  }
46601  } else {
46602  char val;
46603  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
46604  if (!tmp) return (char) -1;
46605  val = __Pyx_PyInt_As_char(tmp);
46606  Py_DECREF(tmp);
46607  return val;
46608  }
46609 raise_overflow:
46610  PyErr_SetString(PyExc_OverflowError,
46611  "value too large to convert to char");
46612  return (char) -1;
46613 raise_neg_overflow:
46614  PyErr_SetString(PyExc_OverflowError,
46615  "can't convert negative value to char");
46616  return (char) -1;
46617 }
46618 
46619 /* FetchCommonType */
46620  static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
46621  PyObject* fake_module;
46622  PyTypeObject* cached_type = NULL;
46623  fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
46624  if (!fake_module) return NULL;
46625  Py_INCREF(fake_module);
46626  cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
46627  if (cached_type) {
46628  if (!PyType_Check((PyObject*)cached_type)) {
46629  PyErr_Format(PyExc_TypeError,
46630  "Shared Cython type %.200s is not a type object",
46631  type->tp_name);
46632  goto bad;
46633  }
46634  if (cached_type->tp_basicsize != type->tp_basicsize) {
46635  PyErr_Format(PyExc_TypeError,
46636  "Shared Cython type %.200s has the wrong size, try recompiling",
46637  type->tp_name);
46638  goto bad;
46639  }
46640  } else {
46641  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
46642  PyErr_Clear();
46643  if (PyType_Ready(type) < 0) goto bad;
46644  if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
46645  goto bad;
46646  Py_INCREF(type);
46647  cached_type = type;
46648  }
46649 done:
46650  Py_DECREF(fake_module);
46651  return cached_type;
46652 bad:
46653  Py_XDECREF(cached_type);
46654  cached_type = NULL;
46655  goto done;
46656 }
46657 
46658 /* PyObjectGetMethod */
46659  static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
46660  PyObject *attr;
46661 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
46662  PyTypeObject *tp = Py_TYPE(obj);
46663  PyObject *descr;
46664  descrgetfunc f = NULL;
46665  PyObject **dictptr, *dict;
46666  int meth_found = 0;
46667  assert (*method == NULL);
46668  if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
46669  attr = __Pyx_PyObject_GetAttrStr(obj, name);
46670  goto try_unpack;
46671  }
46672  if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
46673  return 0;
46674  }
46675  descr = _PyType_Lookup(tp, name);
46676  if (likely(descr != NULL)) {
46677  Py_INCREF(descr);
46678 #if PY_MAJOR_VERSION >= 3
46679  #ifdef __Pyx_CyFunction_USED
46680  if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
46681  #else
46682  if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
46683  #endif
46684 #else
46685  #ifdef __Pyx_CyFunction_USED
46686  if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
46687  #else
46688  if (likely(PyFunction_Check(descr)))
46689  #endif
46690 #endif
46691  {
46692  meth_found = 1;
46693  } else {
46694  f = Py_TYPE(descr)->tp_descr_get;
46695  if (f != NULL && PyDescr_IsData(descr)) {
46696  attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
46697  Py_DECREF(descr);
46698  goto try_unpack;
46699  }
46700  }
46701  }
46702  dictptr = _PyObject_GetDictPtr(obj);
46703  if (dictptr != NULL && (dict = *dictptr) != NULL) {
46704  Py_INCREF(dict);
46705  attr = __Pyx_PyDict_GetItemStr(dict, name);
46706  if (attr != NULL) {
46707  Py_INCREF(attr);
46708  Py_DECREF(dict);
46709  Py_XDECREF(descr);
46710  goto try_unpack;
46711  }
46712  Py_DECREF(dict);
46713  }
46714  if (meth_found) {
46715  *method = descr;
46716  return 1;
46717  }
46718  if (f != NULL) {
46719  attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
46720  Py_DECREF(descr);
46721  goto try_unpack;
46722  }
46723  if (descr != NULL) {
46724  *method = descr;
46725  return 0;
46726  }
46727  PyErr_Format(PyExc_AttributeError,
46728 #if PY_MAJOR_VERSION >= 3
46729  "'%.50s' object has no attribute '%U'",
46730  tp->tp_name, name);
46731 #else
46732  "'%.50s' object has no attribute '%.400s'",
46733  tp->tp_name, PyString_AS_STRING(name));
46734 #endif
46735  return 0;
46736 #else
46737  attr = __Pyx_PyObject_GetAttrStr(obj, name);
46738  goto try_unpack;
46739 #endif
46740 try_unpack:
46741 #if CYTHON_UNPACK_METHODS
46742  if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
46743  PyObject *function = PyMethod_GET_FUNCTION(attr);
46744  Py_INCREF(function);
46745  Py_DECREF(attr);
46746  *method = function;
46747  return 1;
46748  }
46749 #endif
46750  *method = attr;
46751  return 0;
46752 }
46753 
46754 /* PyObjectCallMethod1 */
46755  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
46756  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
46757  Py_DECREF(method);
46758  return result;
46759 }
46760 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
46761  PyObject *method = NULL, *result;
46762  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
46763  if (likely(is_method)) {
46764  result = __Pyx_PyObject_Call2Args(method, obj, arg);
46765  Py_DECREF(method);
46766  return result;
46767  }
46768  if (unlikely(!method)) return NULL;
46769  return __Pyx__PyObject_CallMethod1(method, arg);
46770 }
46771 
46772 /* CoroutineBase */
46773  #include <structmember.h>
46774 #include <frameobject.h>
46775 #if PY_VERSION_HEX >= 0x030b00a6
46776  #ifndef Py_BUILD_CORE
46777  #define Py_BUILD_CORE 1
46778  #endif
46779  #include "internal/pycore_frame.h"
46780 #endif
46781 #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom)
46782 static int __Pyx_PyGen__FetchStopIterationValue(CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject **pvalue) {
46783  PyObject *et, *ev, *tb;
46784  PyObject *value = NULL;
46785  __Pyx_ErrFetch(&et, &ev, &tb);
46786  if (!et) {
46787  Py_XDECREF(tb);
46788  Py_XDECREF(ev);
46789  Py_INCREF(Py_None);
46790  *pvalue = Py_None;
46791  return 0;
46792  }
46793  if (likely(et == PyExc_StopIteration)) {
46794  if (!ev) {
46795  Py_INCREF(Py_None);
46796  value = Py_None;
46797  }
46798 #if PY_VERSION_HEX >= 0x030300A0
46799  else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) {
46800  value = ((PyStopIterationObject *)ev)->value;
46801  Py_INCREF(value);
46802  Py_DECREF(ev);
46803  }
46804 #endif
46805  else if (unlikely(PyTuple_Check(ev))) {
46806  if (PyTuple_GET_SIZE(ev) >= 1) {
46807 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
46808  value = PyTuple_GET_ITEM(ev, 0);
46809  Py_INCREF(value);
46810 #else
46811  value = PySequence_ITEM(ev, 0);
46812 #endif
46813  } else {
46814  Py_INCREF(Py_None);
46815  value = Py_None;
46816  }
46817  Py_DECREF(ev);
46818  }
46819  else if (!__Pyx_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) {
46820  value = ev;
46821  }
46822  if (likely(value)) {
46823  Py_XDECREF(tb);
46824  Py_DECREF(et);
46825  *pvalue = value;
46826  return 0;
46827  }
46828  } else if (!__Pyx_PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) {
46829  __Pyx_ErrRestore(et, ev, tb);
46830  return -1;
46831  }
46832  PyErr_NormalizeException(&et, &ev, &tb);
46833  if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) {
46834  __Pyx_ErrRestore(et, ev, tb);
46835  return -1;
46836  }
46837  Py_XDECREF(tb);
46838  Py_DECREF(et);
46839 #if PY_VERSION_HEX >= 0x030300A0
46840  value = ((PyStopIterationObject *)ev)->value;
46841  Py_INCREF(value);
46842  Py_DECREF(ev);
46843 #else
46844  {
46845  PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args_2);
46846  Py_DECREF(ev);
46847  if (likely(args)) {
46848  value = PySequence_GetItem(args, 0);
46849  Py_DECREF(args);
46850  }
46851  if (unlikely(!value)) {
46852  __Pyx_ErrRestore(NULL, NULL, NULL);
46853  Py_INCREF(Py_None);
46854  value = Py_None;
46855  }
46856  }
46857 #endif
46858  *pvalue = value;
46859  return 0;
46860 }
46861 static CYTHON_INLINE
46862 void __Pyx_Coroutine_ExceptionClear(__Pyx_ExcInfoStruct *exc_state) {
46863  PyObject *t, *v, *tb;
46864  t = exc_state->exc_type;
46865  v = exc_state->exc_value;
46866  tb = exc_state->exc_traceback;
46867  exc_state->exc_type = NULL;
46868  exc_state->exc_value = NULL;
46869  exc_state->exc_traceback = NULL;
46870  Py_XDECREF(t);
46871  Py_XDECREF(v);
46872  Py_XDECREF(tb);
46873 }
46874 #define __Pyx_Coroutine_AlreadyRunningError(gen) (__Pyx__Coroutine_AlreadyRunningError(gen), (PyObject*)NULL)
46875 static void __Pyx__Coroutine_AlreadyRunningError(CYTHON_UNUSED __pyx_CoroutineObject *gen) {
46876  const char *msg;
46877  if ((0)) {
46878  #ifdef __Pyx_Coroutine_USED
46879  } else if (__Pyx_Coroutine_Check((PyObject*)gen)) {
46880  msg = "coroutine already executing";
46881  #endif
46882  #ifdef __Pyx_AsyncGen_USED
46883  } else if (__Pyx_AsyncGen_CheckExact((PyObject*)gen)) {
46884  msg = "async generator already executing";
46885  #endif
46886  } else {
46887  msg = "generator already executing";
46888  }
46889  PyErr_SetString(PyExc_ValueError, msg);
46890 }
46891 #define __Pyx_Coroutine_NotStartedError(gen) (__Pyx__Coroutine_NotStartedError(gen), (PyObject*)NULL)
46892 static void __Pyx__Coroutine_NotStartedError(CYTHON_UNUSED PyObject *gen) {
46893  const char *msg;
46894  if ((0)) {
46895  #ifdef __Pyx_Coroutine_USED
46896  } else if (__Pyx_Coroutine_Check(gen)) {
46897  msg = "can't send non-None value to a just-started coroutine";
46898  #endif
46899  #ifdef __Pyx_AsyncGen_USED
46900  } else if (__Pyx_AsyncGen_CheckExact(gen)) {
46901  msg = "can't send non-None value to a just-started async generator";
46902  #endif
46903  } else {
46904  msg = "can't send non-None value to a just-started generator";
46905  }
46906  PyErr_SetString(PyExc_TypeError, msg);
46907 }
46908 #define __Pyx_Coroutine_AlreadyTerminatedError(gen, value, closing) (__Pyx__Coroutine_AlreadyTerminatedError(gen, value, closing), (PyObject*)NULL)
46909 static void __Pyx__Coroutine_AlreadyTerminatedError(CYTHON_UNUSED PyObject *gen, PyObject *value, CYTHON_UNUSED int closing) {
46910  #ifdef __Pyx_Coroutine_USED
46911  if (!closing && __Pyx_Coroutine_Check(gen)) {
46912  PyErr_SetString(PyExc_RuntimeError, "cannot reuse already awaited coroutine");
46913  } else
46914  #endif
46915  if (value) {
46916  #ifdef __Pyx_AsyncGen_USED
46917  if (__Pyx_AsyncGen_CheckExact(gen))
46918  PyErr_SetNone(__Pyx_PyExc_StopAsyncIteration);
46919  else
46920  #endif
46921  PyErr_SetNone(PyExc_StopIteration);
46922  }
46923 }
46924 static
46925 PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value, int closing) {
46926  __Pyx_PyThreadState_declare
46927  PyThreadState *tstate;
46928  __Pyx_ExcInfoStruct *exc_state;
46929  PyObject *retval;
46930  assert(!self->is_running);
46931  if (unlikely(self->resume_label == 0)) {
46932  if (unlikely(value && value != Py_None)) {
46933  return __Pyx_Coroutine_NotStartedError((PyObject*)self);
46934  }
46935  }
46936  if (unlikely(self->resume_label == -1)) {
46937  return __Pyx_Coroutine_AlreadyTerminatedError((PyObject*)self, value, closing);
46938  }
46939 #if CYTHON_FAST_THREAD_STATE
46940  __Pyx_PyThreadState_assign
46941  tstate = __pyx_tstate;
46942 #else
46943  tstate = __Pyx_PyThreadState_Current;
46944 #endif
46945  exc_state = &self->gi_exc_state;
46946  if (exc_state->exc_type) {
46947  #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
46948  #else
46949  if (exc_state->exc_traceback) {
46950  PyTracebackObject *tb = (PyTracebackObject *) exc_state->exc_traceback;
46951  PyFrameObject *f = tb->tb_frame;
46952  assert(f->f_back == NULL);
46953  #if PY_VERSION_HEX >= 0x030B00A1
46954  f->f_back = PyThreadState_GetFrame(tstate);
46955  #else
46956  Py_XINCREF(tstate->frame);
46957  f->f_back = tstate->frame;
46958  #endif
46959  }
46960  #endif
46961  }
46962 #if CYTHON_USE_EXC_INFO_STACK
46963  exc_state->previous_item = tstate->exc_info;
46964  tstate->exc_info = exc_state;
46965 #else
46966  if (exc_state->exc_type) {
46967  __Pyx_ExceptionSwap(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
46968  } else {
46969  __Pyx_Coroutine_ExceptionClear(exc_state);
46970  __Pyx_ExceptionSave(&exc_state->exc_type, &exc_state->exc_value, &exc_state->exc_traceback);
46971  }
46972 #endif
46973  self->is_running = 1;
46974  retval = self->body((PyObject *) self, tstate, value);
46975  self->is_running = 0;
46976 #if CYTHON_USE_EXC_INFO_STACK
46977  exc_state = &self->gi_exc_state;
46978  tstate->exc_info = exc_state->previous_item;
46979  exc_state->previous_item = NULL;
46980  __Pyx_Coroutine_ResetFrameBackpointer(exc_state);
46981 #endif
46982  return retval;
46983 }
46984 static CYTHON_INLINE void __Pyx_Coroutine_ResetFrameBackpointer(__Pyx_ExcInfoStruct *exc_state) {
46985  PyObject *exc_tb = exc_state->exc_traceback;
46986  if (likely(exc_tb)) {
46987 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
46988 #else
46989  PyTracebackObject *tb = (PyTracebackObject *) exc_tb;
46990  PyFrameObject *f = tb->tb_frame;
46991  Py_CLEAR(f->f_back);
46992 #endif
46993  }
46994 }
46995 static CYTHON_INLINE
46996 PyObject *__Pyx_Coroutine_MethodReturn(CYTHON_UNUSED PyObject* gen, PyObject *retval) {
46997  if (unlikely(!retval)) {
46998  __Pyx_PyThreadState_declare
46999  __Pyx_PyThreadState_assign
47000  if (!__Pyx_PyErr_Occurred()) {
47001  PyObject *exc = PyExc_StopIteration;
47002  #ifdef __Pyx_AsyncGen_USED
47003  if (__Pyx_AsyncGen_CheckExact(gen))
47004  exc = __Pyx_PyExc_StopAsyncIteration;
47005  #endif
47006  __Pyx_PyErr_SetNone(exc);
47007  }
47008  }
47009  return retval;
47010 }
47011 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
47012 static CYTHON_INLINE
47013 PyObject *__Pyx_PyGen_Send(PyGenObject *gen, PyObject *arg) {
47014 #if PY_VERSION_HEX <= 0x030A00A1
47015  return _PyGen_Send(gen, arg);
47016 #else
47017  PyObject *result;
47018  if (PyIter_Send((PyObject*)gen, arg ? arg : Py_None, &result) == PYGEN_RETURN) {
47019  if (PyAsyncGen_CheckExact(gen)) {
47020  assert(result == Py_None);
47021  PyErr_SetNone(PyExc_StopAsyncIteration);
47022  }
47023  else if (result == Py_None) {
47024  PyErr_SetNone(PyExc_StopIteration);
47025  }
47026  else {
47027  _PyGen_SetStopIterationValue(result);
47028  }
47029  Py_CLEAR(result);
47030  }
47031  return result;
47032 #endif
47033 }
47034 #endif
47035 static CYTHON_INLINE
47036 PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) {
47037  PyObject *ret;
47038  PyObject *val = NULL;
47039  __Pyx_Coroutine_Undelegate(gen);
47040  __Pyx_PyGen__FetchStopIterationValue(__Pyx_PyThreadState_Current, &val);
47041  ret = __Pyx_Coroutine_SendEx(gen, val, 0);
47042  Py_XDECREF(val);
47043  return ret;
47044 }
47045 static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
47046  PyObject *retval;
47047  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
47048  PyObject *yf = gen->yieldfrom;
47049  if (unlikely(gen->is_running))
47050  return __Pyx_Coroutine_AlreadyRunningError(gen);
47051  if (yf) {
47052  PyObject *ret;
47053  gen->is_running = 1;
47054  #ifdef __Pyx_Generator_USED
47055  if (__Pyx_Generator_CheckExact(yf)) {
47056  ret = __Pyx_Coroutine_Send(yf, value);
47057  } else
47058  #endif
47059  #ifdef __Pyx_Coroutine_USED
47060  if (__Pyx_Coroutine_Check(yf)) {
47061  ret = __Pyx_Coroutine_Send(yf, value);
47062  } else
47063  #endif
47064  #ifdef __Pyx_AsyncGen_USED
47065  if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
47066  ret = __Pyx_async_gen_asend_send(yf, value);
47067  } else
47068  #endif
47069  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
47070  if (PyGen_CheckExact(yf)) {
47071  ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
47072  } else
47073  #endif
47074  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03050000 && defined(PyCoro_CheckExact) && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
47075  if (PyCoro_CheckExact(yf)) {
47076  ret = __Pyx_PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
47077  } else
47078  #endif
47079  {
47080  if (value == Py_None)
47081  ret = Py_TYPE(yf)->tp_iternext(yf);
47082  else
47083  ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value);
47084  }
47085  gen->is_running = 0;
47086  if (likely(ret)) {
47087  return ret;
47088  }
47089  retval = __Pyx_Coroutine_FinishDelegation(gen);
47090  } else {
47091  retval = __Pyx_Coroutine_SendEx(gen, value, 0);
47092  }
47093  return __Pyx_Coroutine_MethodReturn(self, retval);
47094 }
47095 static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) {
47096  PyObject *retval = NULL;
47097  int err = 0;
47098  #ifdef __Pyx_Generator_USED
47099  if (__Pyx_Generator_CheckExact(yf)) {
47100  retval = __Pyx_Coroutine_Close(yf);
47101  if (!retval)
47102  return -1;
47103  } else
47104  #endif
47105  #ifdef __Pyx_Coroutine_USED
47106  if (__Pyx_Coroutine_Check(yf)) {
47107  retval = __Pyx_Coroutine_Close(yf);
47108  if (!retval)
47109  return -1;
47110  } else
47111  if (__Pyx_CoroutineAwait_CheckExact(yf)) {
47112  retval = __Pyx_CoroutineAwait_Close((__pyx_CoroutineAwaitObject*)yf, NULL);
47113  if (!retval)
47114  return -1;
47115  } else
47116  #endif
47117  #ifdef __Pyx_AsyncGen_USED
47118  if (__pyx_PyAsyncGenASend_CheckExact(yf)) {
47119  retval = __Pyx_async_gen_asend_close(yf, NULL);
47120  } else
47121  if (__pyx_PyAsyncGenAThrow_CheckExact(yf)) {
47122  retval = __Pyx_async_gen_athrow_close(yf, NULL);
47123  } else
47124  #endif
47125  {
47126  PyObject *meth;
47127  gen->is_running = 1;
47128  meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close);
47129  if (unlikely(!meth)) {
47130  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
47131  PyErr_WriteUnraisable(yf);
47132  }
47133  PyErr_Clear();
47134  } else {
47135  retval = PyObject_CallFunction(meth, NULL);
47136  Py_DECREF(meth);
47137  if (!retval)
47138  err = -1;
47139  }
47140  gen->is_running = 0;
47141  }
47142  Py_XDECREF(retval);
47143  return err;
47144 }
47145 static PyObject *__Pyx_Generator_Next(PyObject *self) {
47146  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self;
47147  PyObject *yf = gen->yieldfrom;
47148  if (unlikely(gen->is_running))
47149  return __Pyx_Coroutine_AlreadyRunningError(gen);
47150  if (yf) {
47151  PyObject *ret;
47152  gen->is_running = 1;
47153  #ifdef __Pyx_Generator_USED
47154  if (__Pyx_Generator_CheckExact(yf)) {
47155  ret = __Pyx_Generator_Next(yf);
47156  } else
47157  #endif
47158  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03030000 && (defined(__linux__) || PY_VERSION_HEX >= 0x030600B3)
47159  if (PyGen_CheckExact(yf)) {
47160  ret = __Pyx_PyGen_Send((PyGenObject*)yf, NULL);
47161  } else
47162  #endif
47163  #ifdef __Pyx_Coroutine_USED
47164  if (__Pyx_Coroutine_Check(yf)) {
47165  ret = __Pyx_Coroutine_Send(yf, Py_None);
47166  } else
47167  #endif
47168  ret = Py_TYPE(yf)->tp_iternext(yf);
47169  gen->is_running = 0;
47170  if (likely(ret)) {
47171  return ret;
47172  }
47173  return __Pyx_Coroutine_FinishDelegation(gen);
47174  }
47175  return __Pyx_Coroutine_SendEx(gen, Py_None, 0);
47176 }
47177 static PyObject *__Pyx_Coroutine_Close_Method(PyObject *self, CYTHON_UNUSED PyObject *arg) {
47178  return __Pyx_Coroutine_Close(self);
47179 }
47180 static PyObject *__Pyx_Coroutine_Close(PyObject *self) {
47181  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
47182  PyObject *retval, *raised_exception;
47183  PyObject *yf = gen->yieldfrom;
47184  int err = 0;
47185  if (unlikely(gen->is_running))
47186  return __Pyx_Coroutine_AlreadyRunningError(gen);
47187  if (yf) {
47188  Py_INCREF(yf);
47189  err = __Pyx_Coroutine_CloseIter(gen, yf);
47190  __Pyx_Coroutine_Undelegate(gen);
47191  Py_DECREF(yf);
47192  }
47193  if (err == 0)
47194  PyErr_SetNone(PyExc_GeneratorExit);
47195  retval = __Pyx_Coroutine_SendEx(gen, NULL, 1);
47196  if (unlikely(retval)) {
47197  const char *msg;
47198  Py_DECREF(retval);
47199  if ((0)) {
47200  #ifdef __Pyx_Coroutine_USED
47201  } else if (__Pyx_Coroutine_Check(self)) {
47202  msg = "coroutine ignored GeneratorExit";
47203  #endif
47204  #ifdef __Pyx_AsyncGen_USED
47205  } else if (__Pyx_AsyncGen_CheckExact(self)) {
47206 #if PY_VERSION_HEX < 0x03060000
47207  msg = "async generator ignored GeneratorExit - might require Python 3.6+ finalisation (PEP 525)";
47208 #else
47209  msg = "async generator ignored GeneratorExit";
47210 #endif
47211  #endif
47212  } else {
47213  msg = "generator ignored GeneratorExit";
47214  }
47215  PyErr_SetString(PyExc_RuntimeError, msg);
47216  return NULL;
47217  }
47218  raised_exception = PyErr_Occurred();
47219  if (likely(!raised_exception || __Pyx_PyErr_GivenExceptionMatches2(raised_exception, PyExc_GeneratorExit, PyExc_StopIteration))) {
47220  if (raised_exception) PyErr_Clear();
47221  Py_INCREF(Py_None);
47222  return Py_None;
47223  }
47224  return NULL;
47225 }
47226 static PyObject *__Pyx__Coroutine_Throw(PyObject *self, PyObject *typ, PyObject *val, PyObject *tb,
47227  PyObject *args, int close_on_genexit) {
47228  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
47229  PyObject *yf = gen->yieldfrom;
47230  if (unlikely(gen->is_running))
47231  return __Pyx_Coroutine_AlreadyRunningError(gen);
47232  if (yf) {
47233  PyObject *ret;
47234  Py_INCREF(yf);
47235  if (__Pyx_PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit) && close_on_genexit) {
47236  int err = __Pyx_Coroutine_CloseIter(gen, yf);
47237  Py_DECREF(yf);
47238  __Pyx_Coroutine_Undelegate(gen);
47239  if (err < 0)
47240  return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
47241  goto throw_here;
47242  }
47243  gen->is_running = 1;
47244  if (0
47245  #ifdef __Pyx_Generator_USED
47246  || __Pyx_Generator_CheckExact(yf)
47247  #endif
47248  #ifdef __Pyx_Coroutine_USED
47249  || __Pyx_Coroutine_Check(yf)
47250  #endif
47251  ) {
47252  ret = __Pyx__Coroutine_Throw(yf, typ, val, tb, args, close_on_genexit);
47253  #ifdef __Pyx_Coroutine_USED
47254  } else if (__Pyx_CoroutineAwait_CheckExact(yf)) {
47255  ret = __Pyx__Coroutine_Throw(((__pyx_CoroutineAwaitObject*)yf)->coroutine, typ, val, tb, args, close_on_genexit);
47256  #endif
47257  } else {
47258  PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw);
47259  if (unlikely(!meth)) {
47260  Py_DECREF(yf);
47261  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) {
47262  gen->is_running = 0;
47263  return NULL;
47264  }
47265  PyErr_Clear();
47266  __Pyx_Coroutine_Undelegate(gen);
47267  gen->is_running = 0;
47268  goto throw_here;
47269  }
47270  if (likely(args)) {
47271  ret = PyObject_CallObject(meth, args);
47272  } else {
47273  ret = PyObject_CallFunctionObjArgs(meth, typ, val, tb, NULL);
47274  }
47275  Py_DECREF(meth);
47276  }
47277  gen->is_running = 0;
47278  Py_DECREF(yf);
47279  if (!ret) {
47280  ret = __Pyx_Coroutine_FinishDelegation(gen);
47281  }
47282  return __Pyx_Coroutine_MethodReturn(self, ret);
47283  }
47284 throw_here:
47285  __Pyx_Raise(typ, val, tb, NULL);
47286  return __Pyx_Coroutine_MethodReturn(self, __Pyx_Coroutine_SendEx(gen, NULL, 0));
47287 }
47288 static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) {
47289  PyObject *typ;
47290  PyObject *val = NULL;
47291  PyObject *tb = NULL;
47292  if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb))
47293  return NULL;
47294  return __Pyx__Coroutine_Throw(self, typ, val, tb, args, 1);
47295 }
47296 static CYTHON_INLINE int __Pyx_Coroutine_traverse_excstate(__Pyx_ExcInfoStruct *exc_state, visitproc visit, void *arg) {
47297  Py_VISIT(exc_state->exc_type);
47298  Py_VISIT(exc_state->exc_value);
47299  Py_VISIT(exc_state->exc_traceback);
47300  return 0;
47301 }
47302 static int __Pyx_Coroutine_traverse(__pyx_CoroutineObject *gen, visitproc visit, void *arg) {
47303  Py_VISIT(gen->closure);
47304  Py_VISIT(gen->classobj);
47305  Py_VISIT(gen->yieldfrom);
47306  return __Pyx_Coroutine_traverse_excstate(&gen->gi_exc_state, visit, arg);
47307 }
47308 static int __Pyx_Coroutine_clear(PyObject *self) {
47309  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
47310  Py_CLEAR(gen->closure);
47311  Py_CLEAR(gen->classobj);
47312  Py_CLEAR(gen->yieldfrom);
47313  __Pyx_Coroutine_ExceptionClear(&gen->gi_exc_state);
47314 #ifdef __Pyx_AsyncGen_USED
47315  if (__Pyx_AsyncGen_CheckExact(self)) {
47316  Py_CLEAR(((__pyx_PyAsyncGenObject*)gen)->ag_finalizer);
47317  }
47318 #endif
47319  Py_CLEAR(gen->gi_code);
47320  Py_CLEAR(gen->gi_frame);
47321  Py_CLEAR(gen->gi_name);
47322  Py_CLEAR(gen->gi_qualname);
47323  Py_CLEAR(gen->gi_modulename);
47324  return 0;
47325 }
47326 static void __Pyx_Coroutine_dealloc(PyObject *self) {
47327  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
47328  PyObject_GC_UnTrack(gen);
47329  if (gen->gi_weakreflist != NULL)
47330  PyObject_ClearWeakRefs(self);
47331  if (gen->resume_label >= 0) {
47332  PyObject_GC_Track(self);
47333 #if PY_VERSION_HEX >= 0x030400a1 && CYTHON_USE_TP_FINALIZE
47334  if (PyObject_CallFinalizerFromDealloc(self))
47335 #else
47336  Py_TYPE(gen)->tp_del(self);
47337  if (Py_REFCNT(self) > 0)
47338 #endif
47339  {
47340  return;
47341  }
47342  PyObject_GC_UnTrack(self);
47343  }
47344 #ifdef __Pyx_AsyncGen_USED
47345  if (__Pyx_AsyncGen_CheckExact(self)) {
47346  /* We have to handle this case for asynchronous generators
47347  right here, because this code has to be between UNTRACK
47348  and GC_Del. */
47349  Py_CLEAR(((__pyx_PyAsyncGenObject*)self)->ag_finalizer);
47350  }
47351 #endif
47352  __Pyx_Coroutine_clear(self);
47353  PyObject_GC_Del(gen);
47354 }
47355 static void __Pyx_Coroutine_del(PyObject *self) {
47356  PyObject *error_type, *error_value, *error_traceback;
47357  __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self;
47358  __Pyx_PyThreadState_declare
47359  if (gen->resume_label < 0) {
47360  return;
47361  }
47362 #if !CYTHON_USE_TP_FINALIZE
47363  assert(self->ob_refcnt == 0);
47364  __Pyx_SET_REFCNT(self, 1);
47365 #endif
47366  __Pyx_PyThreadState_assign
47367  __Pyx_ErrFetch(&error_type, &error_value, &error_traceback);
47368 #ifdef __Pyx_AsyncGen_USED
47369  if (__Pyx_AsyncGen_CheckExact(self)) {
47370  __pyx_PyAsyncGenObject *agen = (__pyx_PyAsyncGenObject*)self;
47371  PyObject *finalizer = agen->ag_finalizer;
47372  if (finalizer && !agen->ag_closed) {
47373  PyObject *res = __Pyx_PyObject_CallOneArg(finalizer, self);
47374  if (unlikely(!res)) {
47375  PyErr_WriteUnraisable(self);
47376  } else {
47377  Py_DECREF(res);
47378  }
47379  __Pyx_ErrRestore(error_type, error_value, error_traceback);
47380  return;
47381  }
47382  }
47383 #endif
47384  if (unlikely(gen->resume_label == 0 && !error_value)) {
47385 #ifdef __Pyx_Coroutine_USED
47386 #ifdef __Pyx_Generator_USED
47387  if (!__Pyx_Generator_CheckExact(self))
47388 #endif
47389  {
47390  PyObject_GC_UnTrack(self);
47391 #if PY_MAJOR_VERSION >= 3 || defined(PyErr_WarnFormat)
47392  if (unlikely(PyErr_WarnFormat(PyExc_RuntimeWarning, 1, "coroutine '%.50S' was never awaited", gen->gi_qualname) < 0))
47393  PyErr_WriteUnraisable(self);
47394 #else
47395  {PyObject *msg;
47396  char *cmsg;
47397  #if CYTHON_COMPILING_IN_PYPY
47398  msg = NULL;
47399  cmsg = (char*) "coroutine was never awaited";
47400  #else
47401  char *cname;
47402  PyObject *qualname;
47403  qualname = gen->gi_qualname;
47404  cname = PyString_AS_STRING(qualname);
47405  msg = PyString_FromFormat("coroutine '%.50s' was never awaited", cname);
47406  if (unlikely(!msg)) {
47407  PyErr_Clear();
47408  cmsg = (char*) "coroutine was never awaited";
47409  } else {
47410  cmsg = PyString_AS_STRING(msg);
47411  }
47412  #endif
47413  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, cmsg, 1) < 0))
47414  PyErr_WriteUnraisable(self);
47415  Py_XDECREF(msg);}
47416 #endif
47417  PyObject_GC_Track(self);
47418  }
47419 #endif
47420  } else {
47421  PyObject *res = __Pyx_Coroutine_Close(self);
47422  if (unlikely(!res)) {
47423  if (PyErr_Occurred())
47424  PyErr_WriteUnraisable(self);
47425  } else {
47426  Py_DECREF(res);
47427  }
47428  }
47429  __Pyx_ErrRestore(error_type, error_value, error_traceback);
47430 #if !CYTHON_USE_TP_FINALIZE
47431  assert(Py_REFCNT(self) > 0);
47432  if (--self->ob_refcnt == 0) {
47433  return;
47434  }
47435  {
47436  Py_ssize_t refcnt = Py_REFCNT(self);
47437  _Py_NewReference(self);
47438  __Pyx_SET_REFCNT(self, refcnt);
47439  }
47440 #if CYTHON_COMPILING_IN_CPYTHON
47441  assert(PyType_IS_GC(Py_TYPE(self)) &&
47442  _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED);
47443  _Py_DEC_REFTOTAL;
47444 #endif
47445 #ifdef COUNT_ALLOCS
47446  --Py_TYPE(self)->tp_frees;
47447  --Py_TYPE(self)->tp_allocs;
47448 #endif
47449 #endif
47450 }
47451 static PyObject *
47452 __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
47453 {
47454  PyObject *name = self->gi_name;
47455  if (unlikely(!name)) name = Py_None;
47456  Py_INCREF(name);
47457  return name;
47458 }
47459 static int
47460 __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
47461 {
47462  PyObject *tmp;
47463 #if PY_MAJOR_VERSION >= 3
47464  if (unlikely(value == NULL || !PyUnicode_Check(value)))
47465 #else
47466  if (unlikely(value == NULL || !PyString_Check(value)))
47467 #endif
47468  {
47469  PyErr_SetString(PyExc_TypeError,
47470  "__name__ must be set to a string object");
47471  return -1;
47472  }
47473  tmp = self->gi_name;
47474  Py_INCREF(value);
47475  self->gi_name = value;
47476  Py_XDECREF(tmp);
47477  return 0;
47478 }
47479 static PyObject *
47480 __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
47481 {
47482  PyObject *name = self->gi_qualname;
47483  if (unlikely(!name)) name = Py_None;
47484  Py_INCREF(name);
47485  return name;
47486 }
47487 static int
47488 __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value, CYTHON_UNUSED void *context)
47489 {
47490  PyObject *tmp;
47491 #if PY_MAJOR_VERSION >= 3
47492  if (unlikely(value == NULL || !PyUnicode_Check(value)))
47493 #else
47494  if (unlikely(value == NULL || !PyString_Check(value)))
47495 #endif
47496  {
47497  PyErr_SetString(PyExc_TypeError,
47498  "__qualname__ must be set to a string object");
47499  return -1;
47500  }
47501  tmp = self->gi_qualname;
47502  Py_INCREF(value);
47503  self->gi_qualname = value;
47504  Py_XDECREF(tmp);
47505  return 0;
47506 }
47507 static PyObject *
47508 __Pyx_Coroutine_get_frame(__pyx_CoroutineObject *self, CYTHON_UNUSED void *context)
47509 {
47510  PyObject *frame = self->gi_frame;
47511  if (!frame) {
47512  if (unlikely(!self->gi_code)) {
47513  Py_RETURN_NONE;
47514  }
47515  frame = (PyObject *) PyFrame_New(
47516  PyThreadState_Get(), /*PyThreadState *tstate,*/
47517  (PyCodeObject*) self->gi_code, /*PyCodeObject *code,*/
47518  __pyx_d, /*PyObject *globals,*/
47519  0 /*PyObject *locals*/
47520  );
47521  if (unlikely(!frame))
47522  return NULL;
47523  self->gi_frame = frame;
47524  }
47525  Py_INCREF(frame);
47526  return frame;
47527 }
47528 static __pyx_CoroutineObject *__Pyx__Coroutine_New(
47529  PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
47530  PyObject *name, PyObject *qualname, PyObject *module_name) {
47531  __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type);
47532  if (unlikely(!gen))
47533  return NULL;
47534  return __Pyx__Coroutine_NewInit(gen, body, code, closure, name, qualname, module_name);
47535 }
47536 static __pyx_CoroutineObject *__Pyx__Coroutine_NewInit(
47537  __pyx_CoroutineObject *gen, __pyx_coroutine_body_t body, PyObject *code, PyObject *closure,
47538  PyObject *name, PyObject *qualname, PyObject *module_name) {
47539  gen->body = body;
47540  gen->closure = closure;
47541  Py_XINCREF(closure);
47542  gen->is_running = 0;
47543  gen->resume_label = 0;
47544  gen->classobj = NULL;
47545  gen->yieldfrom = NULL;
47546  gen->gi_exc_state.exc_type = NULL;
47547  gen->gi_exc_state.exc_value = NULL;
47548  gen->gi_exc_state.exc_traceback = NULL;
47549 #if CYTHON_USE_EXC_INFO_STACK
47550  gen->gi_exc_state.previous_item = NULL;
47551 #endif
47552  gen->gi_weakreflist = NULL;
47553  Py_XINCREF(qualname);
47554  gen->gi_qualname = qualname;
47555  Py_XINCREF(name);
47556  gen->gi_name = name;
47557  Py_XINCREF(module_name);
47558  gen->gi_modulename = module_name;
47559  Py_XINCREF(code);
47560  gen->gi_code = code;
47561  gen->gi_frame = NULL;
47562  PyObject_GC_Track(gen);
47563  return gen;
47564 }
47565 
47566 /* PatchModuleWithCoroutine */
47567  static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
47568 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
47569  int result;
47570  PyObject *globals, *result_obj;
47571  globals = PyDict_New(); if (unlikely(!globals)) goto ignore;
47572  result = PyDict_SetItemString(globals, "_cython_coroutine_type",
47573  #ifdef __Pyx_Coroutine_USED
47574  (PyObject*)__pyx_CoroutineType);
47575  #else
47576  Py_None);
47577  #endif
47578  if (unlikely(result < 0)) goto ignore;
47579  result = PyDict_SetItemString(globals, "_cython_generator_type",
47580  #ifdef __Pyx_Generator_USED
47581  (PyObject*)__pyx_GeneratorType);
47582  #else
47583  Py_None);
47584  #endif
47585  if (unlikely(result < 0)) goto ignore;
47586  if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
47587  if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
47588  result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
47589  if (unlikely(!result_obj)) goto ignore;
47590  Py_DECREF(result_obj);
47591  Py_DECREF(globals);
47592  return module;
47593 ignore:
47594  Py_XDECREF(globals);
47595  PyErr_WriteUnraisable(module);
47596  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
47597  Py_DECREF(module);
47598  module = NULL;
47599  }
47600 #else
47601  py_code++;
47602 #endif
47603  return module;
47604 }
47605 
47606 /* PatchGeneratorABC */
47607  #ifndef CYTHON_REGISTER_ABCS
47608 #define CYTHON_REGISTER_ABCS 1
47609 #endif
47610 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
47611 static PyObject* __Pyx_patch_abc_module(PyObject *module);
47612 static PyObject* __Pyx_patch_abc_module(PyObject *module) {
47613  module = __Pyx_Coroutine_patch_module(
47614  module, ""
47615 "if _cython_generator_type is not None:\n"
47616 " try: Generator = _module.Generator\n"
47617 " except AttributeError: pass\n"
47618 " else: Generator.register(_cython_generator_type)\n"
47619 "if _cython_coroutine_type is not None:\n"
47620 " try: Coroutine = _module.Coroutine\n"
47621 " except AttributeError: pass\n"
47622 " else: Coroutine.register(_cython_coroutine_type)\n"
47623  );
47624  return module;
47625 }
47626 #endif
47627 static int __Pyx_patch_abc(void) {
47628 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
47629  static int abc_patched = 0;
47630  if (CYTHON_REGISTER_ABCS && !abc_patched) {
47631  PyObject *module;
47632  module = PyImport_ImportModule((PY_MAJOR_VERSION >= 3) ? "collections.abc" : "collections");
47633  if (!module) {
47634  PyErr_WriteUnraisable(NULL);
47635  if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning,
47636  ((PY_MAJOR_VERSION >= 3) ?
47637  "Cython module failed to register with collections.abc module" :
47638  "Cython module failed to register with collections module"), 1) < 0)) {
47639  return -1;
47640  }
47641  } else {
47642  module = __Pyx_patch_abc_module(module);
47643  abc_patched = 1;
47644  if (unlikely(!module))
47645  return -1;
47646  Py_DECREF(module);
47647  }
47648  module = PyImport_ImportModule("backports_abc");
47649  if (module) {
47650  module = __Pyx_patch_abc_module(module);
47651  Py_XDECREF(module);
47652  }
47653  if (!module) {
47654  PyErr_Clear();
47655  }
47656  }
47657 #else
47658  if ((0)) __Pyx_Coroutine_patch_module(NULL, NULL);
47659 #endif
47660  return 0;
47661 }
47662 
47663 /* Generator */
47664  static PyMethodDef __pyx_Generator_methods[] = {
47665  {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O,
47666  (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")},
47667  {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS,
47668  (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")},
47669  {"close", (PyCFunction) __Pyx_Coroutine_Close_Method, METH_NOARGS,
47670  (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")},
47671  {0, 0, 0, 0}
47672 };
47673 static PyMemberDef __pyx_Generator_memberlist[] = {
47674  {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL},
47675  {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY,
47676  (char*) PyDoc_STR("object being iterated by 'yield from', or None")},
47677  {(char*) "gi_code", T_OBJECT, offsetof(__pyx_CoroutineObject, gi_code), READONLY, NULL},
47678  {0, 0, 0, 0, 0}
47679 };
47680 static PyGetSetDef __pyx_Generator_getsets[] = {
47681  {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name,
47682  (char*) PyDoc_STR("name of the generator"), 0},
47683  {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname,
47684  (char*) PyDoc_STR("qualified name of the generator"), 0},
47685  {(char *) "gi_frame", (getter)__Pyx_Coroutine_get_frame, NULL,
47686  (char*) PyDoc_STR("Frame of the generator"), 0},
47687  {0, 0, 0, 0, 0}
47688 };
47689 static PyTypeObject __pyx_GeneratorType_type = {
47690  PyVarObject_HEAD_INIT(0, 0)
47691  "generator",
47692  sizeof(__pyx_CoroutineObject),
47693  0,
47694  (destructor) __Pyx_Coroutine_dealloc,
47695  0,
47696  0,
47697  0,
47698  0,
47699  0,
47700  0,
47701  0,
47702  0,
47703  0,
47704  0,
47705  0,
47706  0,
47707  0,
47708  0,
47709  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE,
47710  0,
47711  (traverseproc) __Pyx_Coroutine_traverse,
47712  0,
47713  0,
47714  offsetof(__pyx_CoroutineObject, gi_weakreflist),
47715  0,
47716  (iternextfunc) __Pyx_Generator_Next,
47717  __pyx_Generator_methods,
47718  __pyx_Generator_memberlist,
47719  __pyx_Generator_getsets,
47720  0,
47721  0,
47722  0,
47723  0,
47724  0,
47725  0,
47726  0,
47727  0,
47728  0,
47729  0,
47730  0,
47731  0,
47732  0,
47733  0,
47734  0,
47735 #if CYTHON_USE_TP_FINALIZE
47736  0,
47737 #else
47738  __Pyx_Coroutine_del,
47739 #endif
47740  0,
47741 #if CYTHON_USE_TP_FINALIZE
47742  __Pyx_Coroutine_del,
47743 #elif PY_VERSION_HEX >= 0x030400a1
47744  0,
47745 #endif
47746 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
47747  0,
47748 #endif
47749 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
47750  0,
47751 #endif
47752 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000
47753  0,
47754 #endif
47755 };
47756 static int __pyx_Generator_init(void) {
47757  __pyx_GeneratorType_type.tp_getattro = __Pyx_PyObject_GenericGetAttrNoDict;
47758  __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter;
47759  __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type);
47760  if (unlikely(!__pyx_GeneratorType)) {
47761  return -1;
47762  }
47763  return 0;
47764 }
47765 
47766 /* CheckBinaryVersion */
47767  static int __Pyx_check_binary_version(void) {
47768  char ctversion[5];
47769  int same=1, i, found_dot;
47770  const char* rt_from_call = Py_GetVersion();
47771  PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
47772  found_dot = 0;
47773  for (i = 0; i < 4; i++) {
47774  if (!ctversion[i]) {
47775  same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
47776  break;
47777  }
47778  if (rt_from_call[i] != ctversion[i]) {
47779  same = 0;
47780  break;
47781  }
47782  }
47783  if (!same) {
47784  char rtversion[5] = {'\0'};
47785  char message[200];
47786  for (i=0; i<4; ++i) {
47787  if (rt_from_call[i] == '.') {
47788  if (found_dot) break;
47789  found_dot = 1;
47790  } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
47791  break;
47792  }
47793  rtversion[i] = rt_from_call[i];
47794  }
47795  PyOS_snprintf(message, sizeof(message),
47796  "compiletime version %s of module '%.100s' "
47797  "does not match runtime version %s",
47798  ctversion, __Pyx_MODULE_NAME, rtversion);
47799  return PyErr_WarnEx(NULL, message, 1);
47800  }
47801  return 0;
47802 }
47803 
47804 /* FunctionExport */
47805  static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
47806  PyObject *d = 0;
47807  PyObject *cobj = 0;
47808  union {
47809  void (*fp)(void);
47810  void *p;
47811  } tmp;
47812  d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
47813  if (!d) {
47814  PyErr_Clear();
47815  d = PyDict_New();
47816  if (!d)
47817  goto bad;
47818  Py_INCREF(d);
47819  if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
47820  goto bad;
47821  }
47822  tmp.fp = f;
47823 #if PY_VERSION_HEX >= 0x02070000
47824  cobj = PyCapsule_New(tmp.p, sig, 0);
47825 #else
47826  cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
47827 #endif
47828  if (!cobj)
47829  goto bad;
47830  if (PyDict_SetItemString(d, name, cobj) < 0)
47831  goto bad;
47832  Py_DECREF(cobj);
47833  Py_DECREF(d);
47834  return 0;
47835 bad:
47836  Py_XDECREF(cobj);
47837  Py_XDECREF(d);
47838  return -1;
47839 }
47840 
47841 /* InitStrings */
47842  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
47843  while (t->p) {
47844  #if PY_MAJOR_VERSION < 3
47845  if (t->is_unicode) {
47846  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
47847  } else if (t->intern) {
47848  *t->p = PyString_InternFromString(t->s);
47849  } else {
47850  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
47851  }
47852  #else
47853  if (t->is_unicode | t->is_str) {
47854  if (t->intern) {
47855  *t->p = PyUnicode_InternFromString(t->s);
47856  } else if (t->encoding) {
47857  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
47858  } else {
47859  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
47860  }
47861  } else {
47862  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
47863  }
47864  #endif
47865  if (!*t->p)
47866  return -1;
47867  if (PyObject_Hash(*t->p) == -1)
47868  return -1;
47869  ++t;
47870  }
47871  return 0;
47872 }
47873 
47874 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
47875  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
47876 }
47877 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
47878  Py_ssize_t ignore;
47879  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
47880 }
47881 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
47882 #if !CYTHON_PEP393_ENABLED
47883 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
47884  char* defenc_c;
47885  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
47886  if (!defenc) return NULL;
47887  defenc_c = PyBytes_AS_STRING(defenc);
47888 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
47889  {
47890  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
47891  char* c;
47892  for (c = defenc_c; c < end; c++) {
47893  if ((unsigned char) (*c) >= 128) {
47894  PyUnicode_AsASCIIString(o);
47895  return NULL;
47896  }
47897  }
47898  }
47899 #endif
47900  *length = PyBytes_GET_SIZE(defenc);
47901  return defenc_c;
47902 }
47903 #else
47904 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
47905  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
47906 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
47907  if (likely(PyUnicode_IS_ASCII(o))) {
47908  *length = PyUnicode_GET_LENGTH(o);
47909  return PyUnicode_AsUTF8(o);
47910  } else {
47911  PyUnicode_AsASCIIString(o);
47912  return NULL;
47913  }
47914 #else
47915  return PyUnicode_AsUTF8AndSize(o, length);
47916 #endif
47917 }
47918 #endif
47919 #endif
47920 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
47921 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
47922  if (
47923 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
47924  __Pyx_sys_getdefaultencoding_not_ascii &&
47925 #endif
47926  PyUnicode_Check(o)) {
47927  return __Pyx_PyUnicode_AsStringAndSize(o, length);
47928  } else
47929 #endif
47930 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
47931  if (PyByteArray_Check(o)) {
47932  *length = PyByteArray_GET_SIZE(o);
47933  return PyByteArray_AS_STRING(o);
47934  } else
47935 #endif
47936  {
47937  char* result;
47938  int r = PyBytes_AsStringAndSize(o, &result, length);
47939  if (unlikely(r < 0)) {
47940  return NULL;
47941  } else {
47942  return result;
47943  }
47944  }
47945 }
47946 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
47947  int is_true = x == Py_True;
47948  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
47949  else return PyObject_IsTrue(x);
47950 }
47951 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
47952  int retval;
47953  if (unlikely(!x)) return -1;
47954  retval = __Pyx_PyObject_IsTrue(x);
47955  Py_DECREF(x);
47956  return retval;
47957 }
47958 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
47959 #if PY_MAJOR_VERSION >= 3
47960  if (PyLong_Check(result)) {
47961  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
47962  "__int__ returned non-int (type %.200s). "
47963  "The ability to return an instance of a strict subclass of int "
47964  "is deprecated, and may be removed in a future version of Python.",
47965  Py_TYPE(result)->tp_name)) {
47966  Py_DECREF(result);
47967  return NULL;
47968  }
47969  return result;
47970  }
47971 #endif
47972  PyErr_Format(PyExc_TypeError,
47973  "__%.4s__ returned non-%.4s (type %.200s)",
47974  type_name, type_name, Py_TYPE(result)->tp_name);
47975  Py_DECREF(result);
47976  return NULL;
47977 }
47978 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
47979 #if CYTHON_USE_TYPE_SLOTS
47980  PyNumberMethods *m;
47981 #endif
47982  const char *name = NULL;
47983  PyObject *res = NULL;
47984 #if PY_MAJOR_VERSION < 3
47985  if (likely(PyInt_Check(x) || PyLong_Check(x)))
47986 #else
47987  if (likely(PyLong_Check(x)))
47988 #endif
47989  return __Pyx_NewRef(x);
47990 #if CYTHON_USE_TYPE_SLOTS
47991  m = Py_TYPE(x)->tp_as_number;
47992  #if PY_MAJOR_VERSION < 3
47993  if (m && m->nb_int) {
47994  name = "int";
47995  res = m->nb_int(x);
47996  }
47997  else if (m && m->nb_long) {
47998  name = "long";
47999  res = m->nb_long(x);
48000  }
48001  #else
48002  if (likely(m && m->nb_int)) {
48003  name = "int";
48004  res = m->nb_int(x);
48005  }
48006  #endif
48007 #else
48008  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
48009  res = PyNumber_Int(x);
48010  }
48011 #endif
48012  if (likely(res)) {
48013 #if PY_MAJOR_VERSION < 3
48014  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
48015 #else
48016  if (unlikely(!PyLong_CheckExact(res))) {
48017 #endif
48018  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
48019  }
48020  }
48021  else if (!PyErr_Occurred()) {
48022  PyErr_SetString(PyExc_TypeError,
48023  "an integer is required");
48024  }
48025  return res;
48026 }
48027 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
48028  Py_ssize_t ival;
48029  PyObject *x;
48030 #if PY_MAJOR_VERSION < 3
48031  if (likely(PyInt_CheckExact(b))) {
48032  if (sizeof(Py_ssize_t) >= sizeof(long))
48033  return PyInt_AS_LONG(b);
48034  else
48035  return PyInt_AsSsize_t(b);
48036  }
48037 #endif
48038  if (likely(PyLong_CheckExact(b))) {
48039  #if CYTHON_USE_PYLONG_INTERNALS
48040  const digit* digits = ((PyLongObject*)b)->ob_digit;
48041  const Py_ssize_t size = Py_SIZE(b);
48042  if (likely(__Pyx_sst_abs(size) <= 1)) {
48043  ival = likely(size) ? digits[0] : 0;
48044  if (size == -1) ival = -ival;
48045  return ival;
48046  } else {
48047  switch (size) {
48048  case 2:
48049  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
48050  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
48051  }
48052  break;
48053  case -2:
48054  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
48055  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
48056  }
48057  break;
48058  case 3:
48059  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
48060  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
48061  }
48062  break;
48063  case -3:
48064  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
48065  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
48066  }
48067  break;
48068  case 4:
48069  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
48070  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
48071  }
48072  break;
48073  case -4:
48074  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
48075  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
48076  }
48077  break;
48078  }
48079  }
48080  #endif
48081  return PyLong_AsSsize_t(b);
48082  }
48083  x = PyNumber_Index(b);
48084  if (!x) return -1;
48085  ival = PyInt_AsSsize_t(x);
48086  Py_DECREF(x);
48087  return ival;
48088 }
48089 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
48090  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
48091  return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
48092 #if PY_MAJOR_VERSION < 3
48093  } else if (likely(PyInt_CheckExact(o))) {
48094  return PyInt_AS_LONG(o);
48095 #endif
48096  } else {
48097  Py_ssize_t ival;
48098  PyObject *x;
48099  x = PyNumber_Index(o);
48100  if (!x) return -1;
48101  ival = PyInt_AsLong(x);
48102  Py_DECREF(x);
48103  return ival;
48104  }
48105 }
48106 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
48107  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
48108 }
48109 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
48110  return PyInt_FromSize_t(ival);
48111 }
48112 
48113 
48114 #endif /* Py_PYTHON_H */
proteus::fp
double fp(const double &g, const double &h, const double &hZ)
Definition: SW2DCV.h:66
f
Double f
Definition: Headers.h:64
number
Int number
Definition: Headers.h:33
s
Double s
Definition: Headers.h:84
L
Double L
Definition: Headers.h:72
n
Int n
Definition: Headers.h:28
U
Double U
Definition: Headers.h:88
v
Double v
Definition: Headers.h:95
T
Double T
Definition: Headers.h:87
z
Double * z
Definition: Headers.h:49
u
Double u
Definition: Headers.h:89
c
Double c
Definition: Headers.h:54
r
Double r
Definition: Headers.h:83
pos
double pos(double a)
Definition: testFMMandFSW.cpp:8