/* Generated by Cython 0.27.3 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [],
        "name": "tofu.geom._GG03",
        "sources": [
            "tofu/geom/_GG03.pyx"
        ]
    },
    "module_name": "tofu.geom._GG03"
}
END: Cython Metadata */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_27_3"
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject **args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__tofu__geom___GG03
#define __PYX_HAVE_API__tofu__geom___GG03
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include <math.h>
#include "pythread.h"
#include <stdlib.h>
#include "pystate.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "tofu/geom/_GG03.pyx",
  "__init__.pxd",
  "stringsource",
  "type.pxd",
  "bool.pxd",
  "complex.pxd",
};
/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;

/* MemviewSliceStruct.proto */
struct __pyx_memoryview_obj;
typedef struct {
  struct __pyx_memoryview_obj *memview;
  char *data;
  Py_ssize_t shape[8];
  Py_ssize_t strides[8];
  Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define __Pyx_MemoryView_Len(m)  (m.shape[0])

/* Atomics.proto */
#include <pythread.h>
#ifndef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 1
#endif
#define __pyx_atomic_int_type int
#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
                    (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
                    !defined(__i386__)
    #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
    #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using GNU atomics"
    #endif
#elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
    #include <Windows.h>
    #undef __pyx_atomic_int_type
    #define __pyx_atomic_int_type LONG
    #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #pragma message ("Using MSVC atomics")
    #endif
#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
    #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
    #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Using Intel atomics"
    #endif
#else
    #undef CYTHON_ATOMICS
    #define CYTHON_ATOMICS 0
    #ifdef __PYX_DEBUG_ATOMICS
        #warning "Not using atomics"
    #endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
    #define __pyx_add_acquisition_count(memview)\
             __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#else
    #define __pyx_add_acquisition_count(memview)\
            __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
    #define __pyx_sub_acquisition_count(memview)\
            __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif

/* ForceInitThreads.proto */
#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

/* NoFastGil.proto */
#define __Pyx_PyGILState_Ensure PyGILState_Ensure
#define __Pyx_PyGILState_Release PyGILState_Release
#define __Pyx_FastGIL_Remember()
#define __Pyx_FastGIL_Forget()
#define __Pyx_FastGilFuncInit()


/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":743
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":744
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":745
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":746
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":750
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":751
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":752
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":753
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":757
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":758
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":767
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":768
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":769
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":771
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":772
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":773
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":775
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":780
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryview_obj;
struct __pyx_memoryviewslice_obj;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":782
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;
struct __pyx_opt_args_4tofu_4geom_5_GG03__check_DLvsLMinMax;
struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor;
struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin;
struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor;
struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Tor;
struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Lin;

/* "tofu/geom/_GG03.pyx":1346
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef _check_DLvsLMinMax(double[::1] LMinMax, DL=None):             # <<<<<<<<<<<<<<
 *     Inter = 1
 *     if DL is not None:
 */
struct __pyx_opt_args_4tofu_4geom_5_GG03__check_DLvsLMinMax {
  int __pyx_n;
  PyObject *DL;
};

/* "tofu/geom/_GG03.pyx":1649
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Tor(double [:,::1] Ds, double [:,::1] us, double [:,::1] VPoly, double [:,::1] vIn, Lim=None,             # <<<<<<<<<<<<<<
 *                          bool Forbid=True, RMin=None, double EpsUz=1.e-6, double EpsVz=1.e-9, double EpsA=1.e-9, double EpsB=1.e-9, double EpsPlane=1.e-9):
 * 
 */
struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor {
  int __pyx_n;
  PyObject *Lim;
  PyBoolObject *Forbid;
  PyObject *RMin;
  double EpsUz;
  double EpsVz;
  double EpsA;
  double EpsB;
  double EpsPlane;
};

/* "tofu/geom/_GG03.pyx":1935
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Lin(double[:,::1] Ds, double [:,::1] us, double[:,::1] VPoly, double[:,::1] VIn, Lim, double EpsPlane=1.e-9):             # <<<<<<<<<<<<<<
 * 
 *     cdef int ii=0, jj=0, Nl=Ds.shape[1], Ns=VIn.shape[1]
 */
struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin {
  int __pyx_n;
  double EpsPlane;
};

/* "tofu/geom/_GG03.pyx":2706
 * 
 * 
 * cdef LOS_sino_findRootkPMin_Tor(double uParN, double uN, double Sca, double RZ0, double RZ1, double ScaP, double DParN, double kOut, double D0, double D1, double D2, double u0, double u1, double u2, str Mode='LOS'):             # <<<<<<<<<<<<<<
 *     cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 )
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2
 */
struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor {
  int __pyx_n;
  PyObject *Mode;
};

/* "tofu/geom/_GG03.pyx":2733
 * 
 * 
 * cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2)
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 */
struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Tor {
  int __pyx_n;
  PyObject *Mode;
  double kOut;
};

/* "tofu/geom/_GG03.pyx":2757
 * 
 * 
 * cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    kPMin
 *     if u0**2==1.:
 */
struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Lin {
  int __pyx_n;
  PyObject *Mode;
  double kOut;
};

/* "View.MemoryView":103
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */
struct __pyx_array_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_array *__pyx_vtab;
  char *data;
  Py_ssize_t len;
  char *format;
  int ndim;
  Py_ssize_t *_shape;
  Py_ssize_t *_strides;
  Py_ssize_t itemsize;
  PyObject *mode;
  PyObject *_format;
  void (*callback_free_data)(void *);
  int free_data;
  int dtype_is_object;
};


/* "View.MemoryView":277
 * 
 * @cname('__pyx_MemviewEnum')
 * cdef class Enum(object):             # <<<<<<<<<<<<<<
 *     cdef object name
 *     def __init__(self, name):
 */
struct __pyx_MemviewEnum_obj {
  PyObject_HEAD
  PyObject *name;
};


/* "View.MemoryView":328
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */
struct __pyx_memoryview_obj {
  PyObject_HEAD
  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  PyObject *obj;
  PyObject *_size;
  PyObject *_array_interface;
  PyThread_type_lock lock;
  __pyx_atomic_int acquisition_count[2];
  __pyx_atomic_int *acquisition_count_aligned_p;
  Py_buffer view;
  int flags;
  int dtype_is_object;
  __Pyx_TypeInfo *typeinfo;
};


/* "View.MemoryView":953
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */
struct __pyx_memoryviewslice_obj {
  struct __pyx_memoryview_obj __pyx_base;
  __Pyx_memviewslice from_slice;
  PyObject *from_object;
  PyObject *(*to_object_func)(char *);
  int (*to_dtype_func)(char *, PyObject *);
};



/* "View.MemoryView":103
 * 
 * @cname("__pyx_array")
 * cdef class array:             # <<<<<<<<<<<<<<
 * 
 *     cdef:
 */

struct __pyx_vtabstruct_array {
  PyObject *(*get_memview)(struct __pyx_array_obj *);
};
static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;


/* "View.MemoryView":328
 * 
 * @cname('__pyx_memoryview')
 * cdef class memoryview(object):             # <<<<<<<<<<<<<<
 * 
 *     cdef object obj
 */

struct __pyx_vtabstruct_memoryview {
  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;


/* "View.MemoryView":953
 * 
 * @cname('__pyx_memoryviewslice')
 * cdef class _memoryviewslice(memoryview):             # <<<<<<<<<<<<<<
 *     "Internal class for passing memoryview slices to Python"
 * 
 */

struct __pyx_vtabstruct__memoryviewslice {
  struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;

/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
    PyObject_RichCompare(op1, op2, Py_EQ)
    #endif

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* IsLittleEndian.proto */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type);

/* BufferGetAndValidate.proto */
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
    ((obj == Py_None || obj == NULL) ?\
    (__Pyx_ZeroBuffer(buf), 0) :\
    __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static void __Pyx_ZeroBuffer(Py_buffer* buf);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1)
/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_DivideObjC(op1, op2, floatval, inplace)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

/* GetAttr.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);

/* HasAttr.proto */
static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);

/* MemviewSliceInit.proto */
#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
#define __Pyx_MEMVIEW_DIRECT   1
#define __Pyx_MEMVIEW_PTR      2
#define __Pyx_MEMVIEW_FULL     4
#define __Pyx_MEMVIEW_CONTIG   8
#define __Pyx_MEMVIEW_STRIDED  16
#define __Pyx_MEMVIEW_FOLLOW   32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
static int __Pyx_init_memviewslice(
                struct __pyx_memoryview_obj *memview,
                int ndim,
                __Pyx_memviewslice *memviewslice,
                int memview_is_new_reference);
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
    __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* BufferFallbackError.proto */
static void __Pyx_RaiseBufferFallbackError(void);

#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyFloatBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace);
#else
#define __Pyx_PyFloat_DivideCObj(op1, op2, floatval, inplace)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObjectCallMethod0.proto */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

/* MergeKeywords.proto */
static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);

/* BufferIndexError.proto */
static void __Pyx_RaiseBufferIndexError(int axis);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

/* None.proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);

/* UnaryNegOverflows.proto */
#define UNARY_NEG_WOULD_OVERFLOW(x)\
        (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))

static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
/* decode_c_string_utf16.proto */
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 0;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = -1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}
static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
    int byteorder = 1;
    return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
}

/* decode_c_string.proto */
static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

/* GetAttr3.proto */
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* None.proto */
static CYTHON_INLINE long __Pyx_div_long(long, long);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* SetVTable.proto */
static int __Pyx_SetVtable(PyObject *dict, void *vtable);

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchInspect.proto */
static PyObject* __Pyx_patch_inspect(PyObject* module);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

/* MemviewSliceIsContig.proto */
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);

/* OverlappingSlices.proto */
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
                                __Pyx_memviewslice *slice2,
                                int ndim, size_t itemsize);

/* Capsule.proto */
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* TypeInfoCompare.proto */
static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);

/* MemviewSliceValidateAndInit.proto */
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_double(PyObject *);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *);

/* ObjectToMemviewSlice.proto */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj);

/* MemviewDtypeToObject.proto */
static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp);
static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value);

/* None.proto */
static CYTHON_INLINE long __Pyx_pow_long(long, long);

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);

/* MemviewSliceCopyTemplate.proto */
static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* PyIdentifierFromString.proto */
#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

/* ModuleImport.proto */
static PyObject *__Pyx_ImportModule(const char *name);

/* TypeImport.proto */
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
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*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/

/* Module declarations from 'cython.view' */

/* Module declarations from 'cython' */

/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython.version' */

/* Module declarations from 'cpython.exc' */

/* Module declarations from 'cpython.module' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'cpython.tuple' */

/* Module declarations from 'cpython.list' */

/* Module declarations from 'cpython.sequence' */

/* Module declarations from 'cpython.mapping' */

/* Module declarations from 'cpython.iterator' */

/* Module declarations from 'cpython.number' */

/* Module declarations from 'cpython.int' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.bool' */
static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;

/* Module declarations from 'cpython.long' */

/* Module declarations from 'cpython.float' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.complex' */
static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;

/* Module declarations from 'cpython.string' */

/* Module declarations from 'cpython.unicode' */

/* Module declarations from 'cpython.dict' */

/* Module declarations from 'cpython.instance' */

/* Module declarations from 'cpython.function' */

/* Module declarations from 'cpython.method' */

/* Module declarations from 'cpython.weakref' */

/* Module declarations from 'cpython.getargs' */

/* Module declarations from 'cpython.pythread' */

/* Module declarations from 'cpython.pystate' */

/* Module declarations from 'cpython.cobject' */

/* Module declarations from 'cpython.oldbuffer' */

/* Module declarations from 'cpython.set' */

/* Module declarations from 'cpython.bytes' */

/* Module declarations from 'cpython.pycapsule' */

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/

/* Module declarations from 'libc.math' */

/* Module declarations from 'tofu.geom._GG03' */
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_memoryview_thread_locks_used;
static PyThread_type_lock __pyx_memoryview_thread_locks[8];
static PyObject *__pyx_f_4tofu_4geom_5_GG03__check_DLvsLMinMax(__Pyx_memviewslice, struct __pyx_opt_args_4tofu_4geom_5_GG03__check_DLvsLMinMax *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin(__Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, PyObject *, struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4tofu_4geom_5_GG03_get_insp(PyObject *); /*proto*/
static PyObject *__pyx_f_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor(double, double, double, double, double, double, double, double, double, double, double, double, double, double, struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4tofu_4geom_5_GG03_LOS_sino_Tor(double, double, double, double, double, double, double, double, struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Tor *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_4tofu_4geom_5_GG03_LOS_sino_Lin(double, double, double, double, double, double, double, double, struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Lin *__pyx_optional_args); /*proto*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
static void *__pyx_align_pointer(void *, size_t); /*proto*/
static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
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*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 };
#define __Pyx_MODULE_NAME "tofu.geom._GG03"
extern int __pyx_module_is_main_tofu__geom___GG03;
int __pyx_module_is_main_tofu__geom___GG03 = 0;

/* Implementation of 'tofu.geom._GG03' */
static PyObject *__pyx_builtin_all;
static PyObject *__pyx_builtin_any;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_max;
static PyObject *__pyx_builtin_min;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_IndexError;
static const char __pyx_k_[] = ",";
static const char __pyx_k_2[] = "2";
static const char __pyx_k_3[] = "3";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_C[] = "C";
static const char __pyx_k_D[] = "D";
static const char __pyx_k_L[] = "L";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_O[] = "O";
static const char __pyx_k_R[] = "R";
static const char __pyx_k_T[] = "T";
static const char __pyx_k_V[] = "V";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_Y[] = "Y";
static const char __pyx_k_Z[] = "Z";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_u[] = "u";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_BC[] = "BC";
static const char __pyx_k_C0[] = "C0";
static const char __pyx_k_C1[] = "C1";
static const char __pyx_k_C2[] = "C2";
static const char __pyx_k_D0[] = "D0";
static const char __pyx_k_D1[] = "D1";
static const char __pyx_k_D2[] = "D2";
static const char __pyx_k_DL[] = "DL";
static const char __pyx_k_DR[] = "DR";
static const char __pyx_k_DX[] = "DX";
static const char __pyx_k_DY[] = "DY";
static const char __pyx_k_DZ[] = "DZ";
static const char __pyx_k_Ds[] = "Ds";
static const char __pyx_k_In[] = "In";
static const char __pyx_k_Ln[] = "Ln";
static const char __pyx_k_N1[] = "N1";
static const char __pyx_k_N2[] = "N2";
static const char __pyx_k_ND[] = "ND";
static const char __pyx_k_NL[] = "NL";
static const char __pyx_k_NP[] = "NP";
static const char __pyx_k_NR[] = "NR";
static const char __pyx_k_NX[] = "NX";
static const char __pyx_k_NY[] = "NY";
static const char __pyx_k_NZ[] = "NZ";
static const char __pyx_k_R0[] = "R0";
static const char __pyx_k_RZ[] = "RZ";
static const char __pyx_k_Rn[] = "Rn";
static const char __pyx_k_Ru[] = "Ru";
static const char __pyx_k_X1[] = "X1";
static const char __pyx_k_X2[] = "X2";
static const char __pyx_k_Xn[] = "Xn";
static const char __pyx_k_Y0[] = "Y0";
static const char __pyx_k_Yn[] = "Yn";
static const char __pyx_k_Z0[] = "Z0";
static const char __pyx_k_Zn[] = "Zn";
static const char __pyx_k__2[] = "(";
static const char __pyx_k__3[] = "";
static const char __pyx_k__5[] = ")";
static const char __pyx_k_d1[] = "d1";
static const char __pyx_k_d2[] = "d2";
static const char __pyx_k_dL[] = "dL";
static const char __pyx_k_dR[] = "dR";
static const char __pyx_k_dS[] = "dS";
static const char __pyx_k_dV[] = "dV";
static const char __pyx_k_dX[] = "dX";
static const char __pyx_k_dY[] = "dY";
static const char __pyx_k_dZ[] = "dZ";
static const char __pyx_k_dl[] = "dl";
static const char __pyx_k_dx[] = "dx";
static const char __pyx_k_ee[] = "ee";
static const char __pyx_k_ff[] = "ff";
static const char __pyx_k_i1[] = "i1";
static const char __pyx_k_i2[] = "i2";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_ii[] = "ii";
static const char __pyx_k_jj[] = "jj";
static const char __pyx_k_kk[] = "kk";
static const char __pyx_k_kw[] = "kw";
static const char __pyx_k_ll[] = "ll";
static const char __pyx_k_n1[] = "n1";
static const char __pyx_k_n2[] = "n2";
static const char __pyx_k_nL[] = "nL";
static const char __pyx_k_na[] = "na";
static const char __pyx_k_nn[] = "nn";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_nt[] = "nt";
static const char __pyx_k_pN[] = "pN";
static const char __pyx_k_pP[] = "pP";
static const char __pyx_k_pi[] = "pi";
static const char __pyx_k_pp[] = "pp";
static const char __pyx_k_ss[] = "ss";
static const char __pyx_k_u0[] = "u0";
static const char __pyx_k_u1[] = "u1";
static const char __pyx_k_u2[] = "u2";
static const char __pyx_k_us[] = "us";
static const char __pyx_k_v0[] = "v0";
static const char __pyx_k_v1[] = "v1";
static const char __pyx_k_xi[] = "xi";
static const char __pyx_k_zz[] = "zz";
static const char __pyx_k_Ani[] = "Ani";
static const char __pyx_k_BV0[] = "BV0";
static const char __pyx_k_BV1[] = "BV1";
static const char __pyx_k_DIn[] = "DIn";
static const char __pyx_k_DLc[] = "DLc";
static const char __pyx_k_DLs[] = "DLs";
static const char __pyx_k_IIn[] = "IIn";
static const char __pyx_k_InT[] = "InT";
static const char __pyx_k_Ind[] = "Ind";
static const char __pyx_k_Ins[] = "Ins";
static const char __pyx_k_LOS[] = "LOS";
static const char __pyx_k_LdS[] = "LdS";
static const char __pyx_k_Lim[] = "Lim";
static const char __pyx_k_NR0[] = "NR0";
static const char __pyx_k_NY0[] = "NY0";
static const char __pyx_k_NZ0[] = "NZ0";
static const char __pyx_k_Out[] = "Out";
static const char __pyx_k_PIn[] = "PIn";
static const char __pyx_k_Phi[] = "Phi";
static const char __pyx_k_Pts[] = "Pts";
static const char __pyx_k_R0n[] = "R0n";
static const char __pyx_k_R_Z[] = "(R,Z)";
static const char __pyx_k_Ri0[] = "Ri0";
static const char __pyx_k_Ri1[] = "Ri1";
static const char __pyx_k_Sca[] = "Sca";
static const char __pyx_k_Str[] = "Str";
static const char __pyx_k_Sum[] = "Sum";
static const char __pyx_k_Tor[] = "Tor";
static const char __pyx_k_VIn[] = "VIn";
static const char __pyx_k_Y0n[] = "Y0n";
static const char __pyx_k_Z0n[] = "Z0n";
static const char __pyx_k_Zi0[] = "Zi0";
static const char __pyx_k_Zi1[] = "Zi1";
static const char __pyx_k_abs[] = "abs";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_ani[] = "ani";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_axm[] = "axm";
static const char __pyx_k_bla[] = "bla";
static const char __pyx_k_cos[] = "cos";
static const char __pyx_k_cyl[] = "cyl";
static const char __pyx_k_d1r[] = "d1r";
static const char __pyx_k_d2r[] = "d2r";
static const char __pyx_k_dLr[] = "dLr";
static const char __pyx_k_dRr[] = "dRr";
static const char __pyx_k_dSM[] = "dSM";
static const char __pyx_k_dX1[] = "dX1";
static const char __pyx_k_dX2[] = "dX2";
static const char __pyx_k_dXr[] = "dXr";
static const char __pyx_k_dYr[] = "dYr";
static const char __pyx_k_dZr[] = "dZr";
static const char __pyx_k_dl0[] = "dl0";
static const char __pyx_k_dlr[] = "dlr";
static const char __pyx_k_dsF[] = "dsF";
static const char __pyx_k_dus[] = "dus";
static const char __pyx_k_iIn[] = "iIn";
static const char __pyx_k_iiL[] = "iiL";
static const char __pyx_k_iiR[] = "iiR";
static const char __pyx_k_iiZ[] = "iiZ";
static const char __pyx_k_iii[] = "iii";
static const char __pyx_k_iin[] = "iin";
static const char __pyx_k_ind[] = "ind";
static const char __pyx_k_inf[] = "inf";
static const char __pyx_k_jj0[] = "jj0";
static const char __pyx_k_kkb[] = "kkb";
static const char __pyx_k_kkk[] = "kkk";
static const char __pyx_k_lim[] = "lim";
static const char __pyx_k_lin[] = "lin";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_nL0[] = "nL0";
static const char __pyx_k_nL1[] = "nL1";
static const char __pyx_k_nan[] = "nan";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_nii[] = "nii";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_out[] = "out";
static const char __pyx_k_pIn[] = "pIn";
static const char __pyx_k_phi[] = "phi";
static const char __pyx_k_pts[] = "pts";
static const char __pyx_k_rel[] = "rel";
static const char __pyx_k_sig[] = "sig";
static const char __pyx_k_sin[] = "sin";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_tor[] = "tor";
static const char __pyx_k_DPhi[] = "DPhi";
static const char __pyx_k_Dphi[] = "Dphi";
static const char __pyx_k_EpsA[] = "EpsA";
static const char __pyx_k_EpsB[] = "EpsB";
static const char __pyx_k_Full[] = "Full";
static const char __pyx_k_IOut[] = "IOut";
static const char __pyx_k_LPts[] = "LPts";
static const char __pyx_k_LdLr[] = "LdLr";
static const char __pyx_k_Lind[] = "Lind";
static const char __pyx_k_Mode[] = "Mode";
static const char __pyx_k_Nind[] = "Nind";
static const char __pyx_k_OutT[] = "OutT";
static const char __pyx_k_Outs[] = "Outs";
static const char __pyx_k_PMin[] = "PMin";
static const char __pyx_k_POut[] = "POut";
static const char __pyx_k_Path[] = "Path";
static const char __pyx_k_Phi0[] = "Phi0";
static const char __pyx_k_Phi1[] = "Phi1";
static const char __pyx_k_Phin[] = "Phin";
static const char __pyx_k_Poly[] = "Poly";
static const char __pyx_k_PtsM[] = "PtsM";
static const char __pyx_k_RMin[] = "RMin";
static const char __pyx_k_Rref[] = "Rref";
static const char __pyx_k_Test[] = "Test";
static const char __pyx_k_Vect[] = "Vect";
static const char __pyx_k__305[] = "*";
static const char __pyx_k_abs0[] = "abs0";
static const char __pyx_k_abs1[] = "abs1";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_atol[] = "atol";
static const char __pyx_k_axis[] = "axis";
static const char __pyx_k_base[] = "base";
static const char __pyx_k_call[] = "__call__";
static const char __pyx_k_cart[] = "cart";
static const char __pyx_k_cc_N[] = "(cc,N)";
static const char __pyx_k_cc_n[] = "(cc,n)";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_dR0r[] = "dR0r";
static const char __pyx_k_dRr0[] = "dRr0";
static const char __pyx_k_dY0r[] = "dY0r";
static const char __pyx_k_dZ0r[] = "dZ0r";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_iOut[] = "iOut";
static const char __pyx_k_iind[] = "iind";
static const char __pyx_k_ind0[] = "ind0";
static const char __pyx_k_ind1[] = "ind1";
static const char __pyx_k_ind2[] = "ind2";
static const char __pyx_k_indI[] = "indI";
static const char __pyx_k_indL[] = "indL";
static const char __pyx_k_indM[] = "indM";
static const char __pyx_k_indR[] = "indR";
static const char __pyx_k_indX[] = "indX";
static const char __pyx_k_indY[] = "indY";
static const char __pyx_k_indZ[] = "indZ";
static const char __pyx_k_insp[] = "insp";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_kOut[] = "kOut";
static const char __pyx_k_kPIn[] = "kPIn";
static const char __pyx_k_kind[] = "kind";
static const char __pyx_k_kpin[] = "kpin";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_n_cc[] = "(n,cc)";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_ndim[] = "ndim";
static const char __pyx_k_ones[] = "ones";
static const char __pyx_k_pOut[] = "pOut";
static const char __pyx_k_pack[] = "pack";
static const char __pyx_k_path[] = "path";
static const char __pyx_k_poly[] = "poly";
static const char __pyx_k_real[] = "real";
static const char __pyx_k_romb[] = "romb";
static const char __pyx_k_show[] = "show";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_sort[] = "sort";
static const char __pyx_k_sqrt[] = "sqrt";
static const char __pyx_k_step[] = "step";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_stre[] = "stre";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_tile[] = "tile";
static const char __pyx_k_ASCII[] = "ASCII";
static const char __pyx_k_Clock[] = "Clock";
static const char __pyx_k_DDPhi[] = "DDPhi";
static const char __pyx_k_DPhi0[] = "DPhi0";
static const char __pyx_k_DPhi1[] = "DPhi1";
static const char __pyx_k_EpsUz[] = "EpsUz";
static const char __pyx_k_EpsVz[] = "EpsVz";
static const char __pyx_k_Faces[] = "Faces";
static const char __pyx_k_Indin[] = "Indin";
static const char __pyx_k_Inter[] = "Inter";
static const char __pyx_k_LRref[] = "LRref";
static const char __pyx_k_LSLim[] = "LSLim";
static const char __pyx_k_LSVIn[] = "LSVIn";
static const char __pyx_k_NPoly[] = "NPoly";
static const char __pyx_k_NRPhi[] = "NRPhi";
static const char __pyx_k_Theta[] = "Theta";
static const char __pyx_k_VPbis[] = "VPbis";
static const char __pyx_k_VPoly[] = "VPoly";
static const char __pyx_k_VType[] = "VType";
static const char __pyx_k_Vuniq[] = "Vuniq";
static const char __pyx_k_X_Y_Z[] = "(X,Y,Z)";
static const char __pyx_k_all_2[] = "__all__";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_dPhir[] = "dPhir";
static const char __pyx_k_dRPhi[] = "dRPhi";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_error[] = "error";
static const char __pyx_k_flags[] = "flags";
static const char __pyx_k_hypot[] = "hypot";
static const char __pyx_k_iindF[] = "iindF";
static const char __pyx_k_iiphi[] = "iiphi";
static const char __pyx_k_indR0[] = "indR0";
static const char __pyx_k_indY0[] = "indY0";
static const char __pyx_k_indZ0[] = "indZ0";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_indin[] = "indin";
static const char __pyx_k_indok[] = "indok";
static const char __pyx_k_int64[] = "int64";
static const char __pyx_k_isnan[] = "isnan";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_kPMin[] = "kPMin";
static const char __pyx_k_kPOut[] = "kPOut";
static const char __pyx_k_lower[] = "lower";
static const char __pyx_k_lslim[] = "lslim";
static const char __pyx_k_nPhi0[] = "nPhi0";
static const char __pyx_k_nPhi1[] = "nPhi1";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_order[] = "order";
static const char __pyx_k_pNbis[] = "pNbis";
static const char __pyx_k_pPbis[] = "pPbis";
static const char __pyx_k_ptsrz[] = "ptsrz";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_ravel[] = "ravel";
static const char __pyx_k_roots[] = "roots";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_simps[] = "simps";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_theta[] = "theta";
static const char __pyx_k_x_y_z[] = "(x,y,z)";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_Bounds[] = "Bounds";
static const char __pyx_k_Forbid[] = "Forbid";
static const char __pyx_k_InterX[] = "InterX";
static const char __pyx_k_InterY[] = "InterY";
static const char __pyx_k_InterZ[] = "InterZ";
static const char __pyx_k_LSPoly[] = "LSPoly";
static const char __pyx_k_NRPhi0[] = "NRPhi0";
static const char __pyx_k_RZPoly[] = "RZPoly";
static const char __pyx_k_Rratio[] = "Rratio";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_astype[] = "astype";
static const char __pyx_k_dLMode[] = "dLMode";
static const char __pyx_k_dLrRef[] = "dLrRef";
static const char __pyx_k_dRPhir[] = "dRPhir";
static const char __pyx_k_dSMode[] = "dSMode";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_indout[] = "indout";
static const char __pyx_k_isreal[] = "isreal";
static const char __pyx_k_layout[] = "layout";
static const char __pyx_k_margin[] = "margin";
static const char __pyx_k_method[] = "method";
static const char __pyx_k_nRPhi0[] = "nRPhi0";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_radius[] = "radius";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_repeat[] = "repeat";
static const char __pyx_k_resize[] = "resize";
static const char __pyx_k_struct[] = "struct";
static const char __pyx_k_unique[] = "unique";
static const char __pyx_k_unpack[] = "unpack";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_vstack[] = "vstack";
static const char __pyx_k_LMinMax[] = "LMinMax";
static const char __pyx_k_MinMax1[] = "MinMax1";
static const char __pyx_k_MinMax2[] = "MinMax2";
static const char __pyx_k_NPhimax[] = "NPhimax";
static const char __pyx_k_RMinMax[] = "RMinMax";
static const char __pyx_k_R_Z_Phi[] = "(R,Z,Phi)";
static const char __pyx_k_RrefRef[] = "RrefRef";
static const char __pyx_k_Vectbis[] = "Vectbis";
static const char __pyx_k_VperpIn[] = "VperpIn";
static const char __pyx_k_XMinMax[] = "XMinMax";
static const char __pyx_k_YMinMax[] = "YMinMax";
static const char __pyx_k_ZMinMax[] = "ZMinMax";
static const char __pyx_k_arctan2[] = "arctan2";
static const char __pyx_k_argsort[] = "argsort";
static const char __pyx_k_asarray[] = "asarray";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_flatten[] = "flatten";
static const char __pyx_k_float64[] = "float64";
static const char __pyx_k_fortran[] = "fortran";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_indR0ii[] = "indR0ii";
static const char __pyx_k_indiijj[] = "indiijj";
static const char __pyx_k_inspect[] = "inspect";
static const char __pyx_k_memview[] = "memview";
static const char __pyx_k_nBounds[] = "nBounds";
static const char __pyx_k_ndarray[] = "ndarray";
static const char __pyx_k_nonzero[] = "nonzero";
static const char __pyx_k_replace[] = "replace";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_scpintg[] = "scpintg";
static const char __pyx_k_version[] = "version";
static const char __pyx_k_vperpIn[] = "vperpIn";
static const char __pyx_k_CrossRef[] = "CrossRef";
static const char __pyx_k_Ellipsis[] = "Ellipsis";
static const char __pyx_k_EnvTheta[] = "EnvTheta";
static const char __pyx_k_EpsPlane[] = "EpsPlane";
static const char __pyx_k_ImpTheta[] = "ImpTheta";
static const char __pyx_k_LOS_sino[] = "LOS_sino";
static const char __pyx_k_PtsCross[] = "PtsCross";
static const char __pyx_k_VPolybis[] = "VPolybis";
static const char __pyx_k_VperpOut[] = "VperpOut";
static const char __pyx_k_allclose[] = "allclose";
static const char __pyx_k_check_ff[] = "check_ff";
static const char __pyx_k_defaults[] = "defaults";
static const char __pyx_k_endpoint[] = "endpoint";
static const char __pyx_k_fkwdargs[] = "fkwdargs";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_indNoNan[] = "indNoNan";
static const char __pyx_k_itemsize[] = "itemsize";
static const char __pyx_k_linspace[] = "linspace";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_swapaxes[] = "swapaxes";
static const char __pyx_k_vperpOut[] = "vperpOut";
static const char __pyx_k_LPtsCross[] = "LPtsCross";
static const char __pyx_k_NRPhi_int[] = "NRPhi_int";
static const char __pyx_k_PhiMinMax[] = "PhiMinMax";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_dRPhirRef[] = "dRPhirRef";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_equal_nan[] = "equal_nan";
static const char __pyx_k_indBounds[] = "indBounds";
static const char __pyx_k_layout_in[] = "layout_in";
static const char __pyx_k_phiMinMax[] = "phiMinMax";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_signature[] = "signature";
static const char __pyx_k_transform[] = "transform";
static const char __pyx_k_Arg_method[] = "Arg method";
static const char __pyx_k_CoordShift[] = "CoordShift";
static const char __pyx_k_DPhiMinMax[] = "DPhiMinMax";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_Poly_Order[] = "Poly_Order";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_getargspec[] = "getargspec";
static const char __pyx_k_parameters[] = "parameters";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_concatenate[] = "concatenate";
static const char __pyx_k_Non_valid_In[] = "Non-valid In !";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_Ves_isInside[] = "_Ves_isInside";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_Arg_DLs_dim_0[] = "Arg DLs - dim 0";
static const char __pyx_k_Non_valid_Out[] = "Non-valid Out !";
static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_LOS_get_sample[] = "LOS_get_sample";
static const char __pyx_k_Poly_VolAngTor[] = "Poly_VolAngTor";
static const char __pyx_k_Sino_ImpactEnv[] = "Sino_ImpactEnv";
static const char __pyx_k_asfortranarray[] = "asfortranarray";
static const char __pyx_k_contains_point[] = "contains_point";
static const char __pyx_k_LOS_calc_signal[] = "LOS_calc_signal";
static const char __pyx_k_Ves_Smesh_Cross[] = "_Ves_Smesh_Cross";
static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
static const char __pyx_k_contains_points[] = "contains_points";
static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
static const char __pyx_k_matplotlib_path[] = "matplotlib.path";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_scipy_integrate[] = "scipy.integrate";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_tofu_geom__GG03[] = "tofu.geom._GG03";
static const char __pyx_k_Arg_dL_must_be_0[] = "Arg dL must be >0. !";
static const char __pyx_k_Args_Ds_us_DLs_1[] = "Args Ds, us, DLs 1";
static const char __pyx_k_Args_Ds_us_dim_0[] = "Args Ds, us - dim 0";
static const char __pyx_k_Poly_isClockwise[] = "Poly_isClockwise";
static const char __pyx_k_ascontiguousarray[] = "ascontiguousarray";
static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
static const char __pyx_k_Ves_meshCross_FromD[] = "_Ves_meshCross_FromD";
static const char __pyx_k_tofu_geom__GG03_pyx[] = "tofu/geom/_GG03.pyx";
static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
static const char __pyx_k_Arg_dLMode_in_abs_rel[] = "Arg dLMode in ['abs','rel']";
static const char __pyx_k_POSITIONAL_OR_KEYWORD[] = "POSITIONAL_OR_KEYWORD";
static const char __pyx_k_Ves_meshCross_FromInd[] = "_Ves_meshCross_FromInd";
static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
static const char __pyx_k_getBoundsInter2AngSeg[] = "_getBoundsInter2AngSeg";
static const char __pyx_k_ConvertImpact_Theta2Xi[] = "ConvertImpact_Theta2Xi";
static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
static const char __pyx_k_Ves_mesh_dlfromL_cython[] = "_Ves_mesh_dlfromL_cython";
static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
static const char __pyx_k_Arg_Clock_must_be_a_bool[] = "Arg Clock must be a bool !";
static const char __pyx_k_Arg_close_must_be_a_bool[] = "Arg close must be a bool !";
static const char __pyx_k_Arg_order_must_be_in_c_f[] = "Arg order must be in ['c','f'] !";
static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
static const char __pyx_k_Arg_Forbid_must_be_a_bool[] = "Arg Forbid must be a bool !";
static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
static const char __pyx_k_LOS_Calc_PInOut_VesStruct[] = "LOS_Calc_PInOut_VesStruct";
static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
static const char __pyx_k_must_be_a_callable_function[] = " must be a callable (function) !";
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static const char __pyx_k_Arg_CrossRef_must_be_a_float[] = "Arg CrossRef must be a float !";
static const char __pyx_k_Input_emissivity_function_ff[] = "Input emissivity function (ff)";
static const char __pyx_k_There_is_no_x_value_available[] = "There is no x value available !";
static const char __pyx_k_Ves_Smesh_Lin_SubFromD_cython[] = "_Ves_Smesh_Lin_SubFromD_cython";
static const char __pyx_k_Ves_Smesh_Tor_SubFromD_cython[] = "_Ves_Smesh_Tor_SubFromD_cython";
static const char __pyx_k_Ves_Vmesh_Lin_SubFromD_cython[] = "_Ves_Vmesh_Lin_SubFromD_cython";
static const char __pyx_k_Ves_Vmesh_Tor_SubFromD_cython[] = "_Ves_Vmesh_Tor_SubFromD_cython";
static const char __pyx_k_ff_must_return_a_N_np_ndarray[] = " ff must return a (N,) np.ndarray !";
static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
static const char __pyx_k_Ves_Smesh_TorStruct_SubFromInd[] = "_Ves_Smesh_TorStruct_SubFromInd_cython";
static const char __pyx_k_must_take_one_positional_arg_a[] = " must take one positional arg: a (3,N) np.ndarray";
static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
static const char __pyx_k_Arg_Poly_must_contain_the_2D_or[] = "Arg Poly must contain the 2D or 3D coordinates of at least 3 points (polygon) !";
static const char __pyx_k_Arg_RZ_should_be_a_2_np_ndarray[] = "Arg RZ should be a (2,) np.ndarray !";
static const char __pyx_k_Arg_layout_in_must_be_in_cc_n_n[] = "Arg layout_in must be in ['(cc,n)','(n,cc)'] !";
static const char __pyx_k_Arg_layout_must_be_in_cc_n_n_cc[] = "Arg layout must be in ['(cc,n)','(n,cc)'] !";
static const char __pyx_k_Args_EpsUz_EpsVz_EpsA_EpsB_must[] = "Args [EpsUz,EpsVz,EpsA,EpsB] must be floats < 1.e-4 !";
static const char __pyx_k_Args_LSPoly_LSLim_LSVIn_must_be[] = "Args LSPoly,LSLim,LSVIn must be None or lists of same len() !";
static const char __pyx_k_If_Ani_True_ff_must_return_a_nt[] = "If Ani=True, ff must return a (nt,N) np.ndarray when ";
static const char __pyx_k_Pts_is_3_N_Vect_is_provided_and[] = "Pts is (3,N), Vect is provided and t is (nt,)";
static const char __pyx_k_There_is_no_phi_value_available[] = "There is no phi value available !";
static const char __pyx_k_Ves_Smesh_Lin_SubFromInd_cython[] = "_Ves_Smesh_Lin_SubFromInd_cython";
static const char __pyx_k_Ves_Smesh_TorStruct_SubFromD_cy[] = "_Ves_Smesh_TorStruct_SubFromD_cython";
static const char __pyx_k_Ves_Smesh_Tor_SubFromInd_cython[] = "_Ves_Smesh_Tor_SubFromInd_cython";
static const char __pyx_k_Ves_Vmesh_Lin_SubFromInd_cython[] = "_Ves_Vmesh_Lin_SubFromInd_cython";
static const char __pyx_k_Ves_Vmesh_Tor_SubFromInd_cython[] = "_Ves_Vmesh_Tor_SubFromInd_cython";
static const char __pyx_k_When_fed_a_3_N_np_array_only_or[] = "When fed a (3,N) np.array only, or if t is a scalar,";
static const char __pyx_k_must_have_kwarg_t_None_for_time[] = " must have kwarg 't=None' for time vector !";
static const char __pyx_k_must_take_only_one_positional_a[] = " must take only one positional argument: ff(Pts) !";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_t_a_len_nt_iterable_must_return[] = "t a len()=nt iterable, must return a (nt,N) np.ndarray !";
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static const char __pyx_k_Arg_In_and_Out_coordinate_format[] = "Arg In and Out (coordinate format) must be comma-separated  !";
static const char __pyx_k_Arg_Lim_must_be_a_len_2_iterable[] = "Arg Lim must be a len()==2 iterable or a list of such !";
static const char __pyx_k_Arg_Poly_should_be_a_2_N_np_ndar[] = "Arg Poly should be a (2,N) np.ndarray !";
static const char __pyx_k_Arg_Pts_must_be_a_1D_or_2D_np_nd[] = "Arg Pts must be a 1D or 2D np.ndarray !";
static const char __pyx_k_Arg_RMin_must_be_None_or_a_float[] = "Arg RMin must be None or a float !";
static const char __pyx_k_Arg_VPoly_must_be_a_2_N_np_ndarr[] = "Arg VPoly must be a (2,N) np.ndarray !";
static const char __pyx_k_Arg_VType_must_be_a_str_in_Tor_L[] = "Arg VType must be a str in ['Tor','Lin'] !";
static const char __pyx_k_Arg_t_must_be_None_a_scalar_or_a[] = "Arg t must be None, a scalar or an iterable !";
static const char __pyx_k_Args_Ds_and_dus_must_be_of_the_s[] = "Args Ds and dus must be of the same shape (3,) or (3,NL) !";
static const char __pyx_k_Args_VPoly_and_VIn_must_be_of_th[] = "Args VPoly and VIn must be of the same shape (2,NS) !";
static const char __pyx_k_Args_pP_pN_and_theta_must_have_s[] = "Args pP, pN and theta must have same shape !";
static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
static const char __pyx_k_Could_not_resolve_the_input_layo[] = "Could not resolve the input layout of Poly because shape==(3,3), specify !";
static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static const char __pyx_k_If_Ani_True_ff_must_handle_multi[] = "If Ani=True, ff must handle multiple points Pts (3,N) with ";
static const char __pyx_k_If_Ani_True_ff_must_take_a_keywo[] = "If Ani=True, ff must take a keyword argument 'Vect=None' !";
static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
static const char __pyx_k_Points_must_be_a_1D_or_2D_np_nda[] = "Points must be a 1D or 2D np.ndarray of 2 or 3 coordinates !";
static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
static const char __pyx_k_a_unique_common_vector_Vect_as_a[] = "a unique common vector (Vect as a len()=3 iterable)";
static const char __pyx_k_ff_Pts_t_t_where_Pts_is_a_3_N_np[] = "ff(Pts,t=t), where Pts is a (3,N) np.array and ";
static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
static const char __pyx_k_multiple_vectors_Vect_as_a_3_N_n[] = "multiple vectors (Vect as a (3,N) np.ndarray)";
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_kp_s_;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_n_s_A;
static PyObject *__pyx_n_s_ASCII;
static PyObject *__pyx_n_s_Ani;
static PyObject *__pyx_kp_s_Arg_Clock_must_be_a_bool;
static PyObject *__pyx_kp_s_Arg_CrossRef_must_be_a_float;
static PyObject *__pyx_kp_s_Arg_DLs_dim_0;
static PyObject *__pyx_kp_s_Arg_Forbid_must_be_a_bool;
static PyObject *__pyx_kp_s_Arg_In_and_Out_coordinate_format;
static PyObject *__pyx_kp_s_Arg_Lim_must_be_a_len_2_iterable;
static PyObject *__pyx_kp_s_Arg_Poly_must_contain_the_2D_or;
static PyObject *__pyx_kp_s_Arg_Poly_should_be_a_2_N_np_ndar;
static PyObject *__pyx_kp_s_Arg_Pts_must_be_a_1D_or_2D_np_nd;
static PyObject *__pyx_kp_s_Arg_RMin_must_be_None_or_a_float;
static PyObject *__pyx_kp_s_Arg_RZ_should_be_a_2_np_ndarray;
static PyObject *__pyx_kp_s_Arg_VPoly_must_be_a_2_N_np_ndarr;
static PyObject *__pyx_kp_s_Arg_VType_must_be_a_str_in_Tor_L;
static PyObject *__pyx_kp_s_Arg_close_must_be_a_bool;
static PyObject *__pyx_kp_s_Arg_dLMode_in_abs_rel;
static PyObject *__pyx_kp_s_Arg_dL_must_be_0;
static PyObject *__pyx_kp_s_Arg_layout_in_must_be_in_cc_n_n;
static PyObject *__pyx_kp_s_Arg_layout_must_be_in_cc_n_n_cc;
static PyObject *__pyx_kp_s_Arg_method;
static PyObject *__pyx_kp_s_Arg_order_must_be_in_c_f;
static PyObject *__pyx_kp_s_Arg_t_must_be_None_a_scalar_or_a;
static PyObject *__pyx_kp_s_Args_Ds_and_dus_must_be_of_the_s;
static PyObject *__pyx_kp_s_Args_Ds_us_DLs_1;
static PyObject *__pyx_kp_s_Args_Ds_us_dim_0;
static PyObject *__pyx_kp_s_Args_EpsUz_EpsVz_EpsA_EpsB_must;
static PyObject *__pyx_kp_s_Args_LSPoly_LSLim_LSVIn_must_be;
static PyObject *__pyx_kp_s_Args_VPoly_and_VIn_must_be_of_th;
static PyObject *__pyx_kp_s_Args_pP_pN_and_theta_must_have_s;
static PyObject *__pyx_n_s_BC;
static PyObject *__pyx_n_s_BV0;
static PyObject *__pyx_n_s_BV1;
static PyObject *__pyx_n_s_Bounds;
static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
static PyObject *__pyx_n_s_C;
static PyObject *__pyx_n_s_C0;
static PyObject *__pyx_n_s_C1;
static PyObject *__pyx_n_s_C2;
static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
static PyObject *__pyx_n_s_Clock;
static PyObject *__pyx_n_s_ConvertImpact_Theta2Xi;
static PyObject *__pyx_n_s_CoordShift;
static PyObject *__pyx_kp_s_Could_not_resolve_the_input_layo;
static PyObject *__pyx_n_s_CrossRef;
static PyObject *__pyx_n_s_D;
static PyObject *__pyx_n_s_D0;
static PyObject *__pyx_n_s_D1;
static PyObject *__pyx_n_s_D2;
static PyObject *__pyx_n_s_DDPhi;
static PyObject *__pyx_n_s_DIn;
static PyObject *__pyx_n_s_DL;
static PyObject *__pyx_n_s_DLc;
static PyObject *__pyx_n_s_DLs;
static PyObject *__pyx_n_s_DPhi;
static PyObject *__pyx_n_s_DPhi0;
static PyObject *__pyx_n_s_DPhi1;
static PyObject *__pyx_n_s_DPhiMinMax;
static PyObject *__pyx_n_s_DR;
static PyObject *__pyx_n_s_DX;
static PyObject *__pyx_n_s_DY;
static PyObject *__pyx_n_s_DZ;
static PyObject *__pyx_n_s_Dphi;
static PyObject *__pyx_n_s_Ds;
static PyObject *__pyx_n_s_Ellipsis;
static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
static PyObject *__pyx_n_s_EnvTheta;
static PyObject *__pyx_n_s_EpsA;
static PyObject *__pyx_n_s_EpsB;
static PyObject *__pyx_n_s_EpsPlane;
static PyObject *__pyx_n_s_EpsUz;
static PyObject *__pyx_n_s_EpsVz;
static PyObject *__pyx_n_s_Faces;
static PyObject *__pyx_n_s_Forbid;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_Full;
static PyObject *__pyx_n_s_IIn;
static PyObject *__pyx_n_s_IOut;
static PyObject *__pyx_kp_s_If_Ani_True_ff_must_handle_multi;
static PyObject *__pyx_kp_s_If_Ani_True_ff_must_return_a_nt;
static PyObject *__pyx_kp_s_If_Ani_True_ff_must_take_a_keywo;
static PyObject *__pyx_n_s_ImpTheta;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_In;
static PyObject *__pyx_n_s_InT;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
static PyObject *__pyx_n_s_Ind;
static PyObject *__pyx_n_s_IndexError;
static PyObject *__pyx_n_s_Indin;
static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
static PyObject *__pyx_kp_s_Input_emissivity_function_ff;
static PyObject *__pyx_n_s_Ins;
static PyObject *__pyx_n_s_Inter;
static PyObject *__pyx_n_s_InterX;
static PyObject *__pyx_n_s_InterY;
static PyObject *__pyx_n_s_InterZ;
static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
static PyObject *__pyx_n_s_L;
static PyObject *__pyx_n_s_LMinMax;
static PyObject *__pyx_n_s_LOS;
static PyObject *__pyx_n_s_LOS_Calc_PInOut_VesStruct;
static PyObject *__pyx_n_s_LOS_calc_signal;
static PyObject *__pyx_n_s_LOS_get_sample;
static PyObject *__pyx_n_s_LOS_sino;
static PyObject *__pyx_n_s_LPts;
static PyObject *__pyx_n_s_LPtsCross;
static PyObject *__pyx_n_s_LRref;
static PyObject *__pyx_n_s_LSLim;
static PyObject *__pyx_n_s_LSPoly;
static PyObject *__pyx_n_s_LSVIn;
static PyObject *__pyx_n_s_LdLr;
static PyObject *__pyx_n_s_LdS;
static PyObject *__pyx_n_s_Lim;
static PyObject *__pyx_n_s_Lind;
static PyObject *__pyx_n_s_Ln;
static PyObject *__pyx_n_s_MemoryError;
static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
static PyObject *__pyx_kp_s_MemoryView_of_r_object;
static PyObject *__pyx_n_s_MinMax1;
static PyObject *__pyx_n_s_MinMax2;
static PyObject *__pyx_n_s_Mode;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_n_s_N1;
static PyObject *__pyx_n_s_N2;
static PyObject *__pyx_n_s_ND;
static PyObject *__pyx_n_s_NL;
static PyObject *__pyx_n_s_NP;
static PyObject *__pyx_n_s_NPhimax;
static PyObject *__pyx_n_s_NPoly;
static PyObject *__pyx_n_s_NR;
static PyObject *__pyx_n_s_NR0;
static PyObject *__pyx_n_s_NRPhi;
static PyObject *__pyx_n_s_NRPhi0;
static PyObject *__pyx_n_s_NRPhi_int;
static PyObject *__pyx_n_s_NX;
static PyObject *__pyx_n_s_NY;
static PyObject *__pyx_n_s_NY0;
static PyObject *__pyx_n_s_NZ;
static PyObject *__pyx_n_s_NZ0;
static PyObject *__pyx_n_s_Nind;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_kp_s_Non_valid_In;
static PyObject *__pyx_kp_s_Non_valid_Out;
static PyObject *__pyx_n_b_O;
static PyObject *__pyx_n_s_Out;
static PyObject *__pyx_n_s_OutT;
static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
static PyObject *__pyx_n_s_Outs;
static PyObject *__pyx_n_s_PIn;
static PyObject *__pyx_n_s_PMin;
static PyObject *__pyx_n_s_POSITIONAL_OR_KEYWORD;
static PyObject *__pyx_n_s_POut;
static PyObject *__pyx_n_s_Path;
static PyObject *__pyx_n_s_Phi;
static PyObject *__pyx_n_s_Phi0;
static PyObject *__pyx_n_s_Phi1;
static PyObject *__pyx_n_s_PhiMinMax;
static PyObject *__pyx_n_s_Phin;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_kp_s_Points_must_be_a_1D_or_2D_np_nda;
static PyObject *__pyx_n_s_Poly;
static PyObject *__pyx_n_s_Poly_Order;
static PyObject *__pyx_n_s_Poly_VolAngTor;
static PyObject *__pyx_n_s_Poly_isClockwise;
static PyObject *__pyx_n_s_Pts;
static PyObject *__pyx_n_s_PtsCross;
static PyObject *__pyx_n_s_PtsM;
static PyObject *__pyx_kp_s_Pts_is_3_N_Vect_is_provided_and;
static PyObject *__pyx_n_s_R;
static PyObject *__pyx_n_s_R0;
static PyObject *__pyx_n_s_R0n;
static PyObject *__pyx_n_s_RMin;
static PyObject *__pyx_n_s_RMinMax;
static PyObject *__pyx_n_s_RZ;
static PyObject *__pyx_n_s_RZPoly;
static PyObject *__pyx_kp_s_R_Z;
static PyObject *__pyx_kp_s_R_Z_Phi;
static PyObject *__pyx_n_s_Ri0;
static PyObject *__pyx_n_s_Ri1;
static PyObject *__pyx_n_s_Rn;
static PyObject *__pyx_n_s_Rratio;
static PyObject *__pyx_n_s_Rref;
static PyObject *__pyx_n_s_RrefRef;
static PyObject *__pyx_n_s_Ru;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_Sca;
static PyObject *__pyx_n_s_Sino_ImpactEnv;
static PyObject *__pyx_n_s_Str;
static PyObject *__pyx_n_s_Sum;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_Test;
static PyObject *__pyx_kp_s_There_is_no_phi_value_available;
static PyObject *__pyx_kp_s_There_is_no_x_value_available;
static PyObject *__pyx_n_s_Theta;
static PyObject *__pyx_n_s_Tor;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
static PyObject *__pyx_n_s_V;
static PyObject *__pyx_n_s_VIn;
static PyObject *__pyx_n_s_VPbis;
static PyObject *__pyx_n_s_VPoly;
static PyObject *__pyx_n_s_VPolybis;
static PyObject *__pyx_n_s_VType;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_Vect;
static PyObject *__pyx_n_s_Vectbis;
static PyObject *__pyx_n_s_Ves_Smesh_Cross;
static PyObject *__pyx_n_s_Ves_Smesh_Lin_SubFromD_cython;
static PyObject *__pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython;
static PyObject *__pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy;
static PyObject *__pyx_n_s_Ves_Smesh_TorStruct_SubFromInd;
static PyObject *__pyx_n_s_Ves_Smesh_Tor_SubFromD_cython;
static PyObject *__pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython;
static PyObject *__pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython;
static PyObject *__pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython;
static PyObject *__pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython;
static PyObject *__pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython;
static PyObject *__pyx_n_s_Ves_isInside;
static PyObject *__pyx_n_s_Ves_meshCross_FromD;
static PyObject *__pyx_n_s_Ves_meshCross_FromInd;
static PyObject *__pyx_n_s_Ves_mesh_dlfromL_cython;
static PyObject *__pyx_n_s_View_MemoryView;
static PyObject *__pyx_n_s_VperpIn;
static PyObject *__pyx_n_s_VperpOut;
static PyObject *__pyx_n_s_Vuniq;
static PyObject *__pyx_kp_s_When_fed_a_3_N_np_array_only_or;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_X1;
static PyObject *__pyx_n_s_X2;
static PyObject *__pyx_n_s_XMinMax;
static PyObject *__pyx_kp_s_X_Y_Z;
static PyObject *__pyx_n_s_Xn;
static PyObject *__pyx_n_s_Y;
static PyObject *__pyx_n_s_Y0;
static PyObject *__pyx_n_s_Y0n;
static PyObject *__pyx_n_s_YMinMax;
static PyObject *__pyx_n_s_Yn;
static PyObject *__pyx_n_s_Z;
static PyObject *__pyx_n_s_Z0;
static PyObject *__pyx_n_s_Z0n;
static PyObject *__pyx_n_s_ZMinMax;
static PyObject *__pyx_n_s_Zi0;
static PyObject *__pyx_n_s_Zi1;
static PyObject *__pyx_n_s_Zn;
static PyObject *__pyx_kp_s__2;
static PyObject *__pyx_kp_s__3;
static PyObject *__pyx_n_s__305;
static PyObject *__pyx_kp_s__5;
static PyObject *__pyx_kp_s_a_unique_common_vector_Vect_as_a;
static PyObject *__pyx_n_s_abs;
static PyObject *__pyx_n_s_abs0;
static PyObject *__pyx_n_s_abs1;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_all_2;
static PyObject *__pyx_n_s_allclose;
static PyObject *__pyx_n_s_allocate_buffer;
static PyObject *__pyx_n_s_ani;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_arctan2;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_argsort;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_asarray;
static PyObject *__pyx_n_s_ascontiguousarray;
static PyObject *__pyx_n_s_asfortranarray;
static PyObject *__pyx_n_s_astype;
static PyObject *__pyx_n_s_atol;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_n_s_axm;
static PyObject *__pyx_n_s_base;
static PyObject *__pyx_n_s_bla;
static PyObject *__pyx_n_s_c;
static PyObject *__pyx_n_u_c;
static PyObject *__pyx_n_s_call;
static PyObject *__pyx_n_s_cart;
static PyObject *__pyx_kp_s_cc_N;
static PyObject *__pyx_kp_s_cc_n;
static PyObject *__pyx_n_s_check_ff;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_n_s_concatenate;
static PyObject *__pyx_n_s_contains_point;
static PyObject *__pyx_n_s_contains_points;
static PyObject *__pyx_kp_s_contiguous_and_direct;
static PyObject *__pyx_kp_s_contiguous_and_indirect;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_cos;
static PyObject *__pyx_n_s_cyl;
static PyObject *__pyx_n_s_d1;
static PyObject *__pyx_n_s_d1r;
static PyObject *__pyx_n_s_d2;
static PyObject *__pyx_n_s_d2r;
static PyObject *__pyx_n_s_dL;
static PyObject *__pyx_n_s_dLMode;
static PyObject *__pyx_n_s_dLr;
static PyObject *__pyx_n_s_dLrRef;
static PyObject *__pyx_n_s_dPhir;
static PyObject *__pyx_n_s_dR;
static PyObject *__pyx_n_s_dR0r;
static PyObject *__pyx_n_s_dRPhi;
static PyObject *__pyx_n_s_dRPhir;
static PyObject *__pyx_n_s_dRPhirRef;
static PyObject *__pyx_n_s_dRr;
static PyObject *__pyx_n_s_dRr0;
static PyObject *__pyx_n_s_dS;
static PyObject *__pyx_n_s_dSM;
static PyObject *__pyx_n_s_dSMode;
static PyObject *__pyx_n_s_dV;
static PyObject *__pyx_n_s_dX;
static PyObject *__pyx_n_s_dX1;
static PyObject *__pyx_n_s_dX2;
static PyObject *__pyx_n_s_dXr;
static PyObject *__pyx_n_s_dY;
static PyObject *__pyx_n_s_dY0r;
static PyObject *__pyx_n_s_dYr;
static PyObject *__pyx_n_s_dZ;
static PyObject *__pyx_n_s_dZ0r;
static PyObject *__pyx_n_s_dZr;
static PyObject *__pyx_n_s_default;
static PyObject *__pyx_n_s_defaults;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_dl;
static PyObject *__pyx_n_s_dl0;
static PyObject *__pyx_n_s_dlr;
static PyObject *__pyx_n_s_dsF;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_dtype_is_object;
static PyObject *__pyx_n_s_dus;
static PyObject *__pyx_n_s_dx;
static PyObject *__pyx_n_s_ee;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_endpoint;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_equal_nan;
static PyObject *__pyx_n_s_error;
static PyObject *__pyx_n_s_f;
static PyObject *__pyx_n_s_ff;
static PyObject *__pyx_kp_s_ff_Pts_t_t_where_Pts_is_a_3_N_np;
static PyObject *__pyx_kp_s_ff_must_return_a_N_np_ndarray;
static PyObject *__pyx_n_s_fkwdargs;
static PyObject *__pyx_n_s_flags;
static PyObject *__pyx_n_s_flatten;
static PyObject *__pyx_n_s_float64;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_fortran;
static PyObject *__pyx_n_u_fortran;
static PyObject *__pyx_n_s_getBoundsInter2AngSeg;
static PyObject *__pyx_n_s_getargspec;
static PyObject *__pyx_n_s_getitem;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
static PyObject *__pyx_n_s_hypot;
static PyObject *__pyx_n_s_i1;
static PyObject *__pyx_n_s_i2;
static PyObject *__pyx_n_s_iIn;
static PyObject *__pyx_n_s_iOut;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_ii;
static PyObject *__pyx_n_s_iiL;
static PyObject *__pyx_n_s_iiR;
static PyObject *__pyx_n_s_iiZ;
static PyObject *__pyx_n_s_iii;
static PyObject *__pyx_n_s_iin;
static PyObject *__pyx_n_s_iind;
static PyObject *__pyx_n_s_iindF;
static PyObject *__pyx_n_s_iiphi;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_ind;
static PyObject *__pyx_n_s_ind0;
static PyObject *__pyx_n_s_ind1;
static PyObject *__pyx_n_s_ind2;
static PyObject *__pyx_n_s_indBounds;
static PyObject *__pyx_n_s_indI;
static PyObject *__pyx_n_s_indL;
static PyObject *__pyx_n_s_indM;
static PyObject *__pyx_n_s_indNoNan;
static PyObject *__pyx_n_s_indR;
static PyObject *__pyx_n_s_indR0;
static PyObject *__pyx_n_s_indR0ii;
static PyObject *__pyx_n_s_indX;
static PyObject *__pyx_n_s_indY;
static PyObject *__pyx_n_s_indY0;
static PyObject *__pyx_n_s_indZ;
static PyObject *__pyx_n_s_indZ0;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_indiijj;
static PyObject *__pyx_n_s_indin;
static PyObject *__pyx_n_s_indok;
static PyObject *__pyx_n_s_indout;
static PyObject *__pyx_n_s_inf;
static PyObject *__pyx_n_s_insp;
static PyObject *__pyx_n_s_inspect;
static PyObject *__pyx_n_s_int64;
static PyObject *__pyx_n_s_isnan;
static PyObject *__pyx_n_s_isreal;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_itemsize;
static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
static PyObject *__pyx_n_s_iter;
static PyObject *__pyx_n_s_jj;
static PyObject *__pyx_n_s_jj0;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_kOut;
static PyObject *__pyx_n_s_kPIn;
static PyObject *__pyx_n_s_kPMin;
static PyObject *__pyx_n_s_kPOut;
static PyObject *__pyx_n_s_kind;
static PyObject *__pyx_n_s_kk;
static PyObject *__pyx_n_s_kkb;
static PyObject *__pyx_n_s_kkk;
static PyObject *__pyx_n_s_kpin;
static PyObject *__pyx_n_s_kw;
static PyObject *__pyx_n_s_layout;
static PyObject *__pyx_n_s_layout_in;
static PyObject *__pyx_n_s_lim;
static PyObject *__pyx_n_s_lin;
static PyObject *__pyx_n_s_linspace;
static PyObject *__pyx_n_s_ll;
static PyObject *__pyx_n_s_lower;
static PyObject *__pyx_n_s_lslim;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_margin;
static PyObject *__pyx_n_s_matplotlib_path;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_memview;
static PyObject *__pyx_n_s_method;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_n_s_mode;
static PyObject *__pyx_kp_s_multiple_vectors_Vect_as_a_3_N_n;
static PyObject *__pyx_kp_s_must_be_a_callable_function;
static PyObject *__pyx_kp_s_must_have_kwarg_t_None_for_time;
static PyObject *__pyx_kp_s_must_take_one_positional_arg_a;
static PyObject *__pyx_kp_s_must_take_only_one_positional_a;
static PyObject *__pyx_n_s_n1;
static PyObject *__pyx_n_s_n2;
static PyObject *__pyx_n_s_nBounds;
static PyObject *__pyx_n_s_nL;
static PyObject *__pyx_n_s_nL0;
static PyObject *__pyx_n_s_nL1;
static PyObject *__pyx_n_s_nPhi0;
static PyObject *__pyx_n_s_nPhi1;
static PyObject *__pyx_n_s_nRPhi0;
static PyObject *__pyx_kp_s_n_cc;
static PyObject *__pyx_n_s_na;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_name_2;
static PyObject *__pyx_n_s_nan;
static PyObject *__pyx_n_s_ndarray;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_n_s_ndim;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_nii;
static PyObject *__pyx_n_s_nn;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_nonzero;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_nt;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_ones;
static PyObject *__pyx_n_s_order;
static PyObject *__pyx_n_s_out;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_pIn;
static PyObject *__pyx_n_s_pN;
static PyObject *__pyx_n_s_pNbis;
static PyObject *__pyx_n_s_pOut;
static PyObject *__pyx_n_s_pP;
static PyObject *__pyx_n_s_pPbis;
static PyObject *__pyx_n_s_pack;
static PyObject *__pyx_n_s_parameters;
static PyObject *__pyx_n_s_path;
static PyObject *__pyx_n_s_phi;
static PyObject *__pyx_n_s_phiMinMax;
static PyObject *__pyx_n_s_pi;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_poly;
static PyObject *__pyx_n_s_pp;
static PyObject *__pyx_n_s_pts;
static PyObject *__pyx_n_s_ptsrz;
static PyObject *__pyx_n_s_pyx_PickleError;
static PyObject *__pyx_n_s_pyx_checksum;
static PyObject *__pyx_n_s_pyx_getbuffer;
static PyObject *__pyx_n_s_pyx_result;
static PyObject *__pyx_n_s_pyx_state;
static PyObject *__pyx_n_s_pyx_type;
static PyObject *__pyx_n_s_pyx_unpickle_Enum;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_n_s_radius;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_ravel;
static PyObject *__pyx_n_s_real;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_rel;
static PyObject *__pyx_n_s_repeat;
static PyObject *__pyx_n_s_replace;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_resize;
static PyObject *__pyx_n_s_romb;
static PyObject *__pyx_n_s_roots;
static PyObject *__pyx_n_s_scipy_integrate;
static PyObject *__pyx_n_s_scpintg;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_show;
static PyObject *__pyx_n_s_sig;
static PyObject *__pyx_n_s_signature;
static PyObject *__pyx_n_s_simps;
static PyObject *__pyx_n_s_sin;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_sort;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_sqrt;
static PyObject *__pyx_n_s_ss;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_step;
static PyObject *__pyx_n_s_stop;
static PyObject *__pyx_n_s_stre;
static PyObject *__pyx_kp_s_strided_and_direct;
static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
static PyObject *__pyx_kp_s_strided_and_indirect;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_struct;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_swapaxes;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_kp_s_t_a_len_nt_iterable_must_return;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_theta;
static PyObject *__pyx_n_s_tile;
static PyObject *__pyx_n_s_tofu_geom__GG03;
static PyObject *__pyx_kp_s_tofu_geom__GG03_pyx;
static PyObject *__pyx_n_s_tor;
static PyObject *__pyx_n_s_transform;
static PyObject *__pyx_n_s_u;
static PyObject *__pyx_n_s_u0;
static PyObject *__pyx_n_s_u1;
static PyObject *__pyx_n_s_u2;
static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
static PyObject *__pyx_n_s_unique;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_unpack;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_us;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_v0;
static PyObject *__pyx_n_s_v1;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_version;
static PyObject *__pyx_n_s_vperpIn;
static PyObject *__pyx_n_s_vperpOut;
static PyObject *__pyx_n_s_vstack;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_kp_s_x_y_z;
static PyObject *__pyx_n_s_xi;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_z;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_n_s_zz;
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_CoordShift(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Pts, PyObject *__pyx_v_In, PyObject *__pyx_v_Out, PyObject *__pyx_v_CrossRef); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_2Poly_isClockwise(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Poly); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_4Poly_Order(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Poly, PyObject *__pyx_v_order, PyObject *__pyx_v_Clock, PyObject *__pyx_v_close, PyObject *__pyx_v_layout, PyObject *__pyx_v_layout_in, PyObject *__pyx_v_Test); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_6Poly_VolAngTor(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Poly); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_8Sino_ImpactEnv(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_RZ, PyArrayObject *__pyx_v_Poly, int __pyx_v_NP, PyObject *__pyx_v_Test); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_10ConvertImpact_Theta2Xi(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_theta, PyObject *__pyx_v_pP, PyObject *__pyx_v_pN, PyObject *__pyx_v_sort); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_12_Ves_isInside(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Pts, PyObject *__pyx_v_VPoly, PyObject *__pyx_v_Lim, PyObject *__pyx_v_VType, PyObject *__pyx_v_In, PyObject *__pyx_v_Test); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_14_Ves_mesh_dlfromL_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_LMinMax, double __pyx_v_dL, PyObject *__pyx_v_DL, PyObject *__pyx_v_Lim, PyObject *__pyx_v_dLMode, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_16_Ves_meshCross_FromD(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_MinMax1, __Pyx_memviewslice __pyx_v_MinMax2, double __pyx_v_d1, double __pyx_v_d2, PyObject *__pyx_v_D1, PyObject *__pyx_v_D2, PyObject *__pyx_v_dSMode, PyObject *__pyx_v_VPoly, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_18_Ves_meshCross_FromInd(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_MinMax1, __Pyx_memviewslice __pyx_v_MinMax2, double __pyx_v_d1, double __pyx_v_d2, __Pyx_memviewslice __pyx_v_ind, PyObject *__pyx_v_dSMode, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_20_Ves_Smesh_Cross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_VPoly, double __pyx_v_dL, PyObject *__pyx_v_dLMode, PyObject *__pyx_v_D1, PyObject *__pyx_v_D2, double __pyx_v_margin, double __pyx_v_DIn, PyObject *__pyx_v_VIn); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_22_Ves_Vmesh_Tor_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dR, double __pyx_v_dZ, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_RMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, PyObject *__pyx_v_DR, PyObject *__pyx_v_DZ, PyObject *__pyx_v_DPhi, PyObject *__pyx_v_VPoly, PyObject *__pyx_v_Out, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_24_Ves_Vmesh_Tor_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dR, double __pyx_v_dZ, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_RMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, __Pyx_memviewslice __pyx_v_ind, PyObject *__pyx_v_Out, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_26_Ves_Vmesh_Lin_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dX, double __pyx_v_dY, double __pyx_v_dZ, __Pyx_memviewslice __pyx_v_XMinMax, __Pyx_memviewslice __pyx_v_YMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, PyObject *__pyx_v_DX, PyObject *__pyx_v_DY, PyObject *__pyx_v_DZ, PyObject *__pyx_v_VPoly, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_28_Ves_Vmesh_Lin_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dX, double __pyx_v_dY, double __pyx_v_dZ, __Pyx_memviewslice __pyx_v_XMinMax, __Pyx_memviewslice __pyx_v_YMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, PyArrayObject *__pyx_v_ind, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_30_getBoundsInter2AngSeg(CYTHON_UNUSED PyObject *__pyx_self, PyBoolObject *__pyx_v_Full, double __pyx_v_Phi0, double __pyx_v_Phi1, double __pyx_v_DPhi0, double __pyx_v_DPhi1); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_32_Ves_Smesh_Tor_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, PyObject *__pyx_v_DR, PyObject *__pyx_v_DZ, PyObject *__pyx_v_DPhi, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_PhiMinMax, PyObject *__pyx_v_Out, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_34_Ves_Smesh_Tor_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, __Pyx_memviewslice __pyx_v_ind, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_PhiMinMax, PyObject *__pyx_v_Out, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_36_Ves_Smesh_TorStruct_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_PhiMinMax, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, PyObject *__pyx_v_DR, PyObject *__pyx_v_DZ, PyObject *__pyx_v_DPhi, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_Out, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_38_Ves_Smesh_TorStruct_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_PhiMinMax, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, PyArrayObject *__pyx_v_ind, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_Out, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_40_Ves_Smesh_Lin_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_XMinMax, double __pyx_v_dL, double __pyx_v_dX, __Pyx_memviewslice __pyx_v_VPoly, PyObject *__pyx_v_DX, PyObject *__pyx_v_DY, PyObject *__pyx_v_DZ, double __pyx_v_DIn, PyObject *__pyx_v_VIn, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_42_Ves_Smesh_Lin_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_XMinMax, double __pyx_v_dL, double __pyx_v_dX, __Pyx_memviewslice __pyx_v_VPoly, PyArrayObject *__pyx_v_ind, double __pyx_v_DIn, PyObject *__pyx_v_VIn, double __pyx_v_margin); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_44LOS_Calc_PInOut_VesStruct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Ds, PyObject *__pyx_v_dus, PyArrayObject *__pyx_v_VPoly, PyArrayObject *__pyx_v_VIn, PyObject *__pyx_v_Lim, PyObject *__pyx_v_LSPoly, PyObject *__pyx_v_LSLim, PyObject *__pyx_v_LSVIn, PyObject *__pyx_v_RMin, PyObject *__pyx_v_Forbid, PyObject *__pyx_v_EpsUz, PyObject *__pyx_v_EpsVz, PyObject *__pyx_v_EpsA, PyObject *__pyx_v_EpsB, PyObject *__pyx_v_EpsPlane, PyObject *__pyx_v_VType, PyObject *__pyx_v_Test); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_46LOS_get_sample(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_Ds, __Pyx_memviewslice __pyx_v_us, PyObject *__pyx_v_dL, __Pyx_memviewslice __pyx_v_DLs, PyObject *__pyx_v_dLMode, PyObject *__pyx_v_method, PyObject *__pyx_v_Test); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_48check_ff(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ff, PyObject *__pyx_v_t, PyObject *__pyx_v_Ani, PyBoolObject *__pyx_v_Vuniq); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_50LOS_calc_signal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ff, __Pyx_memviewslice __pyx_v_Ds, __Pyx_memviewslice __pyx_v_us, PyObject *__pyx_v_dL, __Pyx_memviewslice __pyx_v_DLs, PyObject *__pyx_v_t, PyObject *__pyx_v_Ani, PyObject *__pyx_v_fkwdargs, PyObject *__pyx_v_dLMode, PyObject *__pyx_v_method, PyObject *__pyx_v_Test); /* proto */
static PyObject *__pyx_pf_4tofu_4geom_5_GG03_52LOS_sino(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_D, __Pyx_memviewslice __pyx_v_u, __Pyx_memviewslice __pyx_v_RZ, __Pyx_memviewslice __pyx_v_kOut, PyObject *__pyx_v_Mode, PyObject *__pyx_v_VType); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
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 */
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 */
static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
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 */
static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
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 */
static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
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 */
static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
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 */
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 */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
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 */
static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
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 */
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 */
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_0_;
static PyObject *__pyx_float_1_;
static PyObject *__pyx_float_2_;
static PyObject *__pyx_float_4_;
static PyObject *__pyx_float_6_;
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_0_95;
static PyObject *__pyx_float_1_eneg_4;
static PyObject *__pyx_float_1_eneg_6;
static PyObject *__pyx_float_1_eneg_9;
static PyObject *__pyx_float_neg_0_5;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_5;
static PyObject *__pyx_int_6;
static PyObject *__pyx_int_184977713;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_k__262;
static double __pyx_k__275;
static double __pyx_k__276;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__13;
static PyObject *__pyx_slice__14;
static PyObject *__pyx_slice__15;
static PyObject *__pyx_slice__18;
static PyObject *__pyx_slice__20;
static PyObject *__pyx_slice__22;
static PyObject *__pyx_slice__25;
static PyObject *__pyx_slice__27;
static PyObject *__pyx_slice__31;
static PyObject *__pyx_slice__33;
static PyObject *__pyx_slice__37;
static PyObject *__pyx_slice__39;
static PyObject *__pyx_slice__41;
static PyObject *__pyx_slice__43;
static PyObject *__pyx_slice__45;
static PyObject *__pyx_slice__47;
static PyObject *__pyx_slice__48;
static PyObject *__pyx_slice__50;
static PyObject *__pyx_slice__51;
static PyObject *__pyx_slice__53;
static PyObject *__pyx_slice__54;
static PyObject *__pyx_slice__56;
static PyObject *__pyx_slice__58;
static PyObject *__pyx_slice__60;
static PyObject *__pyx_slice__62;
static PyObject *__pyx_slice__64;
static PyObject *__pyx_slice__65;
static PyObject *__pyx_slice__67;
static PyObject *__pyx_slice__69;
static PyObject *__pyx_slice__71;
static PyObject *__pyx_slice__72;
static PyObject *__pyx_slice__74;
static PyObject *__pyx_slice__76;
static PyObject *__pyx_slice__77;
static PyObject *__pyx_slice__79;
static PyObject *__pyx_slice__81;
static PyObject *__pyx_slice__83;
static PyObject *__pyx_slice__85;
static PyObject *__pyx_slice__86;
static PyObject *__pyx_slice__88;
static PyObject *__pyx_slice__90;
static PyObject *__pyx_slice__92;
static PyObject *__pyx_slice__93;
static PyObject *__pyx_slice__95;
static PyObject *__pyx_slice__97;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__82;
static PyObject *__pyx_tuple__84;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__94;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__99;
static PyObject *__pyx_slice__100;
static PyObject *__pyx_slice__101;
static PyObject *__pyx_slice__103;
static PyObject *__pyx_slice__105;
static PyObject *__pyx_slice__106;
static PyObject *__pyx_slice__108;
static PyObject *__pyx_slice__110;
static PyObject *__pyx_slice__111;
static PyObject *__pyx_slice__112;
static PyObject *__pyx_slice__113;
static PyObject *__pyx_slice__115;
static PyObject *__pyx_slice__117;
static PyObject *__pyx_slice__119;
static PyObject *__pyx_slice__120;
static PyObject *__pyx_slice__121;
static PyObject *__pyx_slice__123;
static PyObject *__pyx_slice__124;
static PyObject *__pyx_slice__126;
static PyObject *__pyx_slice__127;
static PyObject *__pyx_slice__129;
static PyObject *__pyx_slice__130;
static PyObject *__pyx_slice__132;
static PyObject *__pyx_slice__134;
static PyObject *__pyx_slice__135;
static PyObject *__pyx_slice__136;
static PyObject *__pyx_slice__137;
static PyObject *__pyx_slice__140;
static PyObject *__pyx_slice__151;
static PyObject *__pyx_slice__152;
static PyObject *__pyx_slice__155;
static PyObject *__pyx_slice__157;
static PyObject *__pyx_slice__159;
static PyObject *__pyx_slice__161;
static PyObject *__pyx_slice__163;
static PyObject *__pyx_slice__167;
static PyObject *__pyx_slice__169;
static PyObject *__pyx_slice__171;
static PyObject *__pyx_slice__173;
static PyObject *__pyx_slice__175;
static PyObject *__pyx_slice__191;
static PyObject *__pyx_slice__192;
static PyObject *__pyx_slice__195;
static PyObject *__pyx_slice__198;
static PyObject *__pyx_slice__200;
static PyObject *__pyx_slice__202;
static PyObject *__pyx_slice__204;
static PyObject *__pyx_slice__206;
static PyObject *__pyx_slice__207;
static PyObject *__pyx_slice__209;
static PyObject *__pyx_slice__211;
static PyObject *__pyx_slice__212;
static PyObject *__pyx_slice__214;
static PyObject *__pyx_slice__217;
static PyObject *__pyx_slice__218;
static PyObject *__pyx_slice__219;
static PyObject *__pyx_slice__221;
static PyObject *__pyx_slice__224;
static PyObject *__pyx_slice__243;
static PyObject *__pyx_slice__245;
static PyObject *__pyx_slice__247;
static PyObject *__pyx_slice__249;
static PyObject *__pyx_slice__251;
static PyObject *__pyx_slice__252;
static PyObject *__pyx_slice__253;
static PyObject *__pyx_slice__254;
static PyObject *__pyx_slice__255;
static PyObject *__pyx_slice__257;
static PyObject *__pyx_slice__258;
static PyObject *__pyx_slice__259;
static PyObject *__pyx_slice__260;
static PyObject *__pyx_slice__261;
static PyObject *__pyx_slice__263;
static PyObject *__pyx_slice__264;
static PyObject *__pyx_slice__265;
static PyObject *__pyx_slice__266;
static PyObject *__pyx_slice__267;
static PyObject *__pyx_slice__268;
static PyObject *__pyx_slice__269;
static PyObject *__pyx_slice__270;
static PyObject *__pyx_slice__271;
static PyObject *__pyx_slice__272;
static PyObject *__pyx_slice__273;
static PyObject *__pyx_slice__274;
static PyObject *__pyx_slice__299;
static PyObject *__pyx_slice__300;
static PyObject *__pyx_slice__301;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__104;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__114;
static PyObject *__pyx_tuple__116;
static PyObject *__pyx_tuple__118;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__125;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__138;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__141;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__143;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__145;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_tuple__147;
static PyObject *__pyx_tuple__148;
static PyObject *__pyx_tuple__149;
static PyObject *__pyx_tuple__150;
static PyObject *__pyx_tuple__153;
static PyObject *__pyx_tuple__154;
static PyObject *__pyx_tuple__156;
static PyObject *__pyx_tuple__158;
static PyObject *__pyx_tuple__160;
static PyObject *__pyx_tuple__162;
static PyObject *__pyx_tuple__164;
static PyObject *__pyx_tuple__165;
static PyObject *__pyx_tuple__166;
static PyObject *__pyx_tuple__168;
static PyObject *__pyx_tuple__170;
static PyObject *__pyx_tuple__172;
static PyObject *__pyx_tuple__174;
static PyObject *__pyx_tuple__176;
static PyObject *__pyx_tuple__177;
static PyObject *__pyx_tuple__178;
static PyObject *__pyx_tuple__179;
static PyObject *__pyx_tuple__180;
static PyObject *__pyx_tuple__181;
static PyObject *__pyx_tuple__182;
static PyObject *__pyx_tuple__183;
static PyObject *__pyx_tuple__184;
static PyObject *__pyx_tuple__185;
static PyObject *__pyx_tuple__186;
static PyObject *__pyx_tuple__187;
static PyObject *__pyx_tuple__188;
static PyObject *__pyx_tuple__189;
static PyObject *__pyx_tuple__190;
static PyObject *__pyx_tuple__193;
static PyObject *__pyx_tuple__194;
static PyObject *__pyx_tuple__196;
static PyObject *__pyx_tuple__197;
static PyObject *__pyx_tuple__199;
static PyObject *__pyx_tuple__201;
static PyObject *__pyx_tuple__203;
static PyObject *__pyx_tuple__205;
static PyObject *__pyx_tuple__208;
static PyObject *__pyx_tuple__210;
static PyObject *__pyx_tuple__213;
static PyObject *__pyx_tuple__215;
static PyObject *__pyx_tuple__216;
static PyObject *__pyx_tuple__220;
static PyObject *__pyx_tuple__222;
static PyObject *__pyx_tuple__223;
static PyObject *__pyx_tuple__225;
static PyObject *__pyx_tuple__226;
static PyObject *__pyx_tuple__227;
static PyObject *__pyx_tuple__228;
static PyObject *__pyx_tuple__229;
static PyObject *__pyx_tuple__230;
static PyObject *__pyx_tuple__231;
static PyObject *__pyx_tuple__232;
static PyObject *__pyx_tuple__233;
static PyObject *__pyx_tuple__234;
static PyObject *__pyx_tuple__235;
static PyObject *__pyx_tuple__236;
static PyObject *__pyx_tuple__237;
static PyObject *__pyx_tuple__238;
static PyObject *__pyx_tuple__239;
static PyObject *__pyx_tuple__240;
static PyObject *__pyx_tuple__241;
static PyObject *__pyx_tuple__242;
static PyObject *__pyx_tuple__244;
static PyObject *__pyx_tuple__246;
static PyObject *__pyx_tuple__248;
static PyObject *__pyx_tuple__250;
static PyObject *__pyx_tuple__256;
static PyObject *__pyx_tuple__277;
static PyObject *__pyx_tuple__278;
static PyObject *__pyx_tuple__279;
static PyObject *__pyx_tuple__280;
static PyObject *__pyx_tuple__281;
static PyObject *__pyx_tuple__282;
static PyObject *__pyx_tuple__283;
static PyObject *__pyx_tuple__284;
static PyObject *__pyx_tuple__285;
static PyObject *__pyx_tuple__286;
static PyObject *__pyx_tuple__287;
static PyObject *__pyx_tuple__288;
static PyObject *__pyx_tuple__289;
static PyObject *__pyx_tuple__290;
static PyObject *__pyx_tuple__291;
static PyObject *__pyx_tuple__292;
static PyObject *__pyx_tuple__293;
static PyObject *__pyx_tuple__294;
static PyObject *__pyx_tuple__295;
static PyObject *__pyx_tuple__296;
static PyObject *__pyx_tuple__297;
static PyObject *__pyx_tuple__298;
static PyObject *__pyx_tuple__302;
static PyObject *__pyx_tuple__303;
static PyObject *__pyx_tuple__304;
static PyObject *__pyx_tuple__306;
static PyObject *__pyx_tuple__308;
static PyObject *__pyx_tuple__310;
static PyObject *__pyx_tuple__312;
static PyObject *__pyx_tuple__314;
static PyObject *__pyx_tuple__316;
static PyObject *__pyx_tuple__318;
static PyObject *__pyx_tuple__320;
static PyObject *__pyx_tuple__322;
static PyObject *__pyx_tuple__324;
static PyObject *__pyx_tuple__326;
static PyObject *__pyx_tuple__328;
static PyObject *__pyx_tuple__330;
static PyObject *__pyx_tuple__332;
static PyObject *__pyx_tuple__334;
static PyObject *__pyx_tuple__336;
static PyObject *__pyx_tuple__338;
static PyObject *__pyx_tuple__340;
static PyObject *__pyx_tuple__342;
static PyObject *__pyx_tuple__344;
static PyObject *__pyx_tuple__346;
static PyObject *__pyx_tuple__348;
static PyObject *__pyx_tuple__350;
static PyObject *__pyx_tuple__352;
static PyObject *__pyx_tuple__354;
static PyObject *__pyx_tuple__356;
static PyObject *__pyx_tuple__358;
static PyObject *__pyx_tuple__360;
static PyObject *__pyx_tuple__361;
static PyObject *__pyx_tuple__362;
static PyObject *__pyx_tuple__363;
static PyObject *__pyx_tuple__364;
static PyObject *__pyx_tuple__365;
static PyObject *__pyx_codeobj__307;
static PyObject *__pyx_codeobj__309;
static PyObject *__pyx_codeobj__311;
static PyObject *__pyx_codeobj__313;
static PyObject *__pyx_codeobj__315;
static PyObject *__pyx_codeobj__317;
static PyObject *__pyx_codeobj__319;
static PyObject *__pyx_codeobj__321;
static PyObject *__pyx_codeobj__323;
static PyObject *__pyx_codeobj__325;
static PyObject *__pyx_codeobj__327;
static PyObject *__pyx_codeobj__329;
static PyObject *__pyx_codeobj__331;
static PyObject *__pyx_codeobj__333;
static PyObject *__pyx_codeobj__335;
static PyObject *__pyx_codeobj__337;
static PyObject *__pyx_codeobj__339;
static PyObject *__pyx_codeobj__341;
static PyObject *__pyx_codeobj__343;
static PyObject *__pyx_codeobj__345;
static PyObject *__pyx_codeobj__347;
static PyObject *__pyx_codeobj__349;
static PyObject *__pyx_codeobj__351;
static PyObject *__pyx_codeobj__353;
static PyObject *__pyx_codeobj__355;
static PyObject *__pyx_codeobj__357;
static PyObject *__pyx_codeobj__359;
static PyObject *__pyx_codeobj__366;

/* "tofu/geom/_GG03.pyx":49
 * ########################################################
 * 
 * def CoordShift(Pts, In='(X,Y,Z)', Out='(R,Z)', CrossRef=None):             # <<<<<<<<<<<<<<
 *     """ Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))"""
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_1CoordShift(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_CoordShift[] = " Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_1CoordShift = {"CoordShift", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_1CoordShift, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_CoordShift};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_1CoordShift(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Pts = 0;
  PyObject *__pyx_v_In = 0;
  PyObject *__pyx_v_Out = 0;
  PyObject *__pyx_v_CrossRef = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("CoordShift (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Pts,&__pyx_n_s_In,&__pyx_n_s_Out,&__pyx_n_s_CrossRef,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)__pyx_kp_s_X_Y_Z);
    values[2] = ((PyObject *)__pyx_kp_s_R_Z);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Pts)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_In);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_CrossRef);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "CoordShift") < 0)) __PYX_ERR(0, 49, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Pts = values[0];
    __pyx_v_In = values[1];
    __pyx_v_Out = values[2];
    __pyx_v_CrossRef = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("CoordShift", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 49, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.CoordShift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_CoordShift(__pyx_self, __pyx_v_Pts, __pyx_v_In, __pyx_v_Out, __pyx_v_CrossRef);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_CoordShift(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Pts, PyObject *__pyx_v_In, PyObject *__pyx_v_Out, PyObject *__pyx_v_CrossRef) {
  PyObject *__pyx_v_Ins = NULL;
  PyObject *__pyx_v_Outs = NULL;
  PyObject *__pyx_v_InT = NULL;
  PyObject *__pyx_v_OutT = NULL;
  PyObject *__pyx_v_ndim = NULL;
  PyObject *__pyx_v_pts = NULL;
  PyObject *__pyx_v_ii = NULL;
  PyObject *__pyx_v_ff = NULL;
  PyObject *__pyx_v_ss = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  __Pyx_RefNannySetupContext("CoordShift", 0);
  __Pyx_INCREF(__pyx_v_Pts);
  __Pyx_INCREF(__pyx_v_In);
  __Pyx_INCREF(__pyx_v_Out);

  /* "tofu/geom/_GG03.pyx":51
 * def CoordShift(Pts, In='(X,Y,Z)', Out='(R,Z)', CrossRef=None):
 *     """ Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))"""
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"             # <<<<<<<<<<<<<<
 *     assert type(Pts) is np.ndarray and Pts.ndim in [1,2] and Pts.shape[0] in (2,3), "Points must be a 1D or 2D np.ndarray of 2 or 3 coordinates !"
 *     assert CrossRef is None or type(CrossRef) in [int,float,np.int64,np.float64], "Arg CrossRef must be a float !"
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_In);
    __Pyx_GIVEREF(__pyx_v_In);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_In);
    __Pyx_INCREF(__pyx_v_Out);
    __Pyx_GIVEREF(__pyx_v_Out);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_Out);
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_4 >= 2) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 51, __pyx_L1_error)
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_ff, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_ff)) == ((PyObject *)(&PyString_Type)));
      if (__pyx_t_5) {
      } else {
        __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __pyx_t_6;
        __pyx_t_6 = 0;
        goto __pyx_L5_bool_binop_done;
      }
      __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s_, __pyx_v_ff, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 51, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_L5_bool_binop_done:;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 51, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 51, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (unlikely(!__pyx_t_5)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_In_and_Out_coordinate_format);
      __PYX_ERR(0, 51, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":52
 *     """ Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))"""
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"
 *     assert type(Pts) is np.ndarray and Pts.ndim in [1,2] and Pts.shape[0] in (2,3), "Points must be a 1D or 2D np.ndarray of 2 or 3 coordinates !"             # <<<<<<<<<<<<<<
 *     assert CrossRef is None or type(CrossRef) in [int,float,np.int64,np.float64], "Arg CrossRef must be a float !"
 * 
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = (((PyObject *)Py_TYPE(__pyx_v_Pts)) == __pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = (__pyx_t_7 != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_5 = __pyx_t_8;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_7) {
    } else {
      __pyx_t_8 = __pyx_t_7;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __pyx_t_7;
    __pyx_L10_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L12_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 52, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_t_8;
    __pyx_L12_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = (__pyx_t_7 != 0);
    __pyx_t_5 = __pyx_t_8;
    __pyx_L7_bool_binop_done:;
    if (unlikely(!__pyx_t_5)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Points_must_be_a_1D_or_2D_np_nda);
      __PYX_ERR(0, 52, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":53
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"
 *     assert type(Pts) is np.ndarray and Pts.ndim in [1,2] and Pts.shape[0] in (2,3), "Points must be a 1D or 2D np.ndarray of 2 or 3 coordinates !"
 *     assert CrossRef is None or type(CrossRef) in [int,float,np.int64,np.float64], "Arg CrossRef must be a float !"             # <<<<<<<<<<<<<<
 * 
 *     # Pre-format inputs
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_8 = (__pyx_v_CrossRef == Py_None);
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_5 = __pyx_t_7;
      goto __pyx_L14_bool_binop_done;
    }
    __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_CrossRef)));
    __pyx_t_1 = ((PyObject *)Py_TYPE(__pyx_v_CrossRef));
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_1), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 53, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __pyx_t_8;
    __pyx_L16_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = (__pyx_t_7 != 0);
    __pyx_t_5 = __pyx_t_8;
    __pyx_L14_bool_binop_done:;
    if (unlikely(!__pyx_t_5)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_CrossRef_must_be_a_float);
      __PYX_ERR(0, 53, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":56
 * 
 *     # Pre-format inputs
 *     In, Out = In.lower(), Out.lower()             # <<<<<<<<<<<<<<
 * 
 *     # Get order
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_In, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_In, __pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_Out, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":59
 * 
 *     # Get order
 *     Ins = In.replace('(','').replace(')','').split(',')             # <<<<<<<<<<<<<<
 *     Outs = Out.replace('(','').replace(')','').split(',')
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_In, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Ins = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":60
 *     # Get order
 *     Ins = In.replace('(','').replace(')','').split(',')
 *     Outs = Out.replace('(','').replace(')','').split(',')             # <<<<<<<<<<<<<<
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_replace); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Outs = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":61
 *     Ins = In.replace('(','').replace(')','').split(',')
 *     Outs = Out.replace('(','').replace(')','').split(',')
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"             # <<<<<<<<<<<<<<
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 *     InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart'
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_Ins)) || PyTuple_CheckExact(__pyx_v_Ins)) {
      __pyx_t_1 = __pyx_v_Ins; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_Ins); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 61, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 61, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_v_ss);
      __pyx_t_2 = __pyx_v_ss;
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_r, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_phi, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_8;
      __pyx_L22_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 61, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 61, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Non_valid_In);
      __PYX_ERR(0, 61, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":62
 *     Outs = Out.replace('(','').replace(')','').split(',')
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"             # <<<<<<<<<<<<<<
 *     InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart'
 *     OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart'
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_Outs)) || PyTuple_CheckExact(__pyx_v_Outs)) {
      __pyx_t_1 = __pyx_v_Outs; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_Outs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 62, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_1);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 62, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_v_ss);
      __pyx_t_2 = __pyx_v_ss;
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_r, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
      if (!__pyx_t_8) {
      } else {
        __pyx_t_5 = __pyx_t_8;
        goto __pyx_L29_bool_binop_done;
      }
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_phi, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_8;
      __pyx_L29_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 62, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_5)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Non_valid_Out);
      __PYX_ERR(0, 62, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":63
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 *     InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart'             # <<<<<<<<<<<<<<
 *     OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart'
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_tuple__11; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= 2) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
    #else
    __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_any, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {
    __Pyx_INCREF(__pyx_n_s_cyl);
    __pyx_t_3 = __pyx_n_s_cyl;
  } else {
    __Pyx_INCREF(__pyx_n_s_cart);
    __pyx_t_3 = __pyx_n_s_cart;
  }
  __pyx_v_InT = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":64
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 *     InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart'
 *     OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart'             # <<<<<<<<<<<<<<
 * 
 *     ndim = Pts.ndim
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_tuple__12; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= 2) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 64, __pyx_L1_error)
    #else
    __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Outs, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 64, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_any, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {
    __Pyx_INCREF(__pyx_n_s_cyl);
    __pyx_t_3 = __pyx_n_s_cyl;
  } else {
    __Pyx_INCREF(__pyx_n_s_cart);
    __pyx_t_3 = __pyx_n_s_cart;
  }
  __pyx_v_OutT = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":66
 *     OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart'
 * 
 *     ndim = Pts.ndim             # <<<<<<<<<<<<<<
 *     if ndim==1:
 *         Pts = np.copy(Pts.reshape((Pts.shape[0],1)))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_ndim = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":67
 * 
 *     ndim = Pts.ndim
 *     if ndim==1:             # <<<<<<<<<<<<<<
 *         Pts = np.copy(Pts.reshape((Pts.shape[0],1)))
 * 
 */
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_ndim, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 67, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "tofu/geom/_GG03.pyx":68
 *     ndim = Pts.ndim
 *     if ndim==1:
 *         Pts = np.copy(Pts.reshape((Pts.shape[0],1)))             # <<<<<<<<<<<<<<
 * 
 *     # Compute
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_reshape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_10, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 68, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_1);
    __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_11) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_1};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_1};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_Pts, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":67
 * 
 *     ndim = Pts.ndim
 *     if ndim==1:             # <<<<<<<<<<<<<<
 *         Pts = np.copy(Pts.reshape((Pts.shape[0],1)))
 * 
 */
  }

  /* "tofu/geom/_GG03.pyx":71
 * 
 *     # Compute
 *     if InT==OutT:             # <<<<<<<<<<<<<<
 *         assert all([ss in Ins for ss in Outs])
 *         pts = []
 */
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_InT, __pyx_v_OutT, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 71, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "tofu/geom/_GG03.pyx":72
 *     # Compute
 *     if InT==OutT:
 *         assert all([ss in Ins for ss in Outs])             # <<<<<<<<<<<<<<
 *         pts = []
 *         for ii in Outs:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_v_Outs)) || PyTuple_CheckExact(__pyx_v_Outs)) {
        __pyx_t_2 = __pyx_v_Outs; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
        __pyx_t_9 = NULL;
      } else {
        __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_Outs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 72, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_9)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_12 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
            #else
            __pyx_t_12 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 72, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            #endif
          } else {
            if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_12); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
            #else
            __pyx_t_12 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 72, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            #endif
          }
        } else {
          __pyx_t_12 = __pyx_t_9(__pyx_t_2);
          if (unlikely(!__pyx_t_12)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 72, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_12);
        }
        __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
        __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 72, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 72, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_5)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 72, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":73
 *     if InT==OutT:
 *         assert all([ss in Ins for ss in Outs])
 *         pts = []             # <<<<<<<<<<<<<<
 *         for ii in Outs:
 *             if ii=='phi':
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_pts = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":74
 *         assert all([ss in Ins for ss in Outs])
 *         pts = []
 *         for ii in Outs:             # <<<<<<<<<<<<<<
 *             if ii=='phi':
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))
 */
    if (likely(PyList_CheckExact(__pyx_v_Outs)) || PyTuple_CheckExact(__pyx_v_Outs)) {
      __pyx_t_3 = __pyx_v_Outs; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_Outs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 74, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 74, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 74, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 74, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_ii, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":75
 *         pts = []
 *         for ii in Outs:
 *             if ii=='phi':             # <<<<<<<<<<<<<<
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))
 *             else:
 */
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_phi, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 75, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "tofu/geom/_GG03.pyx":76
 *         for ii in Outs:
 *             if ii=='phi':
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))             # <<<<<<<<<<<<<<
 *             else:
 *                 pts.append(Pts[Ins.index(ii),:])
 */
        __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_arctan2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sin); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        if (!__pyx_t_13) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_ii); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_ii};
            __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_ii};
            __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else
          #endif
          {
            __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
            __Pyx_INCREF(__pyx_v_ii);
            __Pyx_GIVEREF(__pyx_v_ii);
            PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_ii);
            __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6);
        __Pyx_INCREF(__pyx_slice__13);
        __Pyx_GIVEREF(__pyx_slice__13);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_slice__13);
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        if (!__pyx_t_11) {
          __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_12);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_6};
            __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_6};
            __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          {
            __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_cos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_11);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_11, function);
          }
        }
        if (!__pyx_t_13) {
          __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_ii); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_ii};
            __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_14);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
            PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_v_ii};
            __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_14);
          } else
          #endif
          {
            __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
            __Pyx_INCREF(__pyx_v_ii);
            __Pyx_GIVEREF(__pyx_v_ii);
            PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_ii);
            __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_14);
        __Pyx_INCREF(__pyx_slice__14);
        __Pyx_GIVEREF(__pyx_slice__14);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_slice__14);
        __pyx_t_14 = 0;
        __pyx_t_14 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        if (!__pyx_t_11) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_14); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_10);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_14};
            __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_14};
            __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          } else
          #endif
          {
            __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_11); __pyx_t_11 = NULL;
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 76, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        __pyx_t_16 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_16 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_12, __pyx_t_10};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_12, __pyx_t_10};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_15 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (__pyx_t_6) {
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6); __pyx_t_6 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_16, __pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_16, __pyx_t_10);
          __pyx_t_12 = 0;
          __pyx_t_10 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_2); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 76, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":75
 *         pts = []
 *         for ii in Outs:
 *             if ii=='phi':             # <<<<<<<<<<<<<<
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))
 *             else:
 */
        goto __pyx_L44;
      }

      /* "tofu/geom/_GG03.pyx":78
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))
 *             else:
 *                 pts.append(Pts[Ins.index(ii),:])             # <<<<<<<<<<<<<<
 *     elif InT=='cart':
 *         pts = []
 */
      /*else*/ {
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (!__pyx_t_15) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_ii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_ii};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_2);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_ii};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_2);
          } else
          #endif
          {
            __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_15); __pyx_t_15 = NULL;
            __Pyx_INCREF(__pyx_v_ii);
            __Pyx_GIVEREF(__pyx_v_ii);
            PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_ii);
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
        __Pyx_INCREF(__pyx_slice__15);
        __Pyx_GIVEREF(__pyx_slice__15);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice__15);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_2); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __pyx_L44:;

      /* "tofu/geom/_GG03.pyx":74
 *         assert all([ss in Ins for ss in Outs])
 *         pts = []
 *         for ii in Outs:             # <<<<<<<<<<<<<<
 *             if ii=='phi':
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":71
 * 
 *     # Compute
 *     if InT==OutT:             # <<<<<<<<<<<<<<
 *         assert all([ss in Ins for ss in Outs])
 *         pts = []
 */
    goto __pyx_L39;
  }

  /* "tofu/geom/_GG03.pyx":79
 *             else:
 *                 pts.append(Pts[Ins.index(ii),:])
 *     elif InT=='cart':             # <<<<<<<<<<<<<<
 *         pts = []
 *         for ii in Outs:
 */
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_InT, __pyx_n_s_cart, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 79, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "tofu/geom/_GG03.pyx":80
 *                 pts.append(Pts[Ins.index(ii),:])
 *     elif InT=='cart':
 *         pts = []             # <<<<<<<<<<<<<<
 *         for ii in Outs:
 *             if ii=='r':
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_pts = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":81
 *     elif InT=='cart':
 *         pts = []
 *         for ii in Outs:             # <<<<<<<<<<<<<<
 *             if ii=='r':
 *                 assert all([ss in Ins for ss in ['x','y']])
 */
    if (likely(PyList_CheckExact(__pyx_v_Outs)) || PyTuple_CheckExact(__pyx_v_Outs)) {
      __pyx_t_3 = __pyx_v_Outs; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_Outs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 81, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
          #else
          __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          #endif
        }
      } else {
        __pyx_t_2 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 81, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_XDECREF_SET(__pyx_v_ii, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":82
 *         pts = []
 *         for ii in Outs:
 *             if ii=='r':             # <<<<<<<<<<<<<<
 *                 assert all([ss in Ins for ss in ['x','y']])
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 */
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_r, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 82, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "tofu/geom/_GG03.pyx":83
 *         for ii in Outs:
 *             if ii=='r':
 *                 assert all([ss in Ins for ss in ['x','y']])             # <<<<<<<<<<<<<<
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 *             elif ii=='z':
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_1 = __pyx_tuple__16; __Pyx_INCREF(__pyx_t_1); __pyx_t_18 = 0;
          for (;;) {
            if (__pyx_t_18 >= 2) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_18); __Pyx_INCREF(__pyx_t_10); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
            #else
            __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 83, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_10);
            __pyx_t_10 = 0;
            __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
            __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 83, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 83, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(!__pyx_t_5)) {
            PyErr_SetNone(PyExc_AssertionError);
            __PYX_ERR(0, 83, __pyx_L1_error)
          }
        }
        #endif

        /* "tofu/geom/_GG03.pyx":84
 *             if ii=='r':
 *                 assert all([ss in Ins for ss in ['x','y']])
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))             # <<<<<<<<<<<<<<
 *             elif ii=='z':
 *                 assert 'z' in Ins
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_hypot); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15);
        __Pyx_INCREF(__pyx_slice__18);
        __Pyx_GIVEREF(__pyx_slice__18);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice__18);
        __pyx_t_15 = 0;
        __pyx_t_15 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
        __Pyx_INCREF(__pyx_slice__20);
        __Pyx_GIVEREF(__pyx_slice__20);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice__20);
        __pyx_t_12 = 0;
        __pyx_t_12 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        __pyx_t_16 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
            __pyx_t_16 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_15, __pyx_t_12};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[3] = {__pyx_t_1, __pyx_t_15, __pyx_t_12};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (__pyx_t_1) {
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
          }
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_16, __pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_16, __pyx_t_12);
          __pyx_t_15 = 0;
          __pyx_t_12 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_2); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 84, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":82
 *         pts = []
 *         for ii in Outs:
 *             if ii=='r':             # <<<<<<<<<<<<<<
 *                 assert all([ss in Ins for ss in ['x','y']])
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 */
        goto __pyx_L47;
      }

      /* "tofu/geom/_GG03.pyx":85
 *                 assert all([ss in Ins for ss in ['x','y']])
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 *             elif ii=='z':             # <<<<<<<<<<<<<<
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])
 */
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 85, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "tofu/geom/_GG03.pyx":86
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 *             elif ii=='z':
 *                 assert 'z' in Ins             # <<<<<<<<<<<<<<
 *                 pts.append(Pts[Ins.index('z'),:])
 *             elif ii=='phi':
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_z, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 86, __pyx_L1_error)
          if (unlikely(!(__pyx_t_5 != 0))) {
            PyErr_SetNone(PyExc_AssertionError);
            __PYX_ERR(0, 86, __pyx_L1_error)
          }
        }
        #endif

        /* "tofu/geom/_GG03.pyx":87
 *             elif ii=='z':
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])             # <<<<<<<<<<<<<<
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
        __Pyx_INCREF(__pyx_slice__22);
        __Pyx_GIVEREF(__pyx_slice__22);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__22);
        __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_10); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 87, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "tofu/geom/_GG03.pyx":85
 *                 assert all([ss in Ins for ss in ['x','y']])
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 *             elif ii=='z':             # <<<<<<<<<<<<<<
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])
 */
        goto __pyx_L47;
      }

      /* "tofu/geom/_GG03.pyx":88
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])
 *             elif ii=='phi':             # <<<<<<<<<<<<<<
 *                 if all([ss in Ins for ss in ['x','y']]):
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 */
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_phi, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 88, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "tofu/geom/_GG03.pyx":89
 *                 pts.append(Pts[Ins.index('z'),:])
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):             # <<<<<<<<<<<<<<
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 *                 elif CrossRef is not None:
 */
        __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 89, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_2 = __pyx_tuple__23; __Pyx_INCREF(__pyx_t_2); __pyx_t_18 = 0;
        for (;;) {
          if (__pyx_t_18 >= 2) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_18); __Pyx_INCREF(__pyx_t_6); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
          __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 89, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_10, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 89, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_2, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 89, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 89, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (__pyx_t_5) {

          /* "tofu/geom/_GG03.pyx":90
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))             # <<<<<<<<<<<<<<
 *                 elif CrossRef is not None:
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_arctan2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12);
          __Pyx_INCREF(__pyx_slice__25);
          __Pyx_GIVEREF(__pyx_slice__25);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__25);
          __pyx_t_12 = 0;
          __pyx_t_12 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
          __Pyx_INCREF(__pyx_slice__27);
          __Pyx_GIVEREF(__pyx_slice__27);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_slice__27);
          __pyx_t_15 = 0;
          __pyx_t_15 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = NULL;
          __pyx_t_16 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
              __pyx_t_16 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_12, __pyx_t_15};
            __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 90, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
            PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_12, __pyx_t_15};
            __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 90, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          } else
          #endif
          {
            __pyx_t_1 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            if (__pyx_t_2) {
              __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
            }
            __Pyx_GIVEREF(__pyx_t_12);
            PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_16, __pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_15);
            PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_16, __pyx_t_15);
            __pyx_t_12 = 0;
            __pyx_t_15 = 0;
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 90, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_10); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 90, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "tofu/geom/_GG03.pyx":89
 *                 pts.append(Pts[Ins.index('z'),:])
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):             # <<<<<<<<<<<<<<
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 *                 elif CrossRef is not None:
 */
          goto __pyx_L50;
        }

        /* "tofu/geom/_GG03.pyx":91
 *                 if all([ss in Ins for ss in ['x','y']]):
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 *                 elif CrossRef is not None:             # <<<<<<<<<<<<<<
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 */
        __pyx_t_5 = (__pyx_v_CrossRef != Py_None);
        __pyx_t_8 = (__pyx_t_5 != 0);
        if (__pyx_t_8) {

          /* "tofu/geom/_GG03.pyx":92
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 *                 elif CrossRef is not None:
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise Exception("There is no phi value available !")
 */
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_15);
          __pyx_t_15 = 0;
          __pyx_t_15 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          if (!__pyx_t_15) {
            __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 92, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_10);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_1)) {
              PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_6};
              __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 92, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
              PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_6};
              __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 92, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            } else
            #endif
            {
              __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 92, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15); __pyx_t_15 = NULL;
              __Pyx_GIVEREF(__pyx_t_6);
              PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6);
              __pyx_t_6 = 0;
              __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 92, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_10);
              __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Multiply(__pyx_v_CrossRef, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 92, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

          /* "tofu/geom/_GG03.pyx":91
 *                 if all([ss in Ins for ss in ['x','y']]):
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 *                 elif CrossRef is not None:             # <<<<<<<<<<<<<<
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 */
          goto __pyx_L50;
        }

        /* "tofu/geom/_GG03.pyx":94
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 *                     raise Exception("There is no phi value available !")             # <<<<<<<<<<<<<<
 *     else:
 *         pts = []
 */
        /*else*/ {
          __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_Raise(__pyx_t_1, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __PYX_ERR(0, 94, __pyx_L1_error)
        }
        __pyx_L50:;

        /* "tofu/geom/_GG03.pyx":88
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])
 *             elif ii=='phi':             # <<<<<<<<<<<<<<
 *                 if all([ss in Ins for ss in ['x','y']]):
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 */
      }
      __pyx_L47:;

      /* "tofu/geom/_GG03.pyx":81
 *     elif InT=='cart':
 *         pts = []
 *         for ii in Outs:             # <<<<<<<<<<<<<<
 *             if ii=='r':
 *                 assert all([ss in Ins for ss in ['x','y']])
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":79
 *             else:
 *                 pts.append(Pts[Ins.index(ii),:])
 *     elif InT=='cart':             # <<<<<<<<<<<<<<
 *         pts = []
 *         for ii in Outs:
 */
    goto __pyx_L39;
  }

  /* "tofu/geom/_GG03.pyx":96
 *                     raise Exception("There is no phi value available !")
 *     else:
 *         pts = []             # <<<<<<<<<<<<<<
 *         for ii in Outs:
 *             if ii=='x':
 */
  /*else*/ {
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_pts = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":97
 *     else:
 *         pts = []
 *         for ii in Outs:             # <<<<<<<<<<<<<<
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):
 */
    if (likely(PyList_CheckExact(__pyx_v_Outs)) || PyTuple_CheckExact(__pyx_v_Outs)) {
      __pyx_t_3 = __pyx_v_Outs; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_Outs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        } else {
          if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
          #else
          __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          #endif
        }
      } else {
        __pyx_t_1 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_1)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 97, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_XDECREF_SET(__pyx_v_ii, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":98
 *         pts = []
 *         for ii in Outs:
 *             if ii=='x':             # <<<<<<<<<<<<<<
 *                 if all([ss in Ins for ss in ['r','phi']]):
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 */
      __pyx_t_8 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_x, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
      if (__pyx_t_8) {

        /* "tofu/geom/_GG03.pyx":99
 *         for ii in Outs:
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):             # <<<<<<<<<<<<<<
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 *                 elif CrossRef is not None:
 */
        __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __pyx_tuple__29; __Pyx_INCREF(__pyx_t_10); __pyx_t_18 = 0;
        for (;;) {
          if (__pyx_t_18 >= 2) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_18); __Pyx_INCREF(__pyx_t_12); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
          #else
          __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 99, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          #endif
          __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
          __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 99, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 99, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 99, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 99, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_8) {

          /* "tofu/geom/_GG03.pyx":100
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))             # <<<<<<<<<<<<<<
 *                 elif CrossRef is not None:
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 */
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
          __Pyx_INCREF(__pyx_slice__31);
          __Pyx_GIVEREF(__pyx_slice__31);
          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice__31);
          __pyx_t_10 = 0;
          __pyx_t_10 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_cos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15);
          __Pyx_INCREF(__pyx_slice__33);
          __Pyx_GIVEREF(__pyx_slice__33);
          PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_slice__33);
          __pyx_t_15 = 0;
          __pyx_t_15 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          if (!__pyx_t_12) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_1);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_15};
              __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_15};
              __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else
            #endif
            {
              __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12); __pyx_t_12 = NULL;
              __Pyx_GIVEREF(__pyx_t_15);
              PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_15);
              __pyx_t_15 = 0;
              __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyNumber_Multiply(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_6); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 100, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "tofu/geom/_GG03.pyx":99
 *         for ii in Outs:
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):             # <<<<<<<<<<<<<<
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 *                 elif CrossRef is not None:
 */
          goto __pyx_L56;
        }

        /* "tofu/geom/_GG03.pyx":101
 *                 if all([ss in Ins for ss in ['r','phi']]):
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 *                 elif CrossRef is not None:             # <<<<<<<<<<<<<<
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 */
        __pyx_t_8 = (__pyx_v_CrossRef != Py_None);
        __pyx_t_5 = (__pyx_t_8 != 0);
        if (__pyx_t_5) {

          /* "tofu/geom/_GG03.pyx":102
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 *                 elif CrossRef is not None:
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise Exception("There is no x value available !")
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_10, function);
            }
          }
          if (!__pyx_t_2) {
            __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_10)) {
              PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1};
              __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
              PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1};
              __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            } else
            #endif
            {
              __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 102, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); __pyx_t_2 = NULL;
              __Pyx_GIVEREF(__pyx_t_1);
              PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_1);
              __pyx_t_1 = 0;
              __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_15, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 102, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = PyNumber_Multiply(__pyx_v_CrossRef, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_10); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 102, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

          /* "tofu/geom/_GG03.pyx":101
 *                 if all([ss in Ins for ss in ['r','phi']]):
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 *                 elif CrossRef is not None:             # <<<<<<<<<<<<<<
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 */
          goto __pyx_L56;
        }

        /* "tofu/geom/_GG03.pyx":104
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 *                     raise Exception("There is no x value available !")             # <<<<<<<<<<<<<<
 *             elif ii=='y':
 *                 assert all([ss in Ins for ss in ['r','phi']])
 */
        /*else*/ {
          __pyx_t_10 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 104, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_Raise(__pyx_t_10, 0, 0, 0);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __PYX_ERR(0, 104, __pyx_L1_error)
        }
        __pyx_L56:;

        /* "tofu/geom/_GG03.pyx":98
 *         pts = []
 *         for ii in Outs:
 *             if ii=='x':             # <<<<<<<<<<<<<<
 *                 if all([ss in Ins for ss in ['r','phi']]):
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 */
        goto __pyx_L55;
      }

      /* "tofu/geom/_GG03.pyx":105
 *                 else:
 *                     raise Exception("There is no x value available !")
 *             elif ii=='y':             # <<<<<<<<<<<<<<
 *                 assert all([ss in Ins for ss in ['r','phi']])
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 */
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_y, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 105, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "tofu/geom/_GG03.pyx":106
 *                     raise Exception("There is no x value available !")
 *             elif ii=='y':
 *                 assert all([ss in Ins for ss in ['r','phi']])             # <<<<<<<<<<<<<<
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 *             elif ii=='z':
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_10 = PyList_New(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_6 = __pyx_tuple__35; __Pyx_INCREF(__pyx_t_6); __pyx_t_18 = 0;
          for (;;) {
            if (__pyx_t_18 >= 2) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_15 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_18); __Pyx_INCREF(__pyx_t_15); __pyx_t_18++; if (unlikely(0 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
            #else
            __pyx_t_15 = PySequence_ITEM(__pyx_t_6, __pyx_t_18); __pyx_t_18++; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 106, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            #endif
            __Pyx_XDECREF_SET(__pyx_v_ss, __pyx_t_15);
            __pyx_t_15 = 0;
            __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_v_ss, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
            __pyx_t_15 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 106, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            if (unlikely(__Pyx_ListComp_Append(__pyx_t_10, (PyObject*)__pyx_t_15))) __PYX_ERR(0, 106, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10);
          __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_6, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 106, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_5)) {
            PyErr_SetNone(PyExc_AssertionError);
            __PYX_ERR(0, 106, __pyx_L1_error)
          }
        }
        #endif

        /* "tofu/geom/_GG03.pyx":107
 *             elif ii=='y':
 *                 assert all([ss in Ins for ss in ['r','phi']])
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))             # <<<<<<<<<<<<<<
 *             elif ii=='z':
 *                 assert 'z' in Ins
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
        __Pyx_INCREF(__pyx_slice__37);
        __Pyx_GIVEREF(__pyx_slice__37);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_slice__37);
        __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_sin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2);
        __Pyx_INCREF(__pyx_slice__39);
        __Pyx_GIVEREF(__pyx_slice__39);
        PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_slice__39);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (!__pyx_t_15) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_10);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_2};
            __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_2};
            __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          {
            __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 107, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15); __pyx_t_15 = NULL;
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 107, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_1); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 107, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "tofu/geom/_GG03.pyx":105
 *                 else:
 *                     raise Exception("There is no x value available !")
 *             elif ii=='y':             # <<<<<<<<<<<<<<
 *                 assert all([ss in Ins for ss in ['r','phi']])
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 */
        goto __pyx_L55;
      }

      /* "tofu/geom/_GG03.pyx":108
 *                 assert all([ss in Ins for ss in ['r','phi']])
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 *             elif ii=='z':             # <<<<<<<<<<<<<<
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])
 */
      __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_ii, __pyx_n_s_z, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 108, __pyx_L1_error)
      if (__pyx_t_5) {

        /* "tofu/geom/_GG03.pyx":109
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 *             elif ii=='z':
 *                 assert 'z' in Ins             # <<<<<<<<<<<<<<
 *                 pts.append(Pts[Ins.index('z'),:])
 * 
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_z, __pyx_v_Ins, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
          if (unlikely(!(__pyx_t_5 != 0))) {
            PyErr_SetNone(PyExc_AssertionError);
            __PYX_ERR(0, 109, __pyx_L1_error)
          }
        }
        #endif

        /* "tofu/geom/_GG03.pyx":110
 *             elif ii=='z':
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])             # <<<<<<<<<<<<<<
 * 
 *     # Format output
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ins, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
        __Pyx_INCREF(__pyx_slice__41);
        __Pyx_GIVEREF(__pyx_slice__41);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice__41);
        __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_GetItem(__pyx_v_Pts, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_17 = __Pyx_PyObject_Append(__pyx_v_pts, __pyx_t_10); if (unlikely(__pyx_t_17 == ((int)-1))) __PYX_ERR(0, 110, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "tofu/geom/_GG03.pyx":108
 *                 assert all([ss in Ins for ss in ['r','phi']])
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 *             elif ii=='z':             # <<<<<<<<<<<<<<
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])
 */
      }
      __pyx_L55:;

      /* "tofu/geom/_GG03.pyx":97
 *     else:
 *         pts = []
 *         for ii in Outs:             # <<<<<<<<<<<<<<
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L39:;

  /* "tofu/geom/_GG03.pyx":113
 * 
 *     # Format output
 *     pts = np.vstack(pts)             # <<<<<<<<<<<<<<
 *     if ndim==1:
 *         pts = pts.flatten()
 */
  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_vstack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_10) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_pts); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_pts};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_pts};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_v_pts);
      __Pyx_GIVEREF(__pyx_v_pts);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_pts);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":114
 *     # Format output
 *     pts = np.vstack(pts)
 *     if ndim==1:             # <<<<<<<<<<<<<<
 *         pts = pts.flatten()
 *     return pts
 */
  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_ndim, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 114, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "tofu/geom/_GG03.pyx":115
 *     pts = np.vstack(pts)
 *     if ndim==1:
 *         pts = pts.flatten()             # <<<<<<<<<<<<<<
 *     return pts
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pts, __pyx_n_s_flatten); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 115, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":114
 *     # Format output
 *     pts = np.vstack(pts)
 *     if ndim==1:             # <<<<<<<<<<<<<<
 *         pts = pts.flatten()
 *     return pts
 */
  }

  /* "tofu/geom/_GG03.pyx":116
 *     if ndim==1:
 *         pts = pts.flatten()
 *     return pts             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pts);
  __pyx_r = __pyx_v_pts;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":49
 * ########################################################
 * 
 * def CoordShift(Pts, In='(X,Y,Z)', Out='(R,Z)', CrossRef=None):             # <<<<<<<<<<<<<<
 *     """ Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))"""
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("tofu.geom._GG03.CoordShift", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Ins);
  __Pyx_XDECREF(__pyx_v_Outs);
  __Pyx_XDECREF(__pyx_v_InT);
  __Pyx_XDECREF(__pyx_v_OutT);
  __Pyx_XDECREF(__pyx_v_ndim);
  __Pyx_XDECREF(__pyx_v_pts);
  __Pyx_XDECREF(__pyx_v_ii);
  __Pyx_XDECREF(__pyx_v_ff);
  __Pyx_XDECREF(__pyx_v_ss);
  __Pyx_XDECREF(__pyx_v_Pts);
  __Pyx_XDECREF(__pyx_v_In);
  __Pyx_XDECREF(__pyx_v_Out);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":143
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def Poly_isClockwise(cnp.ndarray[double,ndim=2] Poly):             # <<<<<<<<<<<<<<
 *     """ Assuming 2D closed Poly ! """
 *     cdef int ii, NP=Poly.shape[1]
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_3Poly_isClockwise(PyObject *__pyx_self, PyObject *__pyx_v_Poly); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_2Poly_isClockwise[] = " Assuming 2D closed Poly ! ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_3Poly_isClockwise = {"Poly_isClockwise", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_3Poly_isClockwise, METH_O, __pyx_doc_4tofu_4geom_5_GG03_2Poly_isClockwise};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_3Poly_isClockwise(PyObject *__pyx_self, PyObject *__pyx_v_Poly) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Poly_isClockwise (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Poly), __pyx_ptype_5numpy_ndarray, 1, "Poly", 0))) __PYX_ERR(0, 143, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_2Poly_isClockwise(__pyx_self, ((PyArrayObject *)__pyx_v_Poly));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_2Poly_isClockwise(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Poly) {
  int __pyx_v_ii;
  int __pyx_v_NP;
  double __pyx_v_Sum;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Poly;
  __Pyx_Buffer __pyx_pybuffer_Poly;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  long __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("Poly_isClockwise", 0);
  __pyx_pybuffer_Poly.pybuffer.buf = NULL;
  __pyx_pybuffer_Poly.refcount = 0;
  __pyx_pybuffernd_Poly.data = NULL;
  __pyx_pybuffernd_Poly.rcbuffer = &__pyx_pybuffer_Poly;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer, (PyObject*)__pyx_v_Poly, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 143, __pyx_L1_error)
  }
  __pyx_pybuffernd_Poly.diminfo[0].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Poly.diminfo[0].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Poly.diminfo[1].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Poly.diminfo[1].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[1];

  /* "tofu/geom/_GG03.pyx":145
 * def Poly_isClockwise(cnp.ndarray[double,ndim=2] Poly):
 *     """ Assuming 2D closed Poly ! """
 *     cdef int ii, NP=Poly.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double Sum=0.
 *     for ii in range(0,NP-1):
 */
  __pyx_v_NP = (__pyx_v_Poly->dimensions[1]);

  /* "tofu/geom/_GG03.pyx":146
 *     """ Assuming 2D closed Poly ! """
 *     cdef int ii, NP=Poly.shape[1]
 *     cdef double Sum=0.             # <<<<<<<<<<<<<<
 *     for ii in range(0,NP-1):
 *         Sum += Poly[0,ii]*Poly[1,ii+1]-Poly[0,ii+1]*Poly[1,ii]
 */
  __pyx_v_Sum = 0.;

  /* "tofu/geom/_GG03.pyx":147
 *     cdef int ii, NP=Poly.shape[1]
 *     cdef double Sum=0.
 *     for ii in range(0,NP-1):             # <<<<<<<<<<<<<<
 *         Sum += Poly[0,ii]*Poly[1,ii+1]-Poly[0,ii+1]*Poly[1,ii]
 *     return Sum < 0.
 */
  __pyx_t_1 = (__pyx_v_NP - 1);
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_ii = __pyx_t_2;

    /* "tofu/geom/_GG03.pyx":148
 *     cdef double Sum=0.
 *     for ii in range(0,NP-1):
 *         Sum += Poly[0,ii]*Poly[1,ii+1]-Poly[0,ii+1]*Poly[1,ii]             # <<<<<<<<<<<<<<
 *     return Sum < 0.
 * 
 */
    __pyx_t_3 = 0;
    __pyx_t_4 = __pyx_v_ii;
    __pyx_t_5 = 1;
    __pyx_t_6 = (__pyx_v_ii + 1);
    __pyx_t_7 = 0;
    __pyx_t_8 = (__pyx_v_ii + 1);
    __pyx_t_9 = 1;
    __pyx_t_10 = __pyx_v_ii;
    __pyx_v_Sum = (__pyx_v_Sum + (((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Poly.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_Poly.diminfo[0].strides, __pyx_t_4, __pyx_pybuffernd_Poly.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Poly.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_Poly.diminfo[0].strides, __pyx_t_6, __pyx_pybuffernd_Poly.diminfo[1].strides))) - ((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Poly.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_Poly.diminfo[0].strides, __pyx_t_8, __pyx_pybuffernd_Poly.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Poly.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_Poly.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_Poly.diminfo[1].strides)))));
  }

  /* "tofu/geom/_GG03.pyx":149
 *     for ii in range(0,NP-1):
 *         Sum += Poly[0,ii]*Poly[1,ii+1]-Poly[0,ii+1]*Poly[1,ii]
 *     return Sum < 0.             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = __Pyx_PyBool_FromLong((__pyx_v_Sum < 0.)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":143
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def Poly_isClockwise(cnp.ndarray[double,ndim=2] Poly):             # <<<<<<<<<<<<<<
 *     """ Assuming 2D closed Poly ! """
 *     cdef int ii, NP=Poly.shape[1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_11);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.Poly_isClockwise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":152
 * 
 * 
 * def Poly_Order(cnp.ndarray[double,ndim=2] Poly, str order='C', Clock=False, close=True, str layout='(cc,N)', str layout_in=None, Test=True):             # <<<<<<<<<<<<<<
 *     """
 *     Return a polygon Poly as a np.ndarray formatted according to parameters
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_5Poly_Order(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_4Poly_Order[] = "\n    Return a polygon Poly as a np.ndarray formatted according to parameters\n\n    Parameters \n    ----------\n        Poly    np.ndarray or list or tuple     Input polygon under from of (cc,N) or (N,cc) np.ndarray (where cc = 2 or 3, the number of coordinates and N points), or list or tuple of vertices\n        order   str                             Flag indicating whether the output np.ndarray shall be C-contiguous ('C') or Fortran-contiguous ('F')\n        Clock   bool                            For 2-dimensional arrays only, flag indicating whether the output array shall represent a clockwise polygon (True) or anti-clockwise (False), or should be left unchanged (None)\n        close   bool                            For 2-dimensional arrays only, flag indicating whether the output array shall be closed (True, i.e.: last point==first point), or not closed (False)\n        layout  str                             Flag indicating whether the output np.ndarray shall be of shape '(cc,N)' or '(N,cc)'\n        Test    bool                            Flag indicating whether the inputs should be tested for conformity, default: True\n\n    Returns\n    -------\n        poly    np.ndarray                      Output formatted polygon\n\n    ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_5Poly_Order = {"Poly_Order", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_5Poly_Order, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_4Poly_Order};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_5Poly_Order(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_Poly = 0;
  PyObject *__pyx_v_order = 0;
  PyObject *__pyx_v_Clock = 0;
  PyObject *__pyx_v_close = 0;
  PyObject *__pyx_v_layout = 0;
  PyObject *__pyx_v_layout_in = 0;
  PyObject *__pyx_v_Test = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Poly_Order (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Poly,&__pyx_n_s_order,&__pyx_n_s_Clock,&__pyx_n_s_close,&__pyx_n_s_layout,&__pyx_n_s_layout_in,&__pyx_n_s_Test,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[1] = ((PyObject*)__pyx_n_s_C);
    values[2] = ((PyObject *)Py_False);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject*)__pyx_kp_s_cc_N);
    values[5] = ((PyObject*)Py_None);
    values[6] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Poly)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_order);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Clock);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_close);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_layout);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_layout_in);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Test);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Poly_Order") < 0)) __PYX_ERR(0, 152, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Poly = ((PyArrayObject *)values[0]);
    __pyx_v_order = ((PyObject*)values[1]);
    __pyx_v_Clock = values[2];
    __pyx_v_close = values[3];
    __pyx_v_layout = ((PyObject*)values[4]);
    __pyx_v_layout_in = ((PyObject*)values[5]);
    __pyx_v_Test = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Poly_Order", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 152, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.Poly_Order", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Poly), __pyx_ptype_5numpy_ndarray, 1, "Poly", 0))) __PYX_ERR(0, 152, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_order), (&PyString_Type), 1, "order", 1))) __PYX_ERR(0, 152, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_layout), (&PyString_Type), 1, "layout", 1))) __PYX_ERR(0, 152, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_layout_in), (&PyString_Type), 1, "layout_in", 1))) __PYX_ERR(0, 152, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_4Poly_Order(__pyx_self, __pyx_v_Poly, __pyx_v_order, __pyx_v_Clock, __pyx_v_close, __pyx_v_layout, __pyx_v_layout_in, __pyx_v_Test);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_4Poly_Order(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Poly, PyObject *__pyx_v_order, PyObject *__pyx_v_Clock, PyObject *__pyx_v_close, PyObject *__pyx_v_layout, PyObject *__pyx_v_layout_in, PyObject *__pyx_v_Test) {
  PyObject *__pyx_v_poly = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Poly;
  __Pyx_Buffer __pyx_pybuffer_Poly;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("Poly_Order", 0);
  __pyx_pybuffer_Poly.pybuffer.buf = NULL;
  __pyx_pybuffer_Poly.refcount = 0;
  __pyx_pybuffernd_Poly.data = NULL;
  __pyx_pybuffernd_Poly.rcbuffer = &__pyx_pybuffer_Poly;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer, (PyObject*)__pyx_v_Poly, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 152, __pyx_L1_error)
  }
  __pyx_pybuffernd_Poly.diminfo[0].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Poly.diminfo[0].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Poly.diminfo[1].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Poly.diminfo[1].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[1];

  /* "tofu/geom/_GG03.pyx":170
 * 
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert (2 in np.shape(Poly) or 3 in np.shape(Poly)) and max(np.shape(Poly))>=3, "Arg Poly must contain the 2D or 3D coordinates of at least 3 points (polygon) !"
 *         assert order.lower() in ['c','f'], "Arg order must be in ['c','f'] !"
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Test); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 170, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":171
 *     """
 *     if Test:
 *         assert (2 in np.shape(Poly) or 3 in np.shape(Poly)) and max(np.shape(Poly))>=3, "Arg Poly must contain the 2D or 3D coordinates of at least 3 points (polygon) !"             # <<<<<<<<<<<<<<
 *         assert order.lower() in ['c','f'], "Arg order must be in ['c','f'] !"
 *         assert type(Clock) is bool, "Arg Clock must be a bool !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_int_2, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (!__pyx_t_7) {
      } else {
        goto __pyx_L5_next_and;
      }
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_int_3, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_L5_next_and:;
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_max, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 171, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __pyx_t_6;
      __pyx_L4_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_Poly_must_contain_the_2D_or);
        __PYX_ERR(0, 171, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":172
 *     if Test:
 *         assert (2 in np.shape(Poly) or 3 in np.shape(Poly)) and max(np.shape(Poly))>=3, "Arg Poly must contain the 2D or 3D coordinates of at least 3 points (polygon) !"
 *         assert order.lower() in ['c','f'], "Arg order must be in ['c','f'] !"             # <<<<<<<<<<<<<<
 *         assert type(Clock) is bool, "Arg Clock must be a bool !"
 *         assert type(close) is bool, "Arg close must be a bool !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_order, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 172, __pyx_L1_error)
      if (!__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_f, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 172, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_6;
      __pyx_L7_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_order_must_be_in_c_f);
        __PYX_ERR(0, 172, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":173
 *         assert (2 in np.shape(Poly) or 3 in np.shape(Poly)) and max(np.shape(Poly))>=3, "Arg Poly must contain the 2D or 3D coordinates of at least 3 points (polygon) !"
 *         assert order.lower() in ['c','f'], "Arg order must be in ['c','f'] !"
 *         assert type(Clock) is bool, "Arg Clock must be a bool !"             # <<<<<<<<<<<<<<
 *         assert type(close) is bool, "Arg close must be a bool !"
 *         assert layout.lower() in ['(cc,n)','(n,cc)'], "Arg layout must be in ['(cc,n)','(n,cc)'] !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_Clock)) == ((PyObject *)__pyx_ptype_7cpython_4bool_bool));
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_Clock_must_be_a_bool);
        __PYX_ERR(0, 173, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":174
 *         assert order.lower() in ['c','f'], "Arg order must be in ['c','f'] !"
 *         assert type(Clock) is bool, "Arg Clock must be a bool !"
 *         assert type(close) is bool, "Arg close must be a bool !"             # <<<<<<<<<<<<<<
 *         assert layout.lower() in ['(cc,n)','(n,cc)'], "Arg layout must be in ['(cc,n)','(n,cc)'] !"
 *         assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'], "Arg layout_in must be in ['(cc,n)','(n,cc)'] !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_close)) == ((PyObject *)__pyx_ptype_7cpython_4bool_bool));
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_close_must_be_a_bool);
        __PYX_ERR(0, 174, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":175
 *         assert type(Clock) is bool, "Arg Clock must be a bool !"
 *         assert type(close) is bool, "Arg close must be a bool !"
 *         assert layout.lower() in ['(cc,n)','(n,cc)'], "Arg layout must be in ['(cc,n)','(n,cc)'] !"             # <<<<<<<<<<<<<<
 *         assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'], "Arg layout_in must be in ['(cc,n)','(n,cc)'] !"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_layout, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_cc_n, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 175, __pyx_L1_error)
      if (!__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_n_cc, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 175, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_6;
      __pyx_L9_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_layout_must_be_in_cc_n_n_cc);
        __PYX_ERR(0, 175, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":176
 *         assert type(close) is bool, "Arg close must be a bool !"
 *         assert layout.lower() in ['(cc,n)','(n,cc)'], "Arg layout must be in ['(cc,n)','(n,cc)'] !"
 *         assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'], "Arg layout_in must be in ['(cc,n)','(n,cc)'] !"             # <<<<<<<<<<<<<<
 * 
 *     if np.shape(Poly)==(3,3):
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = (__pyx_v_layout_in == ((PyObject*)Py_None));
      __pyx_t_7 = (__pyx_t_6 != 0);
      if (!__pyx_t_7) {
      } else {
        __pyx_t_1 = __pyx_t_7;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_layout_in, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_cc_n, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 176, __pyx_L1_error)
      if (!__pyx_t_6) {
      } else {
        __pyx_t_7 = __pyx_t_6;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_n_cc, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 176, __pyx_L1_error)
      __pyx_t_7 = __pyx_t_6;
      __pyx_L13_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = (__pyx_t_7 != 0);
      __pyx_t_1 = __pyx_t_6;
      __pyx_L11_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_layout_in_must_be_in_cc_n_n);
        __PYX_ERR(0, 176, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":170
 * 
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert (2 in np.shape(Poly) or 3 in np.shape(Poly)) and max(np.shape(Poly))>=3, "Arg Poly must contain the 2D or 3D coordinates of at least 3 points (polygon) !"
 *         assert order.lower() in ['c','f'], "Arg order must be in ['c','f'] !"
 */
  }

  /* "tofu/geom/_GG03.pyx":178
 *         assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'], "Arg layout_in must be in ['(cc,n)','(n,cc)'] !"
 * 
 *     if np.shape(Poly)==(3,3):             # <<<<<<<<<<<<<<
 *         assert not layout_in is None, "Could not resolve the input layout of Poly because shape==(3,3), specify !"
 *         poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' else np.array(Poly)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_Poly)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_Poly)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_Poly));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_tuple__42, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":179
 * 
 *     if np.shape(Poly)==(3,3):
 *         assert not layout_in is None, "Could not resolve the input layout of Poly because shape==(3,3), specify !"             # <<<<<<<<<<<<<<
 *         poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' else np.array(Poly)
 *     else:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = (__pyx_v_layout_in != ((PyObject*)Py_None));
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Could_not_resolve_the_input_layo);
        __PYX_ERR(0, 179, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":180
 *     if np.shape(Poly)==(3,3):
 *         assert not layout_in is None, "Could not resolve the input layout of Poly because shape==(3,3), specify !"
 *         poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' else np.array(Poly)             # <<<<<<<<<<<<<<
 *     else:
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_layout_in, __pyx_n_s_lower); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_n_cc, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 180, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_v_poly = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":178
 *         assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'], "Arg layout_in must be in ['(cc,n)','(n,cc)'] !"
 * 
 *     if np.shape(Poly)==(3,3):             # <<<<<<<<<<<<<<
 *         assert not layout_in is None, "Could not resolve the input layout of Poly because shape==(3,3), specify !"
 *         poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' else np.array(Poly)
 */
    goto __pyx_L15;
  }

  /* "tofu/geom/_GG03.pyx":182
 *         poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' else np.array(Poly)
 *     else:
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)             # <<<<<<<<<<<<<<
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 */
  /*else*/ {
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, ((PyObject *)__pyx_v_Poly)};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, ((PyObject *)__pyx_v_Poly)};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_Poly));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_min, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_Poly->dimensions[1])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 182, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_1) {
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 182, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)__pyx_v_Poly)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Poly)};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_Poly));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_Poly));
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)__pyx_v_Poly));
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_4 = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_v_poly = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_L15:;

  /* "tofu/geom/_GG03.pyx":183
 *     else:
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):             # <<<<<<<<<<<<<<
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_allclose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetItem(__pyx_v_poly, __pyx_tuple__44); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_GetItem(__pyx_v_poly, __pyx_tuple__46); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_8);
  __pyx_t_4 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_atol, __pyx_float_1_eneg_9) < 0) __PYX_ERR(0, 183, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = ((!__pyx_t_1) != 0);
  if (__pyx_t_6) {

    /* "tofu/geom/_GG03.pyx":184
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)             # <<<<<<<<<<<<<<
 *     if poly.shape[0]==2 and not Clock is None:
 *         if not Clock==Poly_isClockwise(poly):
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetItem(__pyx_v_poly, __pyx_tuple__49); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_poly);
    __Pyx_GIVEREF(__pyx_v_poly);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_poly);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 184, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_poly, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":183
 *     else:
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):             # <<<<<<<<<<<<<<
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:
 */
  }

  /* "tofu/geom/_GG03.pyx":185
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:             # <<<<<<<<<<<<<<
 *         if not Clock==Poly_isClockwise(poly):
 *             poly = poly[:,::-1]
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_poly, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {
  } else {
    __pyx_t_6 = __pyx_t_1;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_Clock != Py_None);
  __pyx_t_7 = (__pyx_t_1 != 0);
  __pyx_t_6 = __pyx_t_7;
  __pyx_L18_bool_binop_done:;
  if (__pyx_t_6) {

    /* "tofu/geom/_GG03.pyx":186
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:
 *         if not Clock==Poly_isClockwise(poly):             # <<<<<<<<<<<<<<
 *             poly = poly[:,::-1]
 *     if not close:
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Poly_isClockwise); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_poly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_poly};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_poly};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_poly);
        __Pyx_GIVEREF(__pyx_v_poly);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_poly);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_Clock, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = ((!__pyx_t_6) != 0);
    if (__pyx_t_7) {

      /* "tofu/geom/_GG03.pyx":187
 *     if poly.shape[0]==2 and not Clock is None:
 *         if not Clock==Poly_isClockwise(poly):
 *             poly = poly[:,::-1]             # <<<<<<<<<<<<<<
 *     if not close:
 *         poly = poly[:,:-1]
 */
      __pyx_t_5 = PyObject_GetItem(__pyx_v_poly, __pyx_tuple__52); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_poly, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "tofu/geom/_GG03.pyx":186
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:
 *         if not Clock==Poly_isClockwise(poly):             # <<<<<<<<<<<<<<
 *             poly = poly[:,::-1]
 *     if not close:
 */
    }

    /* "tofu/geom/_GG03.pyx":185
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:             # <<<<<<<<<<<<<<
 *         if not Clock==Poly_isClockwise(poly):
 *             poly = poly[:,::-1]
 */
  }

  /* "tofu/geom/_GG03.pyx":188
 *         if not Clock==Poly_isClockwise(poly):
 *             poly = poly[:,::-1]
 *     if not close:             # <<<<<<<<<<<<<<
 *         poly = poly[:,:-1]
 *     if layout.lower()=='(n,cc)':
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_close); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 188, __pyx_L1_error)
  __pyx_t_6 = ((!__pyx_t_7) != 0);
  if (__pyx_t_6) {

    /* "tofu/geom/_GG03.pyx":189
 *             poly = poly[:,::-1]
 *     if not close:
 *         poly = poly[:,:-1]             # <<<<<<<<<<<<<<
 *     if layout.lower()=='(n,cc)':
 *         poly = poly.T
 */
    __pyx_t_5 = PyObject_GetItem(__pyx_v_poly, __pyx_tuple__55); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_poly, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "tofu/geom/_GG03.pyx":188
 *         if not Clock==Poly_isClockwise(poly):
 *             poly = poly[:,::-1]
 *     if not close:             # <<<<<<<<<<<<<<
 *         poly = poly[:,:-1]
 *     if layout.lower()=='(n,cc)':
 */
  }

  /* "tofu/geom/_GG03.pyx":190
 *     if not close:
 *         poly = poly[:,:-1]
 *     if layout.lower()=='(n,cc)':             # <<<<<<<<<<<<<<
 *         poly = poly.T
 *     poly = np.ascontiguousarray(poly) if order.lower()=='c' else np.asfortranarray(poly)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_layout, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_8) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s_n_cc, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 190, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_6) {

    /* "tofu/geom/_GG03.pyx":191
 *         poly = poly[:,:-1]
 *     if layout.lower()=='(n,cc)':
 *         poly = poly.T             # <<<<<<<<<<<<<<
 *     poly = np.ascontiguousarray(poly) if order.lower()=='c' else np.asfortranarray(poly)
 *     return poly
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_poly, __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 191, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_poly, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "tofu/geom/_GG03.pyx":190
 *     if not close:
 *         poly = poly[:,:-1]
 *     if layout.lower()=='(n,cc)':             # <<<<<<<<<<<<<<
 *         poly = poly.T
 *     poly = np.ascontiguousarray(poly) if order.lower()=='c' else np.asfortranarray(poly)
 */
  }

  /* "tofu/geom/_GG03.pyx":192
 *     if layout.lower()=='(n,cc)':
 *         poly = poly.T
 *     poly = np.ascontiguousarray(poly) if order.lower()=='c' else np.asfortranarray(poly)             # <<<<<<<<<<<<<<
 *     return poly
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_order, __pyx_n_s_lower); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_6 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 192, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_ascontiguousarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_poly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_poly};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_poly};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_INCREF(__pyx_v_poly);
        __Pyx_GIVEREF(__pyx_v_poly);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_poly);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asfortranarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_poly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_poly};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_poly};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_poly);
        __Pyx_GIVEREF(__pyx_v_poly);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_poly);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __Pyx_DECREF_SET(__pyx_v_poly, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "tofu/geom/_GG03.pyx":193
 *         poly = poly.T
 *     poly = np.ascontiguousarray(poly) if order.lower()=='c' else np.asfortranarray(poly)
 *     return poly             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_poly);
  __pyx_r = __pyx_v_poly;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":152
 * 
 * 
 * def Poly_Order(cnp.ndarray[double,ndim=2] Poly, str order='C', Clock=False, close=True, str layout='(cc,N)', str layout_in=None, Test=True):             # <<<<<<<<<<<<<<
 *     """
 *     Return a polygon Poly as a np.ndarray formatted according to parameters
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.Poly_Order", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_poly);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":198
 * 
 * 
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_7Poly_VolAngTor(PyObject *__pyx_self, PyObject *__pyx_v_Poly); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_7Poly_VolAngTor = {"Poly_VolAngTor", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_7Poly_VolAngTor, METH_O, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_7Poly_VolAngTor(PyObject *__pyx_self, PyObject *__pyx_v_Poly) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Poly_VolAngTor (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Poly), __pyx_ptype_5numpy_ndarray, 1, "Poly", 0))) __PYX_ERR(0, 198, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_6Poly_VolAngTor(__pyx_self, ((PyArrayObject *)__pyx_v_Poly));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_6Poly_VolAngTor(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Poly) {
  PyArrayObject *__pyx_v_Ri0 = 0;
  PyArrayObject *__pyx_v_Ri1 = 0;
  PyArrayObject *__pyx_v_Zi0 = 0;
  PyArrayObject *__pyx_v_Zi1 = 0;
  double __pyx_v_V;
  double __pyx_v_BV0;
  double __pyx_v_BV1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Poly;
  __Pyx_Buffer __pyx_pybuffer_Poly;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Ri0;
  __Pyx_Buffer __pyx_pybuffer_Ri0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Ri1;
  __Pyx_Buffer __pyx_pybuffer_Ri1;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Zi0;
  __Pyx_Buffer __pyx_pybuffer_Zi0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Zi1;
  __Pyx_Buffer __pyx_pybuffer_Zi1;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyArrayObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  double __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("Poly_VolAngTor", 0);
  __pyx_pybuffer_Ri0.pybuffer.buf = NULL;
  __pyx_pybuffer_Ri0.refcount = 0;
  __pyx_pybuffernd_Ri0.data = NULL;
  __pyx_pybuffernd_Ri0.rcbuffer = &__pyx_pybuffer_Ri0;
  __pyx_pybuffer_Ri1.pybuffer.buf = NULL;
  __pyx_pybuffer_Ri1.refcount = 0;
  __pyx_pybuffernd_Ri1.data = NULL;
  __pyx_pybuffernd_Ri1.rcbuffer = &__pyx_pybuffer_Ri1;
  __pyx_pybuffer_Zi0.pybuffer.buf = NULL;
  __pyx_pybuffer_Zi0.refcount = 0;
  __pyx_pybuffernd_Zi0.data = NULL;
  __pyx_pybuffernd_Zi0.rcbuffer = &__pyx_pybuffer_Zi0;
  __pyx_pybuffer_Zi1.pybuffer.buf = NULL;
  __pyx_pybuffer_Zi1.refcount = 0;
  __pyx_pybuffernd_Zi1.data = NULL;
  __pyx_pybuffernd_Zi1.rcbuffer = &__pyx_pybuffer_Zi1;
  __pyx_pybuffer_Poly.pybuffer.buf = NULL;
  __pyx_pybuffer_Poly.refcount = 0;
  __pyx_pybuffernd_Poly.data = NULL;
  __pyx_pybuffernd_Poly.rcbuffer = &__pyx_pybuffer_Poly;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer, (PyObject*)__pyx_v_Poly, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 198, __pyx_L1_error)
  }
  __pyx_pybuffernd_Poly.diminfo[0].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Poly.diminfo[0].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Poly.diminfo[1].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Poly.diminfo[1].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[1];

  /* "tofu/geom/_GG03.pyx":199
 * 
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]             # <<<<<<<<<<<<<<
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 *     cdef double BV0 = np.sum((Ri0*Zi1 - Zi0*Ri1) * 0.5 * (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V)
 */
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_Poly), __pyx_tuple__57); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_t_2 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ri0.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_Ri0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Ri0.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 199, __pyx_L1_error)
    } else {__pyx_pybuffernd_Ri0.diminfo[0].strides = __pyx_pybuffernd_Ri0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ri0.diminfo[0].shape = __pyx_pybuffernd_Ri0.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_2 = 0;
  __pyx_v_Ri0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_Poly), __pyx_tuple__59); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_t_2 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Ri1.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_Ri1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Ri1.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 199, __pyx_L1_error)
    } else {__pyx_pybuffernd_Ri1.diminfo[0].strides = __pyx_pybuffernd_Ri1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Ri1.diminfo[0].shape = __pyx_pybuffernd_Ri1.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_2 = 0;
  __pyx_v_Ri1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_Poly), __pyx_tuple__61); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_t_2 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Zi0.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_Zi0 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Zi0.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 199, __pyx_L1_error)
    } else {__pyx_pybuffernd_Zi0.diminfo[0].strides = __pyx_pybuffernd_Zi0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Zi0.diminfo[0].shape = __pyx_pybuffernd_Zi0.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_2 = 0;
  __pyx_v_Zi0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_Poly), __pyx_tuple__63); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 199, __pyx_L1_error)
  __pyx_t_2 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Zi1.rcbuffer->pybuffer, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_Zi1 = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Zi1.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 199, __pyx_L1_error)
    } else {__pyx_pybuffernd_Zi1.diminfo[0].strides = __pyx_pybuffernd_Zi1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Zi1.diminfo[0].shape = __pyx_pybuffernd_Zi1.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_2 = 0;
  __pyx_v_Zi1 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":200
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.             # <<<<<<<<<<<<<<
 *     cdef double BV0 = np.sum((Ri0*Zi1 - Zi0*Ri1) * 0.5 * (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V)
 *     cdef double BV1 = -np.sum((Ri1**2*Zi0*(2.*Zi1+Zi0) + 2.*Ri0*Ri1*(Zi0**2-Zi1**2) - Ri0**2*Zi1*(Zi1+2.*Zi0))/4.)/(6.*V)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_Ri0), ((PyObject *)__pyx_v_Zi1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_v_Zi0), ((PyObject *)__pyx_v_Ri1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_v_Ri0), ((PyObject *)__pyx_v_Ri1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_6_, 6., 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_V = __pyx_t_7;

  /* "tofu/geom/_GG03.pyx":201
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 *     cdef double BV0 = np.sum((Ri0*Zi1 - Zi0*Ri1) * 0.5 * (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V)             # <<<<<<<<<<<<<<
 *     cdef double BV1 = -np.sum((Ri1**2*Zi0*(2.*Zi1+Zi0) + 2.*Ri0*Ri1*(Zi0**2-Zi1**2) - Ri0**2*Zi1*(Zi1+2.*Zi0))/4.)/(6.*V)
 *     return V, np.array([BV0,BV1])
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sum); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_Ri0), ((PyObject *)__pyx_v_Zi1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_Zi0), ((PyObject *)__pyx_v_Ri1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_float_0_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Power(((PyObject *)__pyx_v_Ri1), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_Ri1), ((PyObject *)__pyx_v_Ri0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_Ri0), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyFloat_FromDouble((6. * __pyx_v_V)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_BV0 = __pyx_t_7;

  /* "tofu/geom/_GG03.pyx":202
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 *     cdef double BV0 = np.sum((Ri0*Zi1 - Zi0*Ri1) * 0.5 * (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V)
 *     cdef double BV1 = -np.sum((Ri1**2*Zi0*(2.*Zi1+Zi0) + 2.*Ri0*Ri1*(Zi0**2-Zi1**2) - Ri0**2*Zi1*(Zi1+2.*Zi0))/4.)/(6.*V)             # <<<<<<<<<<<<<<
 *     return V, np.array([BV0,BV1])
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Power(((PyObject *)__pyx_v_Ri1), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, ((PyObject *)__pyx_v_Zi0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_float_2_, ((PyObject *)__pyx_v_Zi1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, ((PyObject *)__pyx_v_Zi0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_float_2_, ((PyObject *)__pyx_v_Ri0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, ((PyObject *)__pyx_v_Ri1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Power(((PyObject *)__pyx_v_Zi0), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyNumber_Power(((PyObject *)__pyx_v_Zi1), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyNumber_Subtract(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Power(((PyObject *)__pyx_v_Ri0), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_8, ((PyObject *)__pyx_v_Zi1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Multiply(__pyx_float_2_, ((PyObject *)__pyx_v_Zi0)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_Zi1), __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyFloat_DivideObjC(__pyx_t_1, __pyx_float_4_, 4., 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble((6. * __pyx_v_V)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_BV1 = __pyx_t_7;

  /* "tofu/geom/_GG03.pyx":203
 *     cdef double BV0 = np.sum((Ri0*Zi1 - Zi0*Ri1) * 0.5 * (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V)
 *     cdef double BV1 = -np.sum((Ri1**2*Zi0*(2.*Zi1+Zi0) + 2.*Ri0*Ri1*(Zi0**2-Zi1**2) - Ri0**2*Zi1*(Zi1+2.*Zi0))/4.)/(6.*V)
 *     return V, np.array([BV0,BV1])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_BV0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_BV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
  __pyx_t_9 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":198
 * 
 * 
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ri0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ri1.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Zi0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Zi1.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.Poly_VolAngTor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ri0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Ri1.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Zi0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Zi1.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Ri0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Ri1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Zi0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Zi1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":218
 * 
 * 
 * def Sino_ImpactEnv(cnp.ndarray[double,ndim=1] RZ, cnp.ndarray[double,ndim=2] Poly, int NP=50, Test=True):             # <<<<<<<<<<<<<<
 *     """ Computes impact parameters of a Tor enveloppe (Tor is a closed 2D polygon)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_9Sino_ImpactEnv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_8Sino_ImpactEnv[] = " Computes impact parameters of a Tor enveloppe (Tor is a closed 2D polygon)\n\n    D. VEZINET, Aug. 2014\n    Inputs :\n        RZ          A (2,1) np.ndarray indicating the impact point\n        Poly        A (2,N) np.ndarray (ideally with 1st point = last point, but optionnal) representing the 2D polygon to be used\n        NP          An integer (default = 50) indicating the number of points used for discretising theta between 0 and pi\n    Outputs :\n        theta\n    ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_9Sino_ImpactEnv = {"Sino_ImpactEnv", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_9Sino_ImpactEnv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_8Sino_ImpactEnv};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_9Sino_ImpactEnv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_RZ = 0;
  PyArrayObject *__pyx_v_Poly = 0;
  int __pyx_v_NP;
  PyObject *__pyx_v_Test = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Sino_ImpactEnv (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_RZ,&__pyx_n_s_Poly,&__pyx_n_s_NP,&__pyx_n_s_Test,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RZ)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Poly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("Sino_ImpactEnv", 0, 2, 4, 1); __PYX_ERR(0, 218, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_NP);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Test);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Sino_ImpactEnv") < 0)) __PYX_ERR(0, 218, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_RZ = ((PyArrayObject *)values[0]);
    __pyx_v_Poly = ((PyArrayObject *)values[1]);
    if (values[2]) {
      __pyx_v_NP = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_NP == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L3_error)
    } else {
      __pyx_v_NP = ((int)50);
    }
    __pyx_v_Test = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Sino_ImpactEnv", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 218, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.Sino_ImpactEnv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_RZ), __pyx_ptype_5numpy_ndarray, 1, "RZ", 0))) __PYX_ERR(0, 218, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Poly), __pyx_ptype_5numpy_ndarray, 1, "Poly", 0))) __PYX_ERR(0, 218, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_8Sino_ImpactEnv(__pyx_self, __pyx_v_RZ, __pyx_v_Poly, __pyx_v_NP, __pyx_v_Test);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_8Sino_ImpactEnv(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_RZ, PyArrayObject *__pyx_v_Poly, int __pyx_v_NP, PyObject *__pyx_v_Test) {
  int __pyx_v_NPoly;
  PyObject *__pyx_v_EnvTheta = NULL;
  PyObject *__pyx_v_Vect = NULL;
  PyObject *__pyx_v_Vectbis = NULL;
  PyObject *__pyx_v_RZPoly = NULL;
  PyObject *__pyx_v_Sca = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Poly;
  __Pyx_Buffer __pyx_pybuffer_Poly;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_RZ;
  __Pyx_Buffer __pyx_pybuffer_RZ;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("Sino_ImpactEnv", 0);
  __pyx_pybuffer_RZ.pybuffer.buf = NULL;
  __pyx_pybuffer_RZ.refcount = 0;
  __pyx_pybuffernd_RZ.data = NULL;
  __pyx_pybuffernd_RZ.rcbuffer = &__pyx_pybuffer_RZ;
  __pyx_pybuffer_Poly.pybuffer.buf = NULL;
  __pyx_pybuffer_Poly.refcount = 0;
  __pyx_pybuffernd_Poly.data = NULL;
  __pyx_pybuffernd_Poly.rcbuffer = &__pyx_pybuffer_Poly;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_RZ.rcbuffer->pybuffer, (PyObject*)__pyx_v_RZ, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 218, __pyx_L1_error)
  }
  __pyx_pybuffernd_RZ.diminfo[0].strides = __pyx_pybuffernd_RZ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_RZ.diminfo[0].shape = __pyx_pybuffernd_RZ.rcbuffer->pybuffer.shape[0];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer, (PyObject*)__pyx_v_Poly, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 218, __pyx_L1_error)
  }
  __pyx_pybuffernd_Poly.diminfo[0].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Poly.diminfo[0].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Poly.diminfo[1].strides = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Poly.diminfo[1].shape = __pyx_pybuffernd_Poly.rcbuffer->pybuffer.shape[1];

  /* "tofu/geom/_GG03.pyx":229
 *         theta
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert RZ.size==2, 'Arg RZ should be a (2,) np.ndarray !'
 *         assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray !'
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Test); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":230
 *     """
 *     if Test:
 *         assert RZ.size==2, 'Arg RZ should be a (2,) np.ndarray !'             # <<<<<<<<<<<<<<
 *         assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray !'
 *     cdef int NPoly = Poly.shape[1]
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_RZ), __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_RZ_should_be_a_2_np_ndarray);
        __PYX_ERR(0, 230, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":231
 *     if Test:
 *         assert RZ.size==2, 'Arg RZ should be a (2,) np.ndarray !'
 *         assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray !'             # <<<<<<<<<<<<<<
 *     cdef int NPoly = Poly.shape[1]
 *     EnvTheta = np.linspace(0.,np.pi,NP,endpoint=True).reshape((NP,1))
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!(((__pyx_v_Poly->dimensions[0]) == 2) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_Poly_should_be_a_2_N_np_ndar);
        __PYX_ERR(0, 231, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":229
 *         theta
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert RZ.size==2, 'Arg RZ should be a (2,) np.ndarray !'
 *         assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray !'
 */
  }

  /* "tofu/geom/_GG03.pyx":232
 *         assert RZ.size==2, 'Arg RZ should be a (2,) np.ndarray !'
 *         assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray !'
 *     cdef int NPoly = Poly.shape[1]             # <<<<<<<<<<<<<<
 *     EnvTheta = np.linspace(0.,np.pi,NP,endpoint=True).reshape((NP,1))
 *     Vect = np.concatenate((np.cos(EnvTheta),np.sin(EnvTheta)),axis=1)
 */
  __pyx_v_NPoly = (__pyx_v_Poly->dimensions[1]);

  /* "tofu/geom/_GG03.pyx":233
 *         assert Poly.shape[0]==2, 'Arg Poly should be a (2,N) np.ndarray !'
 *     cdef int NPoly = Poly.shape[1]
 *     EnvTheta = np.linspace(0.,np.pi,NP,endpoint=True).reshape((NP,1))             # <<<<<<<<<<<<<<
 *     Vect = np.concatenate((np.cos(EnvTheta),np.sin(EnvTheta)),axis=1)
 *     Vectbis = np.swapaxes(np.resize(Vect,(NPoly,NP,2)),0,1)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_linspace); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pi); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_float_0_);
  __Pyx_GIVEREF(__pyx_float_0_);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_float_0_);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
  __pyx_t_5 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_endpoint, Py_True) < 0) __PYX_ERR(0, 233, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1);
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_EnvTheta = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":234
 *     cdef int NPoly = Poly.shape[1]
 *     EnvTheta = np.linspace(0.,np.pi,NP,endpoint=True).reshape((NP,1))
 *     Vect = np.concatenate((np.cos(EnvTheta),np.sin(EnvTheta)),axis=1)             # <<<<<<<<<<<<<<
 *     Vectbis = np.swapaxes(np.resize(Vect,(NPoly,NP,2)),0,1)
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_cos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_EnvTheta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_EnvTheta};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_EnvTheta};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_EnvTheta);
      __Pyx_GIVEREF(__pyx_v_EnvTheta);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_EnvTheta);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_sin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_EnvTheta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_EnvTheta};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_EnvTheta};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_EnvTheta);
      __Pyx_GIVEREF(__pyx_v_EnvTheta);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_EnvTheta);
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_Vect = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":235
 *     EnvTheta = np.linspace(0.,np.pi,NP,endpoint=True).reshape((NP,1))
 *     Vect = np.concatenate((np.cos(EnvTheta),np.sin(EnvTheta)),axis=1)
 *     Vectbis = np.swapaxes(np.resize(Vect,(NPoly,NP,2)),0,1)             # <<<<<<<<<<<<<<
 * 
 *     RZPoly = Poly - np.tile(RZ,(NPoly,1)).T
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_swapaxes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_NPoly); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_2);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_Vect, __pyx_t_8};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_Vect, __pyx_t_8};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_Vect);
    __Pyx_GIVEREF(__pyx_v_Vect);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_v_Vect);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_int_0, __pyx_int_1};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_int_0, __pyx_int_1};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 3+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_7) {
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_9, __pyx_t_4);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_9, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_1);
    __Pyx_GIVEREF(__pyx_int_1);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_9, __pyx_int_1);
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_Vectbis = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":237
 *     Vectbis = np.swapaxes(np.resize(Vect,(NPoly,NP,2)),0,1)
 * 
 *     RZPoly = Poly - np.tile(RZ,(NPoly,1)).T             # <<<<<<<<<<<<<<
 *     RZPoly = np.resize(RZPoly.T,(NP,NPoly,2))
 *     Sca = np.sum(Vectbis*RZPoly,axis=2)
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_tile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_NPoly); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_RZ), __pyx_t_4};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, ((PyObject *)__pyx_v_RZ), __pyx_t_4};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_RZ));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_RZ));
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_9, ((PyObject *)__pyx_v_RZ));
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_9, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_Poly), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_RZPoly = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":238
 * 
 *     RZPoly = Poly - np.tile(RZ,(NPoly,1)).T
 *     RZPoly = np.resize(RZPoly.T,(NP,NPoly,2))             # <<<<<<<<<<<<<<
 *     Sca = np.sum(Vectbis*RZPoly,axis=2)
 *     return EnvTheta.flatten(), np.array([np.max(Sca,axis=1).T, np.min(Sca,axis=1).T])
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resize); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_RZPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_NPoly); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_2);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_9 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
    PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_2, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_4 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_9, __pyx_t_8);
    __pyx_t_2 = 0;
    __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_RZPoly, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":239
 *     RZPoly = Poly - np.tile(RZ,(NPoly,1)).T
 *     RZPoly = np.resize(RZPoly.T,(NP,NPoly,2))
 *     Sca = np.sum(Vectbis*RZPoly,axis=2)             # <<<<<<<<<<<<<<
 *     return EnvTheta.flatten(), np.array([np.max(Sca,axis=1).T, np.min(Sca,axis=1).T])
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_Vectbis, __pyx_v_RZPoly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_axis, __pyx_int_2) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Sca = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "tofu/geom/_GG03.pyx":240
 *     RZPoly = np.resize(RZPoly.T,(NP,NPoly,2))
 *     Sca = np.sum(Vectbis*RZPoly,axis=2)
 *     return EnvTheta.flatten(), np.array([np.max(Sca,axis=1).T, np.min(Sca,axis=1).T])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_EnvTheta, __pyx_n_s_flatten); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 240, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_Sca);
  __Pyx_GIVEREF(__pyx_v_Sca);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_Sca);
  __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_T); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_Sca);
  __Pyx_GIVEREF(__pyx_v_Sca);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_Sca);
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 240, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = PyList_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_2);
  __pyx_t_6 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_10};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_10};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_3);
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":218
 * 
 * 
 * def Sino_ImpactEnv(cnp.ndarray[double,ndim=1] RZ, cnp.ndarray[double,ndim=2] Poly, int NP=50, Test=True):             # <<<<<<<<<<<<<<
 *     """ Computes impact parameters of a Tor enveloppe (Tor is a closed 2D polygon)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_RZ.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.Sino_ImpactEnv", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Poly.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_RZ.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_EnvTheta);
  __Pyx_XDECREF(__pyx_v_Vect);
  __Pyx_XDECREF(__pyx_v_Vectbis);
  __Pyx_XDECREF(__pyx_v_RZPoly);
  __Pyx_XDECREF(__pyx_v_Sca);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":244
 * 
 * # For sinograms
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):             # <<<<<<<<<<<<<<
 *     if hasattr(theta,'__getitem__'):
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_11ConvertImpact_Theta2Xi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_11ConvertImpact_Theta2Xi = {"ConvertImpact_Theta2Xi", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_11ConvertImpact_Theta2Xi, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_11ConvertImpact_Theta2Xi(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_theta = 0;
  PyObject *__pyx_v_pP = 0;
  PyObject *__pyx_v_pN = 0;
  PyObject *__pyx_v_sort = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ConvertImpact_Theta2Xi (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_theta,&__pyx_n_s_pP,&__pyx_n_s_pN,&__pyx_n_s_sort,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_theta)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pP)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ConvertImpact_Theta2Xi", 0, 3, 4, 1); __PYX_ERR(0, 244, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pN)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ConvertImpact_Theta2Xi", 0, 3, 4, 2); __PYX_ERR(0, 244, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sort);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ConvertImpact_Theta2Xi") < 0)) __PYX_ERR(0, 244, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_theta = values[0];
    __pyx_v_pP = values[1];
    __pyx_v_pN = values[2];
    __pyx_v_sort = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ConvertImpact_Theta2Xi", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 244, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.ConvertImpact_Theta2Xi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_10ConvertImpact_Theta2Xi(__pyx_self, __pyx_v_theta, __pyx_v_pP, __pyx_v_pN, __pyx_v_sort);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_10ConvertImpact_Theta2Xi(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_theta, PyObject *__pyx_v_pP, PyObject *__pyx_v_pN, PyObject *__pyx_v_sort) {
  PyObject *__pyx_v_pPbis = NULL;
  PyObject *__pyx_v_pNbis = NULL;
  PyObject *__pyx_v_xi = NULL;
  PyObject *__pyx_v_ind = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("ConvertImpact_Theta2Xi", 0);
  __Pyx_INCREF(__pyx_v_theta);
  __Pyx_INCREF(__pyx_v_pP);
  __Pyx_INCREF(__pyx_v_pN);

  /* "tofu/geom/_GG03.pyx":245
 * # For sinograms
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):
 *     if hasattr(theta,'__getitem__'):             # <<<<<<<<<<<<<<
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 *         assert pP.shape==pN.shape==theta.shape, "Args pP, pN and theta must have same shape !"
 */
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_theta, __pyx_n_s_getitem); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 245, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "tofu/geom/_GG03.pyx":246
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):
 *     if hasattr(theta,'__getitem__'):
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)             # <<<<<<<<<<<<<<
 *         assert pP.shape==pN.shape==theta.shape, "Args pP, pN and theta must have same shape !"
 *         pPbis, pNbis = np.copy(pP), np.copy(pN)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_pP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_pP};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_pP};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_v_pP);
        __Pyx_GIVEREF(__pyx_v_pP);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_pP);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_pN); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_pN};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_pN};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_pN);
        __Pyx_GIVEREF(__pyx_v_pN);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_pN);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_theta); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_theta};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_theta};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL;
        __Pyx_INCREF(__pyx_v_theta);
        __Pyx_GIVEREF(__pyx_v_theta);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_theta);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_pP, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_pN, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_theta, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":247
 *     if hasattr(theta,'__getitem__'):
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 *         assert pP.shape==pN.shape==theta.shape, "Args pP, pN and theta must have same shape !"             # <<<<<<<<<<<<<<
 *         pPbis, pNbis = np.copy(pP), np.copy(pN)
 *         xi = theta - np.pi/2.
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pP, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_pN, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_3)) {
        __Pyx_DECREF(__pyx_t_3);
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_theta, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 247, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_pP_pN_and_theta_must_have_s);
        __PYX_ERR(0, 247, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":248
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 *         assert pP.shape==pN.shape==theta.shape, "Args pP, pN and theta must have same shape !"
 *         pPbis, pNbis = np.copy(pP), np.copy(pN)             # <<<<<<<<<<<<<<
 *         xi = theta - np.pi/2.
 *         ind = xi < 0
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_pP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_pP};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_pP};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_pP);
        __Pyx_GIVEREF(__pyx_v_pP);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_pP);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_copy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_pN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_pN};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_pN};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_pN);
        __Pyx_GIVEREF(__pyx_v_pN);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_pN);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_pPbis = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_pNbis = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":249
 *         assert pP.shape==pN.shape==theta.shape, "Args pP, pN and theta must have same shape !"
 *         pPbis, pNbis = np.copy(pP), np.copy(pN)
 *         xi = theta - np.pi/2.             # <<<<<<<<<<<<<<
 *         ind = xi < 0
 *         pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyFloat_DivideObjC(__pyx_t_3, __pyx_float_2_, 2., 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_theta, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_xi = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":250
 *         pPbis, pNbis = np.copy(pP), np.copy(pN)
 *         xi = theta - np.pi/2.
 *         ind = xi < 0             # <<<<<<<<<<<<<<
 *         pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi
 *         if sort:
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_xi, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error)
    __pyx_v_ind = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":251
 *         xi = theta - np.pi/2.
 *         ind = xi < 0
 *         pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi             # <<<<<<<<<<<<<<
 *         if sort:
 *             ind = np.argsort(xi)
 */
    __pyx_t_3 = PyObject_GetItem(__pyx_v_pN, __pyx_v_ind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetItem(__pyx_v_pP, __pyx_v_ind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetItem(__pyx_v_xi, __pyx_v_ind); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_pi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_pPbis, __pyx_v_ind, __pyx_t_4) < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_pNbis, __pyx_v_ind, __pyx_t_5) < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_xi, __pyx_v_ind, __pyx_t_8) < 0)) __PYX_ERR(0, 251, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "tofu/geom/_GG03.pyx":252
 *         ind = xi < 0
 *         pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi
 *         if sort:             # <<<<<<<<<<<<<<
 *             ind = np.argsort(xi)
 *             xi, pP, pN = xi[ind], pPbis[ind], pNbis[ind]
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sort); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 252, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "tofu/geom/_GG03.pyx":253
 *         pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi
 *         if sort:
 *             ind = np.argsort(xi)             # <<<<<<<<<<<<<<
 *             xi, pP, pN = xi[ind], pPbis[ind], pNbis[ind]
 *         return xi, pP, pN
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_argsort); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_xi); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_xi};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_xi};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(__pyx_v_xi);
          __Pyx_GIVEREF(__pyx_v_xi);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_xi);
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 253, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_ind, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":254
 *         if sort:
 *             ind = np.argsort(xi)
 *             xi, pP, pN = xi[ind], pPbis[ind], pNbis[ind]             # <<<<<<<<<<<<<<
 *         return xi, pP, pN
 *     else:
 */
      __pyx_t_8 = PyObject_GetItem(__pyx_v_xi, __pyx_v_ind); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = PyObject_GetItem(__pyx_v_pPbis, __pyx_v_ind); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyObject_GetItem(__pyx_v_pNbis, __pyx_v_ind); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_xi, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_DECREF_SET(__pyx_v_pP, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_pN, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":252
 *         ind = xi < 0
 *         pPbis[ind], pNbis[ind], xi[ind] = -pN[ind], -pP[ind], xi[ind]+np.pi
 *         if sort:             # <<<<<<<<<<<<<<
 *             ind = np.argsort(xi)
 *             xi, pP, pN = xi[ind], pPbis[ind], pNbis[ind]
 */
    }

    /* "tofu/geom/_GG03.pyx":255
 *             ind = np.argsort(xi)
 *             xi, pP, pN = xi[ind], pPbis[ind], pNbis[ind]
 *         return xi, pP, pN             # <<<<<<<<<<<<<<
 *     else:
 *         assert not (hasattr(pP,'__getitem__') or hasattr(pN,'__getitem__')), "Args pP, pN and theta must have same shape !"
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_v_xi);
    __Pyx_GIVEREF(__pyx_v_xi);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_xi);
    __Pyx_INCREF(__pyx_v_pP);
    __Pyx_GIVEREF(__pyx_v_pP);
    PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_pP);
    __Pyx_INCREF(__pyx_v_pN);
    __Pyx_GIVEREF(__pyx_v_pN);
    PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_pN);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L0;

    /* "tofu/geom/_GG03.pyx":245
 * # For sinograms
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):
 *     if hasattr(theta,'__getitem__'):             # <<<<<<<<<<<<<<
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 *         assert pP.shape==pN.shape==theta.shape, "Args pP, pN and theta must have same shape !"
 */
  }

  /* "tofu/geom/_GG03.pyx":257
 *         return xi, pP, pN
 *     else:
 *         assert not (hasattr(pP,'__getitem__') or hasattr(pN,'__getitem__')), "Args pP, pN and theta must have same shape !"             # <<<<<<<<<<<<<<
 *         xi = theta - np.pi/2.
 *         if xi < 0.:
 */
  /*else*/ {
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = __Pyx_HasAttr(__pyx_v_pP, __pyx_n_s_getitem); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error)
      __pyx_t_9 = (__pyx_t_1 != 0);
      if (!__pyx_t_9) {
      } else {
        __pyx_t_2 = __pyx_t_9;
        goto __pyx_L5_bool_binop_done;
      }
      __pyx_t_9 = __Pyx_HasAttr(__pyx_v_pN, __pyx_n_s_getitem); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 257, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_9 != 0);
      __pyx_t_2 = __pyx_t_1;
      __pyx_L5_bool_binop_done:;
      if (unlikely(!((!__pyx_t_2) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_pP_pN_and_theta_must_have_s);
        __PYX_ERR(0, 257, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":258
 *     else:
 *         assert not (hasattr(pP,'__getitem__') or hasattr(pN,'__getitem__')), "Args pP, pN and theta must have same shape !"
 *         xi = theta - np.pi/2.             # <<<<<<<<<<<<<<
 *         if xi < 0.:
 *             return xi+np.pi, -pN, -pP
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_pi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyFloat_DivideObjC(__pyx_t_4, __pyx_float_2_, 2., 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_theta, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 258, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_xi = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":259
 *         assert not (hasattr(pP,'__getitem__') or hasattr(pN,'__getitem__')), "Args pP, pN and theta must have same shape !"
 *         xi = theta - np.pi/2.
 *         if xi < 0.:             # <<<<<<<<<<<<<<
 *             return xi+np.pi, -pN, -pP
 *         else:
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_xi, __pyx_float_0_, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 259, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 259, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_2) {

      /* "tofu/geom/_GG03.pyx":260
 *         xi = theta - np.pi/2.
 *         if xi < 0.:
 *             return xi+np.pi, -pN, -pP             # <<<<<<<<<<<<<<
 *         else:
 *             return xi, pP, pN
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_pi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyNumber_Add(__pyx_v_xi, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Negative(__pyx_v_pN); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyNumber_Negative(__pyx_v_pP); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_8);
      __pyx_t_4 = 0;
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "tofu/geom/_GG03.pyx":259
 *         assert not (hasattr(pP,'__getitem__') or hasattr(pN,'__getitem__')), "Args pP, pN and theta must have same shape !"
 *         xi = theta - np.pi/2.
 *         if xi < 0.:             # <<<<<<<<<<<<<<
 *             return xi+np.pi, -pN, -pP
 *         else:
 */
    }

    /* "tofu/geom/_GG03.pyx":262
 *             return xi+np.pi, -pN, -pP
 *         else:
 *             return xi, pP, pN             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_xi);
      __Pyx_GIVEREF(__pyx_v_xi);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_xi);
      __Pyx_INCREF(__pyx_v_pP);
      __Pyx_GIVEREF(__pyx_v_pP);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_pP);
      __Pyx_INCREF(__pyx_v_pN);
      __Pyx_GIVEREF(__pyx_v_pN);
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_pN);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
  }

  /* "tofu/geom/_GG03.pyx":244
 * 
 * # For sinograms
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):             # <<<<<<<<<<<<<<
 *     if hasattr(theta,'__getitem__'):
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("tofu.geom._GG03.ConvertImpact_Theta2Xi", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pPbis);
  __Pyx_XDECREF(__pyx_v_pNbis);
  __Pyx_XDECREF(__pyx_v_xi);
  __Pyx_XDECREF(__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_theta);
  __Pyx_XDECREF(__pyx_v_pP);
  __Pyx_XDECREF(__pyx_v_pN);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":284
 * ########################################################
 * 
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):             # <<<<<<<<<<<<<<
 *     if Test:
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_13_Ves_isInside(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_13_Ves_isInside = {"_Ves_isInside", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_13_Ves_isInside, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_13_Ves_isInside(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Pts = 0;
  PyObject *__pyx_v_VPoly = 0;
  PyObject *__pyx_v_Lim = 0;
  PyObject *__pyx_v_VType = 0;
  PyObject *__pyx_v_In = 0;
  PyObject *__pyx_v_Test = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_isInside (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Pts,&__pyx_n_s_VPoly,&__pyx_n_s_Lim,&__pyx_n_s_VType,&__pyx_n_s_In,&__pyx_n_s_Test,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)__pyx_n_s_Tor);
    values[4] = ((PyObject *)__pyx_kp_s_X_Y_Z);
    values[5] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Pts)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_isInside", 0, 2, 6, 1); __PYX_ERR(0, 284, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Lim);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VType);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_In);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Test);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_isInside") < 0)) __PYX_ERR(0, 284, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Pts = values[0];
    __pyx_v_VPoly = values[1];
    __pyx_v_Lim = values[2];
    __pyx_v_VType = values[3];
    __pyx_v_In = values[4];
    __pyx_v_Test = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_isInside", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 284, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_isInside", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_12_Ves_isInside(__pyx_self, __pyx_v_Pts, __pyx_v_VPoly, __pyx_v_Lim, __pyx_v_VType, __pyx_v_In, __pyx_v_Test);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_12_Ves_isInside(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Pts, PyObject *__pyx_v_VPoly, PyObject *__pyx_v_Lim, PyObject *__pyx_v_VType, PyObject *__pyx_v_In, PyObject *__pyx_v_Test) {
  CYTHON_UNUSED PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_v_pts = NULL;
  PyObject *__pyx_v_ind = NULL;
  PyObject *__pyx_v_ind0 = NULL;
  Py_ssize_t __pyx_v_ii;
  PyObject *__pyx_v_lim = NULL;
  PyObject *__pyx_v_ll = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  double __pyx_t_12;
  double __pyx_t_13;
  __Pyx_RefNannySetupContext("_Ves_isInside", 0);
  __Pyx_INCREF(__pyx_v_Lim);

  /* "tofu/geom/_GG03.pyx":285
 * 
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 *         assert type(VPoly) is np.ndarray and VPoly.ndim==2 and VPoly.shape[0]==2, "Arg VPoly must be a (2,N) np.ndarray !"
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Test); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 285, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":286
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):
 *     if Test:
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"             # <<<<<<<<<<<<<<
 *         assert type(VPoly) is np.ndarray and VPoly.ndim==2 and VPoly.shape[0]==2, "Arg VPoly must be a (2,N) np.ndarray !"
 *         assert Lim is None or (hasattr(Lim,'__iter__') and len(Lim)==2) or (hasattr(Lim,'__iter__') and all([hasattr(ll,'__iter__') and len(ll)==2 for ll in Lim])), "Arg Lim must be a len()==2 iterable or a list of such !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_Pts)) == __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!__pyx_t_4) {
      } else {
        __pyx_t_5 = __pyx_t_4;
        goto __pyx_L6_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 286, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __pyx_t_4;
      __pyx_L6_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = (__pyx_t_5 != 0);
      __pyx_t_1 = __pyx_t_4;
      __pyx_L4_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_Pts_must_be_a_1D_or_2D_np_nd);
        __PYX_ERR(0, 286, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":287
 *     if Test:
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 *         assert type(VPoly) is np.ndarray and VPoly.ndim==2 and VPoly.shape[0]==2, "Arg VPoly must be a (2,N) np.ndarray !"             # <<<<<<<<<<<<<<
 *         assert Lim is None or (hasattr(Lim,'__iter__') and len(Lim)==2) or (hasattr(Lim,'__iter__') and all([hasattr(ll,'__iter__') and len(ll)==2 for ll in Lim])), "Arg Lim must be a len()==2 iterable or a list of such !"
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_VPoly)) == __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 287, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __pyx_t_5;
      __pyx_L8_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_VPoly_must_be_a_2_N_np_ndarr);
        __PYX_ERR(0, 287, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":288
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 *         assert type(VPoly) is np.ndarray and VPoly.ndim==2 and VPoly.shape[0]==2, "Arg VPoly must be a (2,N) np.ndarray !"
 *         assert Lim is None or (hasattr(Lim,'__iter__') and len(Lim)==2) or (hasattr(Lim,'__iter__') and all([hasattr(ll,'__iter__') and len(ll)==2 for ll in Lim])), "Arg Lim must be a len()==2 iterable or a list of such !"             # <<<<<<<<<<<<<<
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_5 = (__pyx_v_Lim == Py_None);
      __pyx_t_4 = (__pyx_t_5 != 0);
      if (!__pyx_t_4) {
      } else {
        __pyx_t_1 = __pyx_t_4;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_4 = __Pyx_HasAttr(__pyx_v_Lim, __pyx_n_s_iter); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 288, __pyx_L1_error)
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (!__pyx_t_5) {
        goto __pyx_L13_next_or;
      } else {
      }
      __pyx_t_6 = PyObject_Length(__pyx_v_Lim); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 288, __pyx_L1_error)
      __pyx_t_5 = ((__pyx_t_6 == 2) != 0);
      if (!__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_L13_next_or:;
      __pyx_t_5 = __Pyx_HasAttr(__pyx_v_Lim, __pyx_n_s_iter); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 288, __pyx_L1_error)
      __pyx_t_4 = (__pyx_t_5 != 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_1 = __pyx_t_4;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(PyList_CheckExact(__pyx_v_Lim)) || PyTuple_CheckExact(__pyx_v_Lim)) {
        __pyx_t_2 = __pyx_v_Lim; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
        __pyx_t_7 = NULL;
      } else {
        __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_Lim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_7)) {
          if (likely(PyList_CheckExact(__pyx_t_2))) {
            if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          } else {
            if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
            #else
            __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            #endif
          }
        } else {
          __pyx_t_8 = __pyx_t_7(__pyx_t_2);
          if (unlikely(!__pyx_t_8)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 288, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_8);
        }
        __Pyx_XDECREF_SET(__pyx_v_ll, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_4 = __Pyx_HasAttr(__pyx_v_ll, __pyx_n_s_iter); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 288, __pyx_L1_error)
        if (__pyx_t_4) {
        } else {
          __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_8 = __pyx_t_9;
          __pyx_t_9 = 0;
          goto __pyx_L18_bool_binop_done;
        }
        __pyx_t_10 = PyObject_Length(__pyx_v_ll); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 288, __pyx_L1_error)
        __pyx_t_4 = (__pyx_t_10 == 2);
        __pyx_t_9 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_8 = __pyx_t_9;
        __pyx_t_9 = 0;
        __pyx_L18_bool_binop_done:;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 288, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 288, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __pyx_t_4;
      __pyx_L11_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_Lim_must_be_a_len_2_iterable);
        __PYX_ERR(0, 288, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":289
 *         assert type(VPoly) is np.ndarray and VPoly.ndim==2 and VPoly.shape[0]==2, "Arg VPoly must be a (2,N) np.ndarray !"
 *         assert Lim is None or (hasattr(Lim,'__iter__') and len(Lim)==2) or (hasattr(Lim,'__iter__') and all([hasattr(ll,'__iter__') and len(ll)==2 for ll in Lim])), "Arg Lim must be a len()==2 iterable or a list of such !"
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"             # <<<<<<<<<<<<<<
 * 
 *     path = Path(VPoly.T)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_VType)) == ((PyObject *)(&PyString_Type)));
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L20_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VType, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_8) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 289, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_tor, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 289, __pyx_L1_error)
      if (!__pyx_t_4) {
      } else {
        __pyx_t_5 = __pyx_t_4;
        goto __pyx_L22_bool_binop_done;
      }
      __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_lin, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 289, __pyx_L1_error)
      __pyx_t_5 = __pyx_t_4;
      __pyx_L22_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = (__pyx_t_5 != 0);
      __pyx_t_1 = __pyx_t_4;
      __pyx_L20_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_VType_must_be_a_str_in_Tor_L);
        __PYX_ERR(0, 289, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":285
 * 
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 *         assert type(VPoly) is np.ndarray and VPoly.ndim==2 and VPoly.shape[0]==2, "Arg VPoly must be a (2,N) np.ndarray !"
 */
  }

  /* "tofu/geom/_GG03.pyx":291
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"
 * 
 *     path = Path(VPoly.T)             # <<<<<<<<<<<<<<
 *     if VType.lower()=='tor':
 *         if Lim is None:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_9) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_path = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":292
 * 
 *     path = Path(VPoly.T)
 *     if VType.lower()=='tor':             # <<<<<<<<<<<<<<
 *         if Lim is None:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z)')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VType, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_11) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_tor, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 292, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":293
 *     path = Path(VPoly.T)
 *     if VType.lower()=='tor':
 *         if Lim is None:             # <<<<<<<<<<<<<<
 *             pts = CoordShift(Pts, In=In, Out='(R,Z)')
 *             ind = Path(VPoly.T).contains_points(pts.T, transform=None, radius=0.0)
 */
    __pyx_t_1 = (__pyx_v_Lim == Py_None);
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "tofu/geom/_GG03.pyx":294
 *     if VType.lower()=='tor':
 *         if Lim is None:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z)')             # <<<<<<<<<<<<<<
 *             ind = Path(VPoly.T).contains_points(pts.T, transform=None, radius=0.0)
 *         else:
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_CoordShift); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_Pts);
      __Pyx_GIVEREF(__pyx_v_Pts);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_Pts);
      __pyx_t_11 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_In, __pyx_v_In) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_Out, __pyx_kp_s_R_Z) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_v_pts = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":295
 *         if Lim is None:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z)')
 *             ind = Path(VPoly.T).contains_points(pts.T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *         else:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z,Phi)')
 */
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_pts, __pyx_n_s_T); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_v_ind = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":293
 *     path = Path(VPoly.T)
 *     if VType.lower()=='tor':
 *         if Lim is None:             # <<<<<<<<<<<<<<
 *             pts = CoordShift(Pts, In=In, Out='(R,Z)')
 *             ind = Path(VPoly.T).contains_points(pts.T, transform=None, radius=0.0)
 */
      goto __pyx_L25;
    }

    /* "tofu/geom/_GG03.pyx":297
 *             ind = Path(VPoly.T).contains_points(pts.T, transform=None, radius=0.0)
 *         else:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z,Phi)')             # <<<<<<<<<<<<<<
 *             ind0 = Path(VPoly.T).contains_points(pts[:2,:].T, transform=None, radius=0.0)
 *             if hasattr(Lim[0],'__iter__'):
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_CoordShift); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_Pts);
      __Pyx_GIVEREF(__pyx_v_Pts);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_Pts);
      __pyx_t_9 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_In, __pyx_v_In) < 0) __PYX_ERR(0, 297, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_Out, __pyx_kp_s_R_Z_Phi) < 0) __PYX_ERR(0, 297, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 297, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_pts = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "tofu/geom/_GG03.pyx":298
 *         else:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z,Phi)')
 *             ind0 = Path(VPoly.T).contains_points(pts[:2,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if hasattr(Lim[0],'__iter__'):
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 298, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_8};
          __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 298, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_8};
          __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 298, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 298, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__66); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_T); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 298, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 298, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 298, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_ind0 = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":299
 *             pts = CoordShift(Pts, In=In, Out='(R,Z,Phi)')
 *             ind0 = Path(VPoly.T).contains_points(pts[:2,:].T, transform=None, radius=0.0)
 *             if hasattr(Lim[0],'__iter__'):             # <<<<<<<<<<<<<<
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *                 for ii in range(0,len(Lim)):
 */
      __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 299, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_HasAttr(__pyx_t_8, __pyx_n_s_iter); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 299, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_1 = (__pyx_t_4 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":300
 *             ind0 = Path(VPoly.T).contains_points(pts[:2,:].T, transform=None, radius=0.0)
 *             if hasattr(Lim[0],'__iter__'):
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)             # <<<<<<<<<<<<<<
 *                 for ii in range(0,len(Lim)):
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]
 */
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_6 = PyObject_Length(__pyx_v_Lim); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 300, __pyx_L1_error)
        __pyx_t_8 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
        __pyx_t_8 = 0;
        __pyx_t_9 = 0;
        __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)) < 0) __PYX_ERR(0, 300, __pyx_L1_error)
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 300, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_v_ind = __pyx_t_8;
        __pyx_t_8 = 0;

        /* "tofu/geom/_GG03.pyx":301
 *             if hasattr(Lim[0],'__iter__'):
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *                 for ii in range(0,len(Lim)):             # <<<<<<<<<<<<<<
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]
 *                     if lim[0]<lim[1]:
 */
        __pyx_t_6 = PyObject_Length(__pyx_v_Lim); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 301, __pyx_L1_error)
        for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) {
          __pyx_v_ii = __pyx_t_10;

          /* "tofu/geom/_GG03.pyx":302
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *                 for ii in range(0,len(Lim)):
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]             # <<<<<<<<<<<<<<
 *                     if lim[0]<lim[1]:
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])
 */
          __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_Lim, __pyx_v_ii, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_Lim, __pyx_v_ii, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyFloat_FromDouble(atan2(sin(__pyx_t_12), cos(__pyx_t_13))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_Lim, __pyx_v_ii, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, __pyx_v_ii, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_11 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyFloat_FromDouble(atan2(sin(__pyx_t_13), cos(__pyx_t_12))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_8);
          PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_11);
          PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
          __pyx_t_8 = 0;
          __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_lim, ((PyObject*)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":303
 *                 for ii in range(0,len(Lim)):
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]
 *                     if lim[0]<lim[1]:             # <<<<<<<<<<<<<<
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])
 *                     else:
 */
          __pyx_t_9 = __Pyx_GetItemInt_List(__pyx_v_lim, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_11 = __Pyx_GetItemInt_List(__pyx_v_lim, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 303, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 303, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":304
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]
 *                     if lim[0]<lim[1]:
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])             # <<<<<<<<<<<<<<
 *                     else:
 *                         ind[ii,:] = ind0 & ((pts[2,:]>=lim[0]) | (pts[2,:]<=lim[1]))
 */
            __pyx_t_8 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__68); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_11 = __Pyx_GetItemInt_List(__pyx_v_lim, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_11, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_11 = PyNumber_And(__pyx_v_ind0, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_9 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__70); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_lim, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_8, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = PyNumber_And(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_ii); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
            __Pyx_INCREF(__pyx_slice__71);
            __Pyx_GIVEREF(__pyx_slice__71);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_slice__71);
            __pyx_t_3 = 0;
            if (unlikely(PyObject_SetItem(__pyx_v_ind, __pyx_t_11, __pyx_t_8) < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "tofu/geom/_GG03.pyx":303
 *                 for ii in range(0,len(Lim)):
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]
 *                     if lim[0]<lim[1]:             # <<<<<<<<<<<<<<
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])
 *                     else:
 */
            goto __pyx_L29;
          }

          /* "tofu/geom/_GG03.pyx":306
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])
 *                     else:
 *                         ind[ii,:] = ind0 & ((pts[2,:]>=lim[0]) | (pts[2,:]<=lim[1]))             # <<<<<<<<<<<<<<
 *             else:
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]
 */
          /*else*/ {
            __pyx_t_8 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__73); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_11 = __Pyx_GetItemInt_List(__pyx_v_lim, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_3 = PyObject_RichCompare(__pyx_t_8, __pyx_t_11, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_11 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__75); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __pyx_t_8 = __Pyx_GetItemInt_List(__pyx_v_lim, 1, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, __pyx_t_8, Py_LE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = PyNumber_Or(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_9 = PyNumber_And(__pyx_v_ind0, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_ii); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_8);
            PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
            __Pyx_INCREF(__pyx_slice__76);
            __Pyx_GIVEREF(__pyx_slice__76);
            PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__76);
            __pyx_t_8 = 0;
            if (unlikely(PyObject_SetItem(__pyx_v_ind, __pyx_t_3, __pyx_t_9) < 0)) __PYX_ERR(0, 306, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
          __pyx_L29:;
        }

        /* "tofu/geom/_GG03.pyx":299
 *             pts = CoordShift(Pts, In=In, Out='(R,Z,Phi)')
 *             ind0 = Path(VPoly.T).contains_points(pts[:2,:].T, transform=None, radius=0.0)
 *             if hasattr(Lim[0],'__iter__'):             # <<<<<<<<<<<<<<
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *                 for ii in range(0,len(Lim)):
 */
        goto __pyx_L26;
      }

      /* "tofu/geom/_GG03.pyx":308
 *                         ind[ii,:] = ind0 & ((pts[2,:]>=lim[0]) | (pts[2,:]<=lim[1]))
 *             else:
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]             # <<<<<<<<<<<<<<
 *                 if Lim[0]<Lim[1]:
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyFloat_FromDouble(atan2(sin(__pyx_t_12), cos(__pyx_t_13))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyFloat_FromDouble(atan2(sin(__pyx_t_13), cos(__pyx_t_12))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 308, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_9);
        PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
        __pyx_t_9 = 0;
        __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_Lim, __pyx_t_8);
        __pyx_t_8 = 0;

        /* "tofu/geom/_GG03.pyx":309
 *             else:
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]
 *                 if Lim[0]<Lim[1]:             # <<<<<<<<<<<<<<
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])
 *                 else:
 */
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 309, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 309, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 309, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":310
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]
 *                 if Lim[0]<Lim[1]:
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])             # <<<<<<<<<<<<<<
 *                 else:
 *                     ind = ind0 & ((pts[2,:]>=Lim[0]) | (pts[2,:]<=Lim[1]))
 */
          __pyx_t_9 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__78); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = PyNumber_And(__pyx_v_ind0, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__80); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_11 = PyObject_RichCompare(__pyx_t_8, __pyx_t_9, Py_LE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyNumber_And(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_v_ind = __pyx_t_9;
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":309
 *             else:
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]
 *                 if Lim[0]<Lim[1]:             # <<<<<<<<<<<<<<
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])
 *                 else:
 */
          goto __pyx_L30;
        }

        /* "tofu/geom/_GG03.pyx":312
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])
 *                 else:
 *                     ind = ind0 & ((pts[2,:]>=Lim[0]) | (pts[2,:]<=Lim[1]))             # <<<<<<<<<<<<<<
 *     else:
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')
 */
        /*else*/ {
          __pyx_t_9 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__82); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__84); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_8 = PyObject_RichCompare(__pyx_t_11, __pyx_t_9, Py_LE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyNumber_Or(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyNumber_And(__pyx_v_ind0, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 312, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_ind = __pyx_t_8;
          __pyx_t_8 = 0;
        }
        __pyx_L30:;
      }
      __pyx_L26:;
    }
    __pyx_L25:;

    /* "tofu/geom/_GG03.pyx":292
 * 
 *     path = Path(VPoly.T)
 *     if VType.lower()=='tor':             # <<<<<<<<<<<<<<
 *         if Lim is None:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z)')
 */
    goto __pyx_L24;
  }

  /* "tofu/geom/_GG03.pyx":314
 *                     ind = ind0 & ((pts[2,:]>=Lim[0]) | (pts[2,:]<=Lim[1]))
 *     else:
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')             # <<<<<<<<<<<<<<
 *         ind0 = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *         if hasattr(Lim[0],'__iter__'):
 */
  /*else*/ {
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_CoordShift); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_Pts);
    __Pyx_GIVEREF(__pyx_v_Pts);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_Pts);
    __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_In, __pyx_v_In) < 0) __PYX_ERR(0, 314, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Out, __pyx_kp_s_X_Y_Z) < 0) __PYX_ERR(0, 314, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_pts = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "tofu/geom/_GG03.pyx":315
 *     else:
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')
 *         ind0 = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *         if hasattr(Lim[0],'__iter__'):
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_11);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
        __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
        __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__87); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 315, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 315, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 315, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_ind0 = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":316
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')
 *         ind0 = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *         if hasattr(Lim[0],'__iter__'):             # <<<<<<<<<<<<<<
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *             for ii in range(0,len(Lim)):
 */
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_HasAttr(__pyx_t_9, __pyx_n_s_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 316, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_4 = (__pyx_t_1 != 0);
    if (__pyx_t_4) {

      /* "tofu/geom/_GG03.pyx":317
 *         ind0 = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *         if hasattr(Lim[0],'__iter__'):
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)             # <<<<<<<<<<<<<<
 *             for ii in range(0,len(Lim)):
 *                 ind[ii,:] = ind0 & (pts[0,:]>=Lim[ii][0]) & (pts[0,:]<=Lim[ii][1])
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = PyObject_Length(__pyx_v_Lim); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 317, __pyx_L1_error)
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_11, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_3);
      __pyx_t_9 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)) < 0) __PYX_ERR(0, 317, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_v_ind = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "tofu/geom/_GG03.pyx":318
 *         if hasattr(Lim[0],'__iter__'):
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *             for ii in range(0,len(Lim)):             # <<<<<<<<<<<<<<
 *                 ind[ii,:] = ind0 & (pts[0,:]>=Lim[ii][0]) & (pts[0,:]<=Lim[ii][1])
 *         else:
 */
      __pyx_t_6 = PyObject_Length(__pyx_v_Lim); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 318, __pyx_L1_error)
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) {
        __pyx_v_ii = __pyx_t_10;

        /* "tofu/geom/_GG03.pyx":319
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *             for ii in range(0,len(Lim)):
 *                 ind[ii,:] = ind0 & (pts[0,:]>=Lim[ii][0]) & (pts[0,:]<=Lim[ii][1])             # <<<<<<<<<<<<<<
 *         else:
 *             ind = ind0 & (pts[0,:]>=Lim[0]) & (pts[0,:]<=Lim[1])
 */
        __pyx_t_9 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__89); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_Lim, __pyx_v_ii, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_11, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_And(__pyx_v_ind0, __pyx_t_11); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__91); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_Lim, __pyx_v_ii, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_And(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_ii); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
        __Pyx_INCREF(__pyx_slice__92);
        __Pyx_GIVEREF(__pyx_slice__92);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__92);
        __pyx_t_9 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_ind, __pyx_t_3, __pyx_t_2) < 0)) __PYX_ERR(0, 319, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }

      /* "tofu/geom/_GG03.pyx":316
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')
 *         ind0 = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *         if hasattr(Lim[0],'__iter__'):             # <<<<<<<<<<<<<<
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *             for ii in range(0,len(Lim)):
 */
      goto __pyx_L31;
    }

    /* "tofu/geom/_GG03.pyx":321
 *                 ind[ii,:] = ind0 & (pts[0,:]>=Lim[ii][0]) & (pts[0,:]<=Lim[ii][1])
 *         else:
 *             ind = ind0 & (pts[0,:]>=Lim[0]) & (pts[0,:]<=Lim[1])             # <<<<<<<<<<<<<<
 *     return ind
 * 
 */
    /*else*/ {
      __pyx_t_2 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__94); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_And(__pyx_v_ind0, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__96); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_t_2, Py_LE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_And(__pyx_t_3, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_v_ind = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_L31:;
  }
  __pyx_L24:;

  /* "tofu/geom/_GG03.pyx":322
 *         else:
 *             ind = ind0 & (pts[0,:]>=Lim[0]) & (pts[0,:]<=Lim[1])
 *     return ind             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ind);
  __pyx_r = __pyx_v_ind;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":284
 * ########################################################
 * 
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):             # <<<<<<<<<<<<<<
 *     if Test:
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_isInside", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_pts);
  __Pyx_XDECREF(__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_ind0);
  __Pyx_XDECREF(__pyx_v_lim);
  __Pyx_XDECREF(__pyx_v_ll);
  __Pyx_XDECREF(__pyx_v_Lim);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":338
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_mesh_dlfromL_cython(double[::1] LMinMax, double dL, DL=None, Lim=True, dLMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     """ Get the actual reolution from the desired resolution and MinMax and limits """
 *     # Get the number of mesh elements in LMinMax
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_15_Ves_mesh_dlfromL_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_14_Ves_mesh_dlfromL_cython[] = " Get the actual reolution from the desired resolution and MinMax and limits ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_15_Ves_mesh_dlfromL_cython = {"_Ves_mesh_dlfromL_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_15_Ves_mesh_dlfromL_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_14_Ves_mesh_dlfromL_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_15_Ves_mesh_dlfromL_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_LMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dL;
  PyObject *__pyx_v_DL = 0;
  PyObject *__pyx_v_Lim = 0;
  PyObject *__pyx_v_dLMode = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_mesh_dlfromL_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_LMinMax,&__pyx_n_s_dL,&__pyx_n_s_DL,&__pyx_n_s_Lim,&__pyx_n_s_dLMode,&__pyx_n_s_margin,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)__pyx_n_s_abs);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LMinMax)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_mesh_dlfromL_cython", 0, 2, 6, 1); __PYX_ERR(0, 338, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DL);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Lim);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dLMode);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_mesh_dlfromL_cython") < 0)) __PYX_ERR(0, 338, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_LMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_LMinMax.memview)) __PYX_ERR(0, 338, __pyx_L3_error)
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L3_error)
    __pyx_v_DL = values[2];
    __pyx_v_Lim = values[3];
    __pyx_v_dLMode = values[4];
    if (values[5]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_mesh_dlfromL_cython", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 338, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_mesh_dlfromL_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_14_Ves_mesh_dlfromL_cython(__pyx_self, __pyx_v_LMinMax, __pyx_v_dL, __pyx_v_DL, __pyx_v_Lim, __pyx_v_dLMode, __pyx_v_margin);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_14_Ves_mesh_dlfromL_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_LMinMax, double __pyx_v_dL, PyObject *__pyx_v_DL, PyObject *__pyx_v_Lim, PyObject *__pyx_v_dLMode, double __pyx_v_margin) {
  double __pyx_v_N;
  double __pyx_v_dLr;
  __Pyx_memviewslice __pyx_v_DLc = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_L = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_indL = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_abs0;
  double __pyx_v_abs1;
  int __pyx_v_nL0;
  int __pyx_v_nL1;
  int __pyx_v_Nind;
  int __pyx_v_ii;
  int __pyx_v_jj;
  PyObject *__pyx_v_dl = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __Pyx_memviewslice __pyx_t_30 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_31 = NULL;
  int __pyx_t_32;
  int __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  PyObject *__pyx_t_37 = NULL;
  PyObject *__pyx_t_38 = NULL;
  __Pyx_RefNannySetupContext("_Ves_mesh_dlfromL_cython", 0);

  /* "tofu/geom/_GG03.pyx":342
 *     # Get the number of mesh elements in LMinMax
 *     cdef double N
 *     if dLMode.lower()=='abs':             # <<<<<<<<<<<<<<
 *         N = Cceil((LMinMax[1]-LMinMax[0])/dL)
 *     else:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dLMode, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_abs, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "tofu/geom/_GG03.pyx":343
 *     cdef double N
 *     if dLMode.lower()=='abs':
 *         N = Cceil((LMinMax[1]-LMinMax[0])/dL)             # <<<<<<<<<<<<<<
 *     else:
 *         N = Cceil(1./dL)
 */
    __pyx_t_5 = 1;
    __pyx_t_6 = 0;
    __pyx_v_N = ceil((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_5)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_6)) )))) / __pyx_v_dL));

    /* "tofu/geom/_GG03.pyx":342
 *     # Get the number of mesh elements in LMinMax
 *     cdef double N
 *     if dLMode.lower()=='abs':             # <<<<<<<<<<<<<<
 *         N = Cceil((LMinMax[1]-LMinMax[0])/dL)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":345
 *         N = Cceil((LMinMax[1]-LMinMax[0])/dL)
 *     else:
 *         N = Cceil(1./dL)             # <<<<<<<<<<<<<<
 *     # Derive the real (effective) resolution
 *     cdef double dLr = (LMinMax[1]-LMinMax[0])/N
 */
  /*else*/ {
    __pyx_v_N = ceil((1. / __pyx_v_dL));
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":347
 *         N = Cceil(1./dL)
 *     # Derive the real (effective) resolution
 *     cdef double dLr = (LMinMax[1]-LMinMax[0])/N             # <<<<<<<<<<<<<<
 *     # Get desired limits if any
 *     cdef double[::1] DLc, L
 */
  __pyx_t_7 = 1;
  __pyx_t_8 = 0;
  __pyx_v_dLr = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_7)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_8)) )))) / __pyx_v_N);

  /* "tofu/geom/_GG03.pyx":355
 *     cdef int nL0, nL1, Nind, ii, jj
 *     cdef list dl
 *     if DL is None:             # <<<<<<<<<<<<<<
 *         DLc = LMinMax
 *     else:
 */
  __pyx_t_4 = (__pyx_v_DL == Py_None);
  __pyx_t_9 = (__pyx_t_4 != 0);
  if (__pyx_t_9) {

    /* "tofu/geom/_GG03.pyx":356
 *     cdef list dl
 *     if DL is None:
 *         DLc = LMinMax             # <<<<<<<<<<<<<<
 *     else:
 *         dl = list(DL)
 */
    __PYX_INC_MEMVIEW(&__pyx_v_LMinMax, 0);
    __pyx_v_DLc = __pyx_v_LMinMax;

    /* "tofu/geom/_GG03.pyx":355
 *     cdef int nL0, nL1, Nind, ii, jj
 *     cdef list dl
 *     if DL is None:             # <<<<<<<<<<<<<<
 *         DLc = LMinMax
 *     else:
 */
    goto __pyx_L4;
  }

  /* "tofu/geom/_GG03.pyx":358
 *         DLc = LMinMax
 *     else:
 *         dl = list(DL)             # <<<<<<<<<<<<<<
 *         if dl[0] is None:
 *             dl[0] = LMinMax[0]
 */
  /*else*/ {
    __pyx_t_1 = PySequence_List(__pyx_v_DL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_dl = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":359
 *     else:
 *         dl = list(DL)
 *         if dl[0] is None:             # <<<<<<<<<<<<<<
 *             dl[0] = LMinMax[0]
 *         if dl[1] is None:
 */
    __pyx_t_9 = (PyList_GET_ITEM(__pyx_v_dl, 0) == Py_None);
    __pyx_t_4 = (__pyx_t_9 != 0);
    if (__pyx_t_4) {

      /* "tofu/geom/_GG03.pyx":360
 *         dl = list(DL)
 *         if dl[0] is None:
 *             dl[0] = LMinMax[0]             # <<<<<<<<<<<<<<
 *         if dl[1] is None:
 *             dl[1] = LMinMax[1]
 */
      __pyx_t_10 = 0;
      __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_10)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_SetItemInt(__pyx_v_dl, 0, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":359
 *     else:
 *         dl = list(DL)
 *         if dl[0] is None:             # <<<<<<<<<<<<<<
 *             dl[0] = LMinMax[0]
 *         if dl[1] is None:
 */
    }

    /* "tofu/geom/_GG03.pyx":361
 *         if dl[0] is None:
 *             dl[0] = LMinMax[0]
 *         if dl[1] is None:             # <<<<<<<<<<<<<<
 *             dl[1] = LMinMax[1]
 *         if Lim and dl[0]<=LMinMax[0]:
 */
    __pyx_t_4 = (PyList_GET_ITEM(__pyx_v_dl, 1) == Py_None);
    __pyx_t_9 = (__pyx_t_4 != 0);
    if (__pyx_t_9) {

      /* "tofu/geom/_GG03.pyx":362
 *             dl[0] = LMinMax[0]
 *         if dl[1] is None:
 *             dl[1] = LMinMax[1]             # <<<<<<<<<<<<<<
 *         if Lim and dl[0]<=LMinMax[0]:
 *             dl[0] = LMinMax[0]
 */
      __pyx_t_11 = 1;
      __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_11)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_SetItemInt(__pyx_v_dl, 1, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 362, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":361
 *         if dl[0] is None:
 *             dl[0] = LMinMax[0]
 *         if dl[1] is None:             # <<<<<<<<<<<<<<
 *             dl[1] = LMinMax[1]
 *         if Lim and dl[0]<=LMinMax[0]:
 */
    }

    /* "tofu/geom/_GG03.pyx":363
 *         if dl[1] is None:
 *             dl[1] = LMinMax[1]
 *         if Lim and dl[0]<=LMinMax[0]:             # <<<<<<<<<<<<<<
 *             dl[0] = LMinMax[0]
 *         if Lim and dl[1]>=LMinMax[1]:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_Lim); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 363, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_9 = __pyx_t_4;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_12 = 0;
    __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_12)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_RichCompare(PyList_GET_ITEM(__pyx_v_dl, 0), __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 363, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __pyx_t_4;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_9) {

      /* "tofu/geom/_GG03.pyx":364
 *             dl[1] = LMinMax[1]
 *         if Lim and dl[0]<=LMinMax[0]:
 *             dl[0] = LMinMax[0]             # <<<<<<<<<<<<<<
 *         if Lim and dl[1]>=LMinMax[1]:
 *             dl[1] = LMinMax[1]
 */
      __pyx_t_13 = 0;
      __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_13)) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(__Pyx_SetItemInt(__pyx_v_dl, 0, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 364, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":363
 *         if dl[1] is None:
 *             dl[1] = LMinMax[1]
 *         if Lim and dl[0]<=LMinMax[0]:             # <<<<<<<<<<<<<<
 *             dl[0] = LMinMax[0]
 *         if Lim and dl[1]>=LMinMax[1]:
 */
    }

    /* "tofu/geom/_GG03.pyx":365
 *         if Lim and dl[0]<=LMinMax[0]:
 *             dl[0] = LMinMax[0]
 *         if Lim and dl[1]>=LMinMax[1]:             # <<<<<<<<<<<<<<
 *             dl[1] = LMinMax[1]
 *         DLc = np.array(dl)
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_Lim); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 365, __pyx_L1_error)
    if (__pyx_t_4) {
    } else {
      __pyx_t_9 = __pyx_t_4;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_14 = 1;
    __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_14)) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_RichCompare(PyList_GET_ITEM(__pyx_v_dl, 1), __pyx_t_2, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 365, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = __pyx_t_4;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_9) {

      /* "tofu/geom/_GG03.pyx":366
 *             dl[0] = LMinMax[0]
 *         if Lim and dl[1]>=LMinMax[1]:
 *             dl[1] = LMinMax[1]             # <<<<<<<<<<<<<<
 *         DLc = np.array(dl)
 * 
 */
      __pyx_t_15 = 1;
      __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_15)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (unlikely(__Pyx_SetItemInt(__pyx_v_dl, 1, __pyx_t_1, long, 1, __Pyx_PyInt_From_long, 1, 0, 0) < 0)) __PYX_ERR(0, 366, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":365
 *         if Lim and dl[0]<=LMinMax[0]:
 *             dl[0] = LMinMax[0]
 *         if Lim and dl[1]>=LMinMax[1]:             # <<<<<<<<<<<<<<
 *             dl[1] = LMinMax[1]
 *         DLc = np.array(dl)
 */
    }

    /* "tofu/geom/_GG03.pyx":367
 *         if Lim and dl[1]>=LMinMax[1]:
 *             dl[1] = LMinMax[1]
 *         DLc = np.array(dl)             # <<<<<<<<<<<<<<
 * 
 *     # Get the extreme indices of the mesh elements that really need to be created within those limits
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_dl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_dl};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_dl};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_v_dl);
        __Pyx_GIVEREF(__pyx_v_dl);
        PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_v_dl);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 367, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
    if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 367, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_DLc = __pyx_t_17;
    __pyx_t_17.memview = NULL;
    __pyx_t_17.data = NULL;
  }
  __pyx_L4:;

  /* "tofu/geom/_GG03.pyx":370
 * 
 *     # Get the extreme indices of the mesh elements that really need to be created within those limits
 *     abs0 = Cabs(DLc[0]-LMinMax[0])             # <<<<<<<<<<<<<<
 *     if abs0-dLr*Cfloor(abs0/dLr)<margin*dLr:
 *         nL0 = int(Cround((DLc[0]-LMinMax[0])/dLr))
 */
  __pyx_t_18 = 0;
  __pyx_t_19 = 0;
  __pyx_v_abs0 = fabs(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_DLc.data) + __pyx_t_18)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_19)) )))));

  /* "tofu/geom/_GG03.pyx":371
 *     # Get the extreme indices of the mesh elements that really need to be created within those limits
 *     abs0 = Cabs(DLc[0]-LMinMax[0])
 *     if abs0-dLr*Cfloor(abs0/dLr)<margin*dLr:             # <<<<<<<<<<<<<<
 *         nL0 = int(Cround((DLc[0]-LMinMax[0])/dLr))
 *     else:
 */
  __pyx_t_9 = (((__pyx_v_abs0 - (__pyx_v_dLr * floor((__pyx_v_abs0 / __pyx_v_dLr)))) < (__pyx_v_margin * __pyx_v_dLr)) != 0);
  if (__pyx_t_9) {

    /* "tofu/geom/_GG03.pyx":372
 *     abs0 = Cabs(DLc[0]-LMinMax[0])
 *     if abs0-dLr*Cfloor(abs0/dLr)<margin*dLr:
 *         nL0 = int(Cround((DLc[0]-LMinMax[0])/dLr))             # <<<<<<<<<<<<<<
 *     else:
 *         nL0 = int(Cfloor((DLc[0]-LMinMax[0])/dLr))
 */
    __pyx_t_20 = 0;
    __pyx_t_21 = 0;
    __pyx_v_nL0 = ((int)round((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_DLc.data) + __pyx_t_20)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_21)) )))) / __pyx_v_dLr)));

    /* "tofu/geom/_GG03.pyx":371
 *     # Get the extreme indices of the mesh elements that really need to be created within those limits
 *     abs0 = Cabs(DLc[0]-LMinMax[0])
 *     if abs0-dLr*Cfloor(abs0/dLr)<margin*dLr:             # <<<<<<<<<<<<<<
 *         nL0 = int(Cround((DLc[0]-LMinMax[0])/dLr))
 *     else:
 */
    goto __pyx_L13;
  }

  /* "tofu/geom/_GG03.pyx":374
 *         nL0 = int(Cround((DLc[0]-LMinMax[0])/dLr))
 *     else:
 *         nL0 = int(Cfloor((DLc[0]-LMinMax[0])/dLr))             # <<<<<<<<<<<<<<
 *     abs1 = Cabs(DLc[1]-LMinMax[0])
 *     if abs1-dLr*Cfloor(abs1/dLr)<margin*dLr:
 */
  /*else*/ {
    __pyx_t_22 = 0;
    __pyx_t_23 = 0;
    __pyx_v_nL0 = ((int)floor((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_DLc.data) + __pyx_t_22)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_23)) )))) / __pyx_v_dLr)));
  }
  __pyx_L13:;

  /* "tofu/geom/_GG03.pyx":375
 *     else:
 *         nL0 = int(Cfloor((DLc[0]-LMinMax[0])/dLr))
 *     abs1 = Cabs(DLc[1]-LMinMax[0])             # <<<<<<<<<<<<<<
 *     if abs1-dLr*Cfloor(abs1/dLr)<margin*dLr:
 *         nL1 = int(Cround((DLc[1]-LMinMax[0])/dLr)-1)
 */
  __pyx_t_24 = 1;
  __pyx_t_25 = 0;
  __pyx_v_abs1 = fabs(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_DLc.data) + __pyx_t_24)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_25)) )))));

  /* "tofu/geom/_GG03.pyx":376
 *         nL0 = int(Cfloor((DLc[0]-LMinMax[0])/dLr))
 *     abs1 = Cabs(DLc[1]-LMinMax[0])
 *     if abs1-dLr*Cfloor(abs1/dLr)<margin*dLr:             # <<<<<<<<<<<<<<
 *         nL1 = int(Cround((DLc[1]-LMinMax[0])/dLr)-1)
 *     else:
 */
  __pyx_t_9 = (((__pyx_v_abs1 - (__pyx_v_dLr * floor((__pyx_v_abs1 / __pyx_v_dLr)))) < (__pyx_v_margin * __pyx_v_dLr)) != 0);
  if (__pyx_t_9) {

    /* "tofu/geom/_GG03.pyx":377
 *     abs1 = Cabs(DLc[1]-LMinMax[0])
 *     if abs1-dLr*Cfloor(abs1/dLr)<margin*dLr:
 *         nL1 = int(Cround((DLc[1]-LMinMax[0])/dLr)-1)             # <<<<<<<<<<<<<<
 *     else:
 *         nL1 = int(Cfloor((DLc[1]-LMinMax[0])/dLr))
 */
    __pyx_t_26 = 1;
    __pyx_t_27 = 0;
    __pyx_v_nL1 = ((int)(round((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_DLc.data) + __pyx_t_26)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_27)) )))) / __pyx_v_dLr)) - 1.0));

    /* "tofu/geom/_GG03.pyx":376
 *         nL0 = int(Cfloor((DLc[0]-LMinMax[0])/dLr))
 *     abs1 = Cabs(DLc[1]-LMinMax[0])
 *     if abs1-dLr*Cfloor(abs1/dLr)<margin*dLr:             # <<<<<<<<<<<<<<
 *         nL1 = int(Cround((DLc[1]-LMinMax[0])/dLr)-1)
 *     else:
 */
    goto __pyx_L14;
  }

  /* "tofu/geom/_GG03.pyx":379
 *         nL1 = int(Cround((DLc[1]-LMinMax[0])/dLr)-1)
 *     else:
 *         nL1 = int(Cfloor((DLc[1]-LMinMax[0])/dLr))             # <<<<<<<<<<<<<<
 *     # Get the corresponding indices
 *     Nind = nL1+1-nL0
 */
  /*else*/ {
    __pyx_t_28 = 1;
    __pyx_t_29 = 0;
    __pyx_v_nL1 = ((int)floor((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_DLc.data) + __pyx_t_28)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_29)) )))) / __pyx_v_dLr)));
  }
  __pyx_L14:;

  /* "tofu/geom/_GG03.pyx":381
 *         nL1 = int(Cfloor((DLc[1]-LMinMax[0])/dLr))
 *     # Get the corresponding indices
 *     Nind = nL1+1-nL0             # <<<<<<<<<<<<<<
 *     indL = np.empty((Nind,),dtype=int)#np.linspace(nL0,nL1,Nind,endpoint=True)
 *     L = np.empty((Nind,))
 */
  __pyx_v_Nind = ((__pyx_v_nL1 + 1) - __pyx_v_nL0);

  /* "tofu/geom/_GG03.pyx":382
 *     # Get the corresponding indices
 *     Nind = nL1+1-nL0
 *     indL = np.empty((Nind,),dtype=int)#np.linspace(nL0,nL1,Nind,endpoint=True)             # <<<<<<<<<<<<<<
 *     L = np.empty((Nind,))
 *     for ii in range(0,Nind):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Nind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_16 = PyTuple_New(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  if (PyDict_SetItem(__pyx_t_16, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 382, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_30 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_30.memview)) __PYX_ERR(0, 382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_indL = __pyx_t_30;
  __pyx_t_30.memview = NULL;
  __pyx_t_30.data = NULL;

  /* "tofu/geom/_GG03.pyx":383
 *     Nind = nL1+1-nL0
 *     indL = np.empty((Nind,),dtype=int)#np.linspace(nL0,nL1,Nind,endpoint=True)
 *     L = np.empty((Nind,))             # <<<<<<<<<<<<<<
 *     for ii in range(0,Nind):
 *         jj = nL0+ii
 */
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_Nind); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16);
  __pyx_t_16 = 0;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_16) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_31 = PyTuple_New(1+1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_16); __pyx_t_16 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_31, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2);
  if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_L = __pyx_t_17;
  __pyx_t_17.memview = NULL;
  __pyx_t_17.data = NULL;

  /* "tofu/geom/_GG03.pyx":384
 *     indL = np.empty((Nind,),dtype=int)#np.linspace(nL0,nL1,Nind,endpoint=True)
 *     L = np.empty((Nind,))
 *     for ii in range(0,Nind):             # <<<<<<<<<<<<<<
 *         jj = nL0+ii
 *         indL[ii] = jj
 */
  __pyx_t_32 = __pyx_v_Nind;
  for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) {
    __pyx_v_ii = __pyx_t_33;

    /* "tofu/geom/_GG03.pyx":385
 *     L = np.empty((Nind,))
 *     for ii in range(0,Nind):
 *         jj = nL0+ii             # <<<<<<<<<<<<<<
 *         indL[ii] = jj
 *         L[ii] = LMinMax[0] + (0.5 + (<double>jj))*dLr
 */
    __pyx_v_jj = (__pyx_v_nL0 + __pyx_v_ii);

    /* "tofu/geom/_GG03.pyx":386
 *     for ii in range(0,Nind):
 *         jj = nL0+ii
 *         indL[ii] = jj             # <<<<<<<<<<<<<<
 *         L[ii] = LMinMax[0] + (0.5 + (<double>jj))*dLr
 *     return np.asarray(L), dLr, np.asarray(indL), <long>N
 */
    __pyx_t_34 = __pyx_v_ii;
    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_indL.data) + __pyx_t_34)) )) = __pyx_v_jj;

    /* "tofu/geom/_GG03.pyx":387
 *         jj = nL0+ii
 *         indL[ii] = jj
 *         L[ii] = LMinMax[0] + (0.5 + (<double>jj))*dLr             # <<<<<<<<<<<<<<
 *     return np.asarray(L), dLr, np.asarray(indL), <long>N
 * 
 */
    __pyx_t_35 = 0;
    __pyx_t_36 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_36)) )) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_35)) ))) + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dLr));
  }

  /* "tofu/geom/_GG03.pyx":388
 *         indL[ii] = jj
 *         L[ii] = LMinMax[0] + (0.5 + (<double>jj))*dLr
 *     return np.asarray(L), dLr, np.asarray(indL), <long>N             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_L, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_31))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_31);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_31);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_31, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_31, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_31)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_1};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_31, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_31)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_1};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_31, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_31, __pyx_t_16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
  __pyx_t_31 = PyFloat_FromDouble(__pyx_v_dLr); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_31);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_indL, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_37 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_37 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_37)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_37);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_37) {
    __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_16);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_37, __pyx_t_1};
      __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_37, __pyx_t_1};
      __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_37); __pyx_t_37 = 0;
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_38 = PyTuple_New(1+1); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_38);
      __Pyx_GIVEREF(__pyx_t_37); PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_37); __pyx_t_37 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_38, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_38, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_long(((long)__pyx_v_N)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_38 = PyTuple_New(4); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 388, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_38);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_31);
  PyTuple_SET_ITEM(__pyx_t_38, 1, __pyx_t_31);
  __Pyx_GIVEREF(__pyx_t_16);
  PyTuple_SET_ITEM(__pyx_t_38, 2, __pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_38, 3, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_31 = 0;
  __pyx_t_16 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_38;
  __pyx_t_38 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":338
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_mesh_dlfromL_cython(double[::1] LMinMax, double dL, DL=None, Lim=True, dLMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     """ Get the actual reolution from the desired resolution and MinMax and limits """
 *     # Get the number of mesh elements in LMinMax
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_16);
  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
  __Pyx_XDECREF(__pyx_t_31);
  __Pyx_XDECREF(__pyx_t_37);
  __Pyx_XDECREF(__pyx_t_38);
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_mesh_dlfromL_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_DLc, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_L, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indL, 1);
  __Pyx_XDECREF(__pyx_v_dl);
  __PYX_XDEC_MEMVIEW(&__pyx_v_LMinMax, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":399
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromD(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, D1=None, D2=None,str dSMode='abs', VPoly=None, double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_17_Ves_meshCross_FromD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_17_Ves_meshCross_FromD = {"_Ves_meshCross_FromD", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_17_Ves_meshCross_FromD, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_17_Ves_meshCross_FromD(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_MinMax1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_MinMax2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_d1;
  double __pyx_v_d2;
  PyObject *__pyx_v_D1 = 0;
  PyObject *__pyx_v_D2 = 0;
  PyObject *__pyx_v_dSMode = 0;
  PyObject *__pyx_v_VPoly = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_meshCross_FromD (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_MinMax1,&__pyx_n_s_MinMax2,&__pyx_n_s_d1,&__pyx_n_s_d2,&__pyx_n_s_D1,&__pyx_n_s_D2,&__pyx_n_s_dSMode,&__pyx_n_s_VPoly,&__pyx_n_s_margin,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject*)__pyx_n_s_abs);
    values[7] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_MinMax1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_MinMax2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromD", 0, 4, 9, 1); __PYX_ERR(0, 399, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromD", 0, 4, 9, 2); __PYX_ERR(0, 399, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromD", 0, 4, 9, 3); __PYX_ERR(0, 399, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_D1);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_D2);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dSMode);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_meshCross_FromD") < 0)) __PYX_ERR(0, 399, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_MinMax1 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_MinMax1.memview)) __PYX_ERR(0, 399, __pyx_L3_error)
    __pyx_v_MinMax2 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[1]); if (unlikely(!__pyx_v_MinMax2.memview)) __PYX_ERR(0, 399, __pyx_L3_error)
    __pyx_v_d1 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_d1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L3_error)
    __pyx_v_d2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_d2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L3_error)
    __pyx_v_D1 = values[4];
    __pyx_v_D2 = values[5];
    __pyx_v_dSMode = ((PyObject*)values[6]);
    __pyx_v_VPoly = values[7];
    if (values[8]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromD", 0, 4, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 399, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_meshCross_FromD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dSMode), (&PyString_Type), 1, "dSMode", 1))) __PYX_ERR(0, 399, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_16_Ves_meshCross_FromD(__pyx_self, __pyx_v_MinMax1, __pyx_v_MinMax2, __pyx_v_d1, __pyx_v_d2, __pyx_v_D1, __pyx_v_D2, __pyx_v_dSMode, __pyx_v_VPoly, __pyx_v_margin);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_16_Ves_meshCross_FromD(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_MinMax1, __Pyx_memviewslice __pyx_v_MinMax2, double __pyx_v_d1, double __pyx_v_d2, PyObject *__pyx_v_D1, PyObject *__pyx_v_D2, PyObject *__pyx_v_dSMode, PyObject *__pyx_v_VPoly, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_X1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_X2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ind1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ind2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED int __pyx_v_N1;
  CYTHON_UNUSED int __pyx_v_N2;
  int __pyx_v_n1;
  int __pyx_v_n2;
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_nn;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyArrayObject *__pyx_v_ind = 0;
  PyObject *__pyx_v_d1r = NULL;
  PyObject *__pyx_v_d2r = NULL;
  PyObject *__pyx_v_iin = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_10;
  size_t __pyx_t_11;
  size_t __pyx_t_12;
  PyArrayObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyArrayObject *__pyx_t_17 = NULL;
  PyArrayObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  int __pyx_t_20;
  int __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  int __pyx_t_31;
  int __pyx_t_32;
  __Pyx_RefNannySetupContext("_Ves_meshCross_FromD", 0);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;

  /* "tofu/geom/_GG03.pyx":408
 *     cdef cnp.ndarray[long,ndim=1] ind
 * 
 *     X1, d1r, ind1, N1 = _Ves_mesh_dlfromL_cython(MinMax1, d1, D1, Lim=True, dLMode=dSMode, margin=margin)             # <<<<<<<<<<<<<<
 *     X2, d2r, ind2, N2 = _Ves_mesh_dlfromL_cython(MinMax2, d2, D2, Lim=True, dLMode=dSMode, margin=margin)
 *     n1, n2 = len(X1), len(X2)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_MinMax1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_D1);
  __Pyx_GIVEREF(__pyx_v_D1);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_D1);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 408, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dLMode, __pyx_v_dSMode) < 0) __PYX_ERR(0, 408, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 408, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 408, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 408, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 408, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_3);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 408, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_X1 = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_d1r = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_ind1 = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_N1 = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":409
 * 
 *     X1, d1r, ind1, N1 = _Ves_mesh_dlfromL_cython(MinMax1, d1, D1, Lim=True, dLMode=dSMode, margin=margin)
 *     X2, d2r, ind2, N2 = _Ves_mesh_dlfromL_cython(MinMax2, d2, D2, Lim=True, dLMode=dSMode, margin=margin)             # <<<<<<<<<<<<<<
 *     n1, n2 = len(X1), len(X2)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_MinMax2, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_d2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_D2);
  __Pyx_GIVEREF(__pyx_v_D2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_D2);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dLMode, __pyx_v_dSMode) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_margin, __pyx_t_5) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 409, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 409, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 409, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 409, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 409, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_X2 = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_d2r = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_ind2 = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_N2 = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":410
 *     X1, d1r, ind1, N1 = _Ves_mesh_dlfromL_cython(MinMax1, d1, D1, Lim=True, dLMode=dSMode, margin=margin)
 *     X2, d2r, ind2, N2 = _Ves_mesh_dlfromL_cython(MinMax2, d2, D2, Lim=True, dLMode=dSMode, margin=margin)
 *     n1, n2 = len(X1), len(X2)             # <<<<<<<<<<<<<<
 * 
 *     Pts = np.empty((2,n1*n2))
 */
  __pyx_t_11 = __Pyx_MemoryView_Len(__pyx_v_X1); 
  __pyx_t_12 = __Pyx_MemoryView_Len(__pyx_v_X2); 
  __pyx_v_n1 = __pyx_t_11;
  __pyx_v_n2 = __pyx_t_12;

  /* "tofu/geom/_GG03.pyx":412
 *     n1, n2 = len(X1), len(X2)
 * 
 *     Pts = np.empty((2,n1*n2))             # <<<<<<<<<<<<<<
 *     dS = d1r*d2r*np.ones((n1*n2,))
 *     ind = np.empty((n1*n2,),dtype=int)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_n1 * __pyx_v_n2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 412, __pyx_L1_error)
  __pyx_t_13 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 412, __pyx_L1_error)
  }
  __pyx_t_13 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "tofu/geom/_GG03.pyx":413
 * 
 *     Pts = np.empty((2,n1*n2))
 *     dS = d1r*d2r*np.ones((n1*n2,))             # <<<<<<<<<<<<<<
 *     ind = np.empty((n1*n2,),dtype=int)
 *     for ii in range(0,n2):
 */
  __pyx_t_5 = PyNumber_Multiply(__pyx_v_d1r, __pyx_v_d2r); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_n1 * __pyx_v_n2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 413, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 413, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 413, __pyx_L1_error)
  __pyx_t_17 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
      }
      __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
    }
    __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 413, __pyx_L1_error)
  }
  __pyx_t_17 = 0;
  __pyx_v_dS = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":414
 *     Pts = np.empty((2,n1*n2))
 *     dS = d1r*d2r*np.ones((n1*n2,))
 *     ind = np.empty((n1*n2,),dtype=int)             # <<<<<<<<<<<<<<
 *     for ii in range(0,n2):
 *         for jj in range(0,n1):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_n1 * __pyx_v_n2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 414, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 414, __pyx_L1_error)
  __pyx_t_18 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 414, __pyx_L1_error)
  }
  __pyx_t_18 = 0;
  __pyx_v_ind = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "tofu/geom/_GG03.pyx":415
 *     dS = d1r*d2r*np.ones((n1*n2,))
 *     ind = np.empty((n1*n2,),dtype=int)
 *     for ii in range(0,n2):             # <<<<<<<<<<<<<<
 *         for jj in range(0,n1):
 *             nn = jj+n1*ii
 */
  __pyx_t_10 = __pyx_v_n2;
  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_10; __pyx_t_19+=1) {
    __pyx_v_ii = __pyx_t_19;

    /* "tofu/geom/_GG03.pyx":416
 *     ind = np.empty((n1*n2,),dtype=int)
 *     for ii in range(0,n2):
 *         for jj in range(0,n1):             # <<<<<<<<<<<<<<
 *             nn = jj+n1*ii
 *             Pts[0,nn] = X1[jj]
 */
    __pyx_t_20 = __pyx_v_n1;
    for (__pyx_t_21 = 0; __pyx_t_21 < __pyx_t_20; __pyx_t_21+=1) {
      __pyx_v_jj = __pyx_t_21;

      /* "tofu/geom/_GG03.pyx":417
 *     for ii in range(0,n2):
 *         for jj in range(0,n1):
 *             nn = jj+n1*ii             # <<<<<<<<<<<<<<
 *             Pts[0,nn] = X1[jj]
 *             Pts[1,nn] = X2[ii]
 */
      __pyx_v_nn = (__pyx_v_jj + (__pyx_v_n1 * __pyx_v_ii));

      /* "tofu/geom/_GG03.pyx":418
 *         for jj in range(0,n1):
 *             nn = jj+n1*ii
 *             Pts[0,nn] = X1[jj]             # <<<<<<<<<<<<<<
 *             Pts[1,nn] = X2[ii]
 *             ind[nn] = ind1[jj] + n1*ind2[ii]
 */
      __pyx_t_22 = __pyx_v_jj;
      __pyx_t_23 = 0;
      __pyx_t_24 = __pyx_v_nn;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_X1.data) + __pyx_t_22)) )));

      /* "tofu/geom/_GG03.pyx":419
 *             nn = jj+n1*ii
 *             Pts[0,nn] = X1[jj]
 *             Pts[1,nn] = X2[ii]             # <<<<<<<<<<<<<<
 *             ind[nn] = ind1[jj] + n1*ind2[ii]
 *     if VPoly is not None:
 */
      __pyx_t_25 = __pyx_v_ii;
      __pyx_t_26 = 1;
      __pyx_t_27 = __pyx_v_nn;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_X2.data) + __pyx_t_25)) )));

      /* "tofu/geom/_GG03.pyx":420
 *             Pts[0,nn] = X1[jj]
 *             Pts[1,nn] = X2[ii]
 *             ind[nn] = ind1[jj] + n1*ind2[ii]             # <<<<<<<<<<<<<<
 *     if VPoly is not None:
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 */
      __pyx_t_28 = __pyx_v_jj;
      __pyx_t_29 = __pyx_v_ii;
      __pyx_t_30 = __pyx_v_nn;
      *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ind.diminfo[0].strides) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind1.data) + __pyx_t_28)) ))) + (__pyx_v_n1 * (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind2.data) + __pyx_t_29)) )))));
    }
  }

  /* "tofu/geom/_GG03.pyx":421
 *             Pts[1,nn] = X2[ii]
 *             ind[nn] = ind1[jj] + n1*ind2[ii]
 *     if VPoly is not None:             # <<<<<<<<<<<<<<
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 *         if np.sum(iin)==1:
 */
  __pyx_t_31 = (__pyx_v_VPoly != Py_None);
  __pyx_t_32 = (__pyx_t_31 != 0);
  if (__pyx_t_32) {

    /* "tofu/geom/_GG03.pyx":422
 *             ind[nn] = ind1[jj] + n1*ind2[ii]
 *     if VPoly is not None:
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *         if np.sum(iin)==1:
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Pts), __pyx_n_s_T); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 422, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 422, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_v_iin = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":423
 *     if VPoly is not None:
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 *         if np.sum(iin)==1:             # <<<<<<<<<<<<<<
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]
 *         else:
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_iin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_iin};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_iin};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_v_iin);
        __Pyx_GIVEREF(__pyx_v_iin);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_iin);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_32 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 423, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_32) {

      /* "tofu/geom/_GG03.pyx":424
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 *         if np.sum(iin)==1:
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]             # <<<<<<<<<<<<<<
 *         else:
 *             Pts, dS, ind = Pts[:,iin], dS[iin], ind[iin]
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_slice__97);
      __Pyx_GIVEREF(__pyx_slice__97);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__97);
      __Pyx_INCREF(__pyx_v_iin);
      __Pyx_GIVEREF(__pyx_v_iin);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_iin);
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__99, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 424, __pyx_L1_error)
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_dS), __pyx_v_iin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 424, __pyx_L1_error)
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_iin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 424, __pyx_L1_error)
      __pyx_t_13 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
          }
          __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 424, __pyx_L1_error)
      }
      __pyx_t_13 = 0;
      __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;
      __pyx_t_17 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
        }
        __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 424, __pyx_L1_error)
      }
      __pyx_t_17 = 0;
      __Pyx_DECREF_SET(__pyx_v_dS, ((PyArrayObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_18 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
          }
          __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
        }
        __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 424, __pyx_L1_error)
      }
      __pyx_t_18 = 0;
      __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "tofu/geom/_GG03.pyx":423
 *     if VPoly is not None:
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 *         if np.sum(iin)==1:             # <<<<<<<<<<<<<<
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]
 *         else:
 */
      goto __pyx_L12;
    }

    /* "tofu/geom/_GG03.pyx":426
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]
 *         else:
 *             Pts, dS, ind = Pts[:,iin], dS[iin], ind[iin]             # <<<<<<<<<<<<<<
 *     return Pts, dS, ind, d1r, d2r
 * 
 */
    /*else*/ {
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_slice__100);
      __Pyx_GIVEREF(__pyx_slice__100);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_slice__100);
      __Pyx_INCREF(__pyx_v_iin);
      __Pyx_GIVEREF(__pyx_v_iin);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_iin);
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 426, __pyx_L1_error)
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_dS), __pyx_v_iin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 426, __pyx_L1_error)
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_iin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 426, __pyx_L1_error)
      __pyx_t_13 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
      }
      __pyx_t_13 = 0;
      __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_17 = ((PyArrayObject *)__pyx_t_5);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_16, &__pyx_t_15, &__pyx_t_14);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_16, __pyx_t_15, __pyx_t_14);
          }
          __pyx_t_16 = __pyx_t_15 = __pyx_t_14 = 0;
        }
        __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
      }
      __pyx_t_17 = 0;
      __Pyx_DECREF_SET(__pyx_v_dS, ((PyArrayObject *)__pyx_t_5));
      __pyx_t_5 = 0;
      __pyx_t_18 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
        __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_10 < 0)) {
          PyErr_Fetch(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_16);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_14, __pyx_t_15, __pyx_t_16);
          }
          __pyx_t_14 = __pyx_t_15 = __pyx_t_16 = 0;
        }
        __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 426, __pyx_L1_error)
      }
      __pyx_t_18 = 0;
      __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;
    }
    __pyx_L12:;

    /* "tofu/geom/_GG03.pyx":421
 *             Pts[1,nn] = X2[ii]
 *             ind[nn] = ind1[jj] + n1*ind2[ii]
 *     if VPoly is not None:             # <<<<<<<<<<<<<<
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 *         if np.sum(iin)==1:
 */
  }

  /* "tofu/geom/_GG03.pyx":427
 *         else:
 *             Pts, dS, ind = Pts[:,iin], dS[iin], ind[iin]
 *     return Pts, dS, ind, d1r, d2r             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(((PyObject *)__pyx_v_ind));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
  PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_ind));
  __Pyx_INCREF(__pyx_v_d1r);
  __Pyx_GIVEREF(__pyx_v_d1r);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_d1r);
  __Pyx_INCREF(__pyx_v_d2r);
  __Pyx_GIVEREF(__pyx_v_d2r);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_d2r);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":399
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromD(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, D1=None, D2=None,str dSMode='abs', VPoly=None, double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_meshCross_FromD", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_X1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_X2, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ind1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ind2, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_d1r);
  __Pyx_XDECREF(__pyx_v_d2r);
  __Pyx_XDECREF(__pyx_v_iin);
  __PYX_XDEC_MEMVIEW(&__pyx_v_MinMax1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_MinMax2, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":433
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromInd(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, long[::1] ind, str dSMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_19_Ves_meshCross_FromInd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_19_Ves_meshCross_FromInd = {"_Ves_meshCross_FromInd", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_19_Ves_meshCross_FromInd, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_19_Ves_meshCross_FromInd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_MinMax1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_MinMax2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_d1;
  double __pyx_v_d2;
  __Pyx_memviewslice __pyx_v_ind = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_dSMode = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_meshCross_FromInd (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_MinMax1,&__pyx_n_s_MinMax2,&__pyx_n_s_d1,&__pyx_n_s_d2,&__pyx_n_s_ind,&__pyx_n_s_dSMode,&__pyx_n_s_margin,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[5] = ((PyObject*)__pyx_n_s_abs);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_MinMax1)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_MinMax2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromInd", 0, 5, 7, 1); __PYX_ERR(0, 433, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromInd", 0, 5, 7, 2); __PYX_ERR(0, 433, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_d2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromInd", 0, 5, 7, 3); __PYX_ERR(0, 433, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromInd", 0, 5, 7, 4); __PYX_ERR(0, 433, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dSMode);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_meshCross_FromInd") < 0)) __PYX_ERR(0, 433, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_MinMax1 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_MinMax1.memview)) __PYX_ERR(0, 433, __pyx_L3_error)
    __pyx_v_MinMax2 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[1]); if (unlikely(!__pyx_v_MinMax2.memview)) __PYX_ERR(0, 433, __pyx_L3_error)
    __pyx_v_d1 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_d1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 433, __pyx_L3_error)
    __pyx_v_d2 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_d2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 433, __pyx_L3_error)
    __pyx_v_ind = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[4]); if (unlikely(!__pyx_v_ind.memview)) __PYX_ERR(0, 433, __pyx_L3_error)
    __pyx_v_dSMode = ((PyObject*)values[5]);
    if (values[6]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 433, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_meshCross_FromInd", 0, 5, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 433, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_meshCross_FromInd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dSMode), (&PyString_Type), 1, "dSMode", 1))) __PYX_ERR(0, 433, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_18_Ves_meshCross_FromInd(__pyx_self, __pyx_v_MinMax1, __pyx_v_MinMax2, __pyx_v_d1, __pyx_v_d2, __pyx_v_ind, __pyx_v_dSMode, __pyx_v_margin);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_18_Ves_meshCross_FromInd(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_MinMax1, __Pyx_memviewslice __pyx_v_MinMax2, double __pyx_v_d1, double __pyx_v_d2, __Pyx_memviewslice __pyx_v_ind, PyObject *__pyx_v_dSMode, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_X1 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_X2 = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_bla = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_N1;
  CYTHON_UNUSED int __pyx_v_N2;
  int __pyx_v_NP;
  int __pyx_v_ii;
  int __pyx_v_i1;
  int __pyx_v_i2;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyObject *__pyx_v_d1r = NULL;
  PyObject *__pyx_v_d2r = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyArrayObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  __Pyx_RefNannySetupContext("_Ves_meshCross_FromInd", 0);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;

  /* "tofu/geom/_GG03.pyx":437
 *     cdef double dX1, dX2
 *     cdef long[::1] bla
 *     cdef int N1, N2, NP=ind.size, ii, i1, i2             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] Pts
 *     cdef cnp.ndarray[double,ndim=1] dS
 */
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_ind, 1, (PyObject *(*)(char *)) __pyx_memview_get_long, (int (*)(char *, PyObject *)) __pyx_memview_set_long, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 437, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_NP = __pyx_t_3;

  /* "tofu/geom/_GG03.pyx":441
 *     cdef cnp.ndarray[double,ndim=1] dS
 * 
 *     X1, d1r, bla, N1 = _Ves_mesh_dlfromL_cython(MinMax1, d1, None, Lim=True, dLMode=dSMode, margin=margin)             # <<<<<<<<<<<<<<
 *     X2, d2r, bla, N2 = _Ves_mesh_dlfromL_cython(MinMax2, d2, None, Lim=True, dLMode=dSMode, margin=margin)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_MinMax1, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_d1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dLMode, __pyx_v_dSMode) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_margin, __pyx_t_1) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 441, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_5,&__pyx_t_2,&__pyx_t_6};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 441, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_5,&__pyx_t_2,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 441, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < 0) __PYX_ERR(0, 441, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 441, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 441, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_X1 = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_d1r = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_bla = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_v_N1 = __pyx_t_3;

  /* "tofu/geom/_GG03.pyx":442
 * 
 *     X1, d1r, bla, N1 = _Ves_mesh_dlfromL_cython(MinMax1, d1, None, Lim=True, dLMode=dSMode, margin=margin)
 *     X2, d2r, bla, N2 = _Ves_mesh_dlfromL_cython(MinMax2, d2, None, Lim=True, dLMode=dSMode, margin=margin)             # <<<<<<<<<<<<<<
 * 
 *     Pts = np.empty((2,NP))
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_MinMax2, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_d2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
  __pyx_t_6 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dLMode, __pyx_v_dSMode) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_6) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 442, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_4};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 442, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_1,&__pyx_t_4};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 442, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_8(__pyx_t_7); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 4) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 442, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_X2 = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_d2r = __pyx_t_5;
  __pyx_t_5 = 0;
  __PYX_XDEC_MEMVIEW(&__pyx_v_bla, 1);
  __pyx_v_bla = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_v_N2 = __pyx_t_3;

  /* "tofu/geom/_GG03.pyx":444
 *     X2, d2r, bla, N2 = _Ves_mesh_dlfromL_cython(MinMax2, d2, None, Lim=True, dLMode=dSMode, margin=margin)
 * 
 *     Pts = np.empty((2,NP))             # <<<<<<<<<<<<<<
 *     dS = d1r*d2r*np.ones((NP,))
 *     for ii in range(0,NP):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 444, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 444, __pyx_L1_error)
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      }
      __pyx_t_12 = __pyx_t_13 = __pyx_t_14 = 0;
    }
    __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 444, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "tofu/geom/_GG03.pyx":445
 * 
 *     Pts = np.empty((2,NP))
 *     dS = d1r*d2r*np.ones((NP,))             # <<<<<<<<<<<<<<
 *     for ii in range(0,NP):
 *         i2 = ind[ii] // N1
 */
  __pyx_t_6 = PyNumber_Multiply(__pyx_v_d1r, __pyx_v_d2r); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 445, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 445, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 445, __pyx_L1_error)
  __pyx_t_15 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __pyx_t_3 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_3 < 0)) {
      PyErr_Fetch(&__pyx_t_14, &__pyx_t_13, &__pyx_t_12);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_14, __pyx_t_13, __pyx_t_12);
      }
      __pyx_t_14 = __pyx_t_13 = __pyx_t_12 = 0;
    }
    __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 445, __pyx_L1_error)
  }
  __pyx_t_15 = 0;
  __pyx_v_dS = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "tofu/geom/_GG03.pyx":446
 *     Pts = np.empty((2,NP))
 *     dS = d1r*d2r*np.ones((NP,))
 *     for ii in range(0,NP):             # <<<<<<<<<<<<<<
 *         i2 = ind[ii] // N1
 *         i1 = ind[ii]-i2*N1
 */
  __pyx_t_3 = __pyx_v_NP;
  for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_3; __pyx_t_16+=1) {
    __pyx_v_ii = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":447
 *     dS = d1r*d2r*np.ones((NP,))
 *     for ii in range(0,NP):
 *         i2 = ind[ii] // N1             # <<<<<<<<<<<<<<
 *         i1 = ind[ii]-i2*N1
 *         Pts[0,ii] = X1[i1]
 */
    __pyx_t_17 = __pyx_v_ii;
    __pyx_v_i2 = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_17)) ))) / __pyx_v_N1);

    /* "tofu/geom/_GG03.pyx":448
 *     for ii in range(0,NP):
 *         i2 = ind[ii] // N1
 *         i1 = ind[ii]-i2*N1             # <<<<<<<<<<<<<<
 *         Pts[0,ii] = X1[i1]
 *         Pts[1,ii] = X2[i2]
 */
    __pyx_t_18 = __pyx_v_ii;
    __pyx_v_i1 = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_18)) ))) - (__pyx_v_i2 * __pyx_v_N1));

    /* "tofu/geom/_GG03.pyx":449
 *         i2 = ind[ii] // N1
 *         i1 = ind[ii]-i2*N1
 *         Pts[0,ii] = X1[i1]             # <<<<<<<<<<<<<<
 *         Pts[1,ii] = X2[i2]
 *     return Pts, dS, d1r, d2r
 */
    __pyx_t_19 = __pyx_v_i1;
    __pyx_t_20 = 0;
    __pyx_t_21 = __pyx_v_ii;
    *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_X1.data) + __pyx_t_19)) )));

    /* "tofu/geom/_GG03.pyx":450
 *         i1 = ind[ii]-i2*N1
 *         Pts[0,ii] = X1[i1]
 *         Pts[1,ii] = X2[i2]             # <<<<<<<<<<<<<<
 *     return Pts, dS, d1r, d2r
 * 
 */
    __pyx_t_22 = __pyx_v_i2;
    __pyx_t_23 = 1;
    __pyx_t_24 = __pyx_v_ii;
    *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_X2.data) + __pyx_t_22)) )));
  }

  /* "tofu/geom/_GG03.pyx":451
 *         Pts[0,ii] = X1[i1]
 *         Pts[1,ii] = X2[i2]
 *     return Pts, dS, d1r, d2r             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(__pyx_v_d1r);
  __Pyx_GIVEREF(__pyx_v_d1r);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_d1r);
  __Pyx_INCREF(__pyx_v_d2r);
  __Pyx_GIVEREF(__pyx_v_d2r);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_d2r);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":433
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromInd(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, long[::1] ind, str dSMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_meshCross_FromInd", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_X1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_X2, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_bla, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF(__pyx_v_d1r);
  __Pyx_XDECREF(__pyx_v_d2r);
  __PYX_XDEC_MEMVIEW(&__pyx_v_MinMax1, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_MinMax2, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ind, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":460
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Cross(double[:,::1] VPoly, double dL, str dLMode='abs', D1=None, D2=None, double margin=1.e-9, double DIn=0., VIn=None):             # <<<<<<<<<<<<<<
 *     cdef int ii, jj, nn=0, NP=VPoly.shape[1]
 *     cdef double[::1] LMinMax, L
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_21_Ves_Smesh_Cross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_21_Ves_Smesh_Cross = {"_Ves_Smesh_Cross", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_21_Ves_Smesh_Cross, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_21_Ves_Smesh_Cross(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dL;
  PyObject *__pyx_v_dLMode = 0;
  PyObject *__pyx_v_D1 = 0;
  PyObject *__pyx_v_D2 = 0;
  double __pyx_v_margin;
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_Cross (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_VPoly,&__pyx_n_s_dL,&__pyx_n_s_dLMode,&__pyx_n_s_D1,&__pyx_n_s_D2,&__pyx_n_s_margin,&__pyx_n_s_DIn,&__pyx_n_s_VIn,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[2] = ((PyObject*)__pyx_n_s_abs);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Cross", 0, 2, 8, 1); __PYX_ERR(0, 460, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dLMode);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_D1);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_D2);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_Cross") < 0)) __PYX_ERR(0, 460, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 460, __pyx_L3_error)
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
    __pyx_v_dLMode = ((PyObject*)values[2]);
    __pyx_v_D1 = values[3];
    __pyx_v_D2 = values[4];
    if (values[5]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
    if (values[6]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 460, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Cross", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 460, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Cross", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dLMode), (&PyString_Type), 1, "dLMode", 1))) __PYX_ERR(0, 460, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_20_Ves_Smesh_Cross(__pyx_self, __pyx_v_VPoly, __pyx_v_dL, __pyx_v_dLMode, __pyx_v_D1, __pyx_v_D2, __pyx_v_margin, __pyx_v_DIn, __pyx_v_VIn);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_20_Ves_Smesh_Cross(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_VPoly, double __pyx_v_dL, PyObject *__pyx_v_dLMode, PyObject *__pyx_v_D1, PyObject *__pyx_v_D2, double __pyx_v_margin, double __pyx_v_DIn, PyObject *__pyx_v_VIn) {
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_nn;
  int __pyx_v_NP;
  __Pyx_memviewslice __pyx_v_LMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_L = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_v0;
  double __pyx_v_v1;
  double __pyx_v_dlr;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_indL = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_N = 0;
  PyArrayObject *__pyx_v_ind = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_PtsCross = 0;
  PyObject *__pyx_v_LPtsCross = 0;
  PyObject *__pyx_v_LdLr = 0;
  PyObject *__pyx_v_Lind = 0;
  PyObject *__pyx_v_LRref = 0;
  PyObject *__pyx_v_VPolybis = 0;
  PyObject *__pyx_v_indin = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_N;
  __Pyx_Buffer __pyx_pybuffer_N;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsCross;
  __Pyx_Buffer __pyx_pybuffer_PtsCross;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  long __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  double __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  double __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  PyObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *(*__pyx_t_26)(PyObject *);
  __Pyx_memviewslice __pyx_t_27 = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  int __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  int __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  PyObject *__pyx_t_90 = NULL;
  PyArrayObject *__pyx_t_91 = NULL;
  PyArrayObject *__pyx_t_92 = NULL;
  int __pyx_t_93;
  __Pyx_RefNannySetupContext("_Ves_Smesh_Cross", 0);
  __pyx_pybuffer_N.pybuffer.buf = NULL;
  __pyx_pybuffer_N.refcount = 0;
  __pyx_pybuffernd_N.data = NULL;
  __pyx_pybuffernd_N.rcbuffer = &__pyx_pybuffer_N;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_PtsCross.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsCross.refcount = 0;
  __pyx_pybuffernd_PtsCross.data = NULL;
  __pyx_pybuffernd_PtsCross.rcbuffer = &__pyx_pybuffer_PtsCross;

  /* "tofu/geom/_GG03.pyx":461
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Cross(double[:,::1] VPoly, double dL, str dLMode='abs', D1=None, D2=None, double margin=1.e-9, double DIn=0., VIn=None):
 *     cdef int ii, jj, nn=0, NP=VPoly.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double[::1] LMinMax, L
 *     cdef double v0, v1, dlr
 */
  __pyx_v_nn = 0;
  __pyx_v_NP = (__pyx_v_VPoly.shape[1]);

  /* "tofu/geom/_GG03.pyx":468
 *     cdef cnp.ndarray[double,ndim=1] dLr, Rref
 *     cdef cnp.ndarray[double,ndim=2] PtsCross
 *     cdef list LPtsCross=[], LdLr=[], Lind=[], LRref=[], VPolybis=[]             # <<<<<<<<<<<<<<
 * 
 *     LMinMax = np.array([0.,1.],dtype=float)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LPtsCross = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LdLr = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Lind = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LRref = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_VPolybis = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":470
 *     cdef list LPtsCross=[], LdLr=[], Lind=[], LRref=[], VPolybis=[]
 * 
 *     LMinMax = np.array([0.,1.],dtype=float)             # <<<<<<<<<<<<<<
 *     N = np.empty((NP-1,),dtype=int)
 *     if DIn==0.:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_float_0_);
  __Pyx_GIVEREF(__pyx_float_0_);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_float_0_);
  __Pyx_INCREF(__pyx_float_1_);
  __Pyx_GIVEREF(__pyx_float_1_);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_float_1_);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 470, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
  if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 470, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_LMinMax = __pyx_t_5;
  __pyx_t_5.memview = NULL;
  __pyx_t_5.data = NULL;

  /* "tofu/geom/_GG03.pyx":471
 * 
 *     LMinMax = np.array([0.,1.],dtype=float)
 *     N = np.empty((NP-1,),dtype=int)             # <<<<<<<<<<<<<<
 *     if DIn==0.:
 *         for ii in range(0,NP-1):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_NP - 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 471, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 471, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_N.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_N.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_N.rcbuffer->pybuffer, (PyObject*)__pyx_v_N, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_N.diminfo[0].strides = __pyx_pybuffernd_N.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_N.diminfo[0].shape = __pyx_pybuffernd_N.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 471, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_N = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":472
 *     LMinMax = np.array([0.,1.],dtype=float)
 *     N = np.empty((NP-1,),dtype=int)
 *     if DIn==0.:             # <<<<<<<<<<<<<<
 *         for ii in range(0,NP-1):
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 */
  __pyx_t_11 = ((__pyx_v_DIn == 0.) != 0);
  if (__pyx_t_11) {

    /* "tofu/geom/_GG03.pyx":473
 *     N = np.empty((NP-1,),dtype=int)
 *     if DIn==0.:
 *         for ii in range(0,NP-1):             # <<<<<<<<<<<<<<
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 */
    __pyx_t_12 = (__pyx_v_NP - 1);
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
      __pyx_v_ii = __pyx_t_7;

      /* "tofu/geom/_GG03.pyx":474
 *     if DIn==0.:
 *         for ii in range(0,NP-1):
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]             # <<<<<<<<<<<<<<
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 */
      __pyx_t_13 = 0;
      __pyx_t_14 = (__pyx_v_ii + 1);
      __pyx_t_15 = 0;
      __pyx_t_16 = __pyx_v_ii;
      __pyx_t_17 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_13 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_14)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_15 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_16)) ))));
      __pyx_t_18 = 1;
      __pyx_t_19 = (__pyx_v_ii + 1);
      __pyx_t_20 = 1;
      __pyx_t_21 = __pyx_v_ii;
      __pyx_t_22 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_18 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_19)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_20 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_21)) ))));
      __pyx_v_v0 = __pyx_t_17;
      __pyx_v_v1 = __pyx_t_22;

      /* "tofu/geom/_GG03.pyx":475
 *         for ii in range(0,NP-1):
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)             # <<<<<<<<<<<<<<
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 */
      __pyx_t_23 = 1;
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_23)) )) = sqrt((pow(__pyx_v_v0, 2.0) + pow(__pyx_v_v1, 2.0)));

      /* "tofu/geom/_GG03.pyx":476
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_LMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dLMode, __pyx_v_dLMode) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 476, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_24 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_24 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_24);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_1,&__pyx_t_2,&__pyx_t_24};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 476, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_1,&__pyx_t_2,&__pyx_t_24};
        __pyx_t_25 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 476, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_26 = Py_TYPE(__pyx_t_25)->tp_iternext;
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_26(__pyx_t_25); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_26(__pyx_t_25), 4) < 0) __PYX_ERR(0, 476, __pyx_L1_error)
        __pyx_t_26 = NULL;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_26 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 476, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
      if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_27 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
      if (unlikely(!__pyx_t_27.memview)) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_28 = __Pyx_PyInt_As_long(__pyx_t_24); if (unlikely((__pyx_t_28 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 476, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_L, 1);
      __pyx_v_L = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;
      __pyx_v_dlr = __pyx_t_22;
      __PYX_XDEC_MEMVIEW(&__pyx_v_indL, 1);
      __pyx_v_indL = __pyx_t_27;
      __pyx_t_27.memview = NULL;
      __pyx_t_27.data = NULL;
      __pyx_t_29 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_N.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_N.diminfo[0].strides) = __pyx_t_28;

      /* "tofu/geom/_GG03.pyx":477
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))             # <<<<<<<<<<<<<<
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 *             for jj in range(0,N[ii]):
 */
      __pyx_t_30 = 0;
      __pyx_t_31 = __pyx_v_ii;
      __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_30 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_31)) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_32 = 1;
      __pyx_t_33 = __pyx_v_ii;
      __pyx_t_24 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_32 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_33)) )))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 477, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_24);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_24);
      __pyx_t_3 = 0;
      __pyx_t_24 = 0;
      __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_VPolybis, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 477, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":478
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]             # <<<<<<<<<<<<<<
 *             for jj in range(0,N[ii]):
 *                 LdLr.append(dlr)
 */
      __pyx_t_35 = 1;
      __pyx_t_22 = (__pyx_v_v0 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_35)) ))));
      __pyx_t_36 = 1;
      __pyx_t_17 = (__pyx_v_v1 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_36)) ))));
      __pyx_v_v0 = __pyx_t_22;
      __pyx_v_v1 = __pyx_t_17;

      /* "tofu/geom/_GG03.pyx":479
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 *             for jj in range(0,N[ii]):             # <<<<<<<<<<<<<<
 *                 LdLr.append(dlr)
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 */
      __pyx_t_37 = __pyx_v_ii;
      __pyx_t_28 = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_N.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_N.diminfo[0].strides));
      for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_28; __pyx_t_38+=1) {
        __pyx_v_jj = __pyx_t_38;

        /* "tofu/geom/_GG03.pyx":480
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 *             for jj in range(0,N[ii]):
 *                 LdLr.append(dlr)             # <<<<<<<<<<<<<<
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0, VPoly[1,ii] + L[jj]*v1))
 */
        __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dlr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_LdLr, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 480, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":481
 *             for jj in range(0,N[ii]):
 *                 LdLr.append(dlr)
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)             # <<<<<<<<<<<<<<
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0, VPoly[1,ii] + L[jj]*v1))
 *                 Lind.append(nn)
 */
        __pyx_t_39 = 0;
        __pyx_t_40 = __pyx_v_ii;
        __pyx_t_41 = __pyx_v_jj;
        __pyx_t_2 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_39 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_40)) ))) + ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_41)) ))) * __pyx_v_v0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_LRref, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 481, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":482
 *                 LdLr.append(dlr)
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0, VPoly[1,ii] + L[jj]*v1))             # <<<<<<<<<<<<<<
 *                 Lind.append(nn)
 *                 nn += 1
 */
        __pyx_t_42 = 0;
        __pyx_t_43 = __pyx_v_ii;
        __pyx_t_44 = __pyx_v_jj;
        __pyx_t_2 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_42 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_43)) ))) + ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_44)) ))) * __pyx_v_v0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_45 = 1;
        __pyx_t_46 = __pyx_v_ii;
        __pyx_t_47 = __pyx_v_jj;
        __pyx_t_24 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_45 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_46)) ))) + ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_47)) ))) * __pyx_v_v1))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_24);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_24);
        __pyx_t_2 = 0;
        __pyx_t_24 = 0;
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_LPtsCross, __pyx_t_3); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 482, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":483
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0, VPoly[1,ii] + L[jj]*v1))
 *                 Lind.append(nn)             # <<<<<<<<<<<<<<
 *                 nn += 1
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))
 */
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_Lind, __pyx_t_3); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 483, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":484
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0, VPoly[1,ii] + L[jj]*v1))
 *                 Lind.append(nn)
 *                 nn += 1             # <<<<<<<<<<<<<<
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))
 */
        __pyx_v_nn = (__pyx_v_nn + 1);

        /* "tofu/geom/_GG03.pyx":485
 *                 Lind.append(nn)
 *                 nn += 1
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))             # <<<<<<<<<<<<<<
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))
 *     else:
 */
        __pyx_t_48 = 0;
        __pyx_t_49 = __pyx_v_ii;
        __pyx_t_3 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_48 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_49)) ))) + ((__pyx_v_jj * __pyx_v_dlr) * __pyx_v_v0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 485, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_50 = 1;
        __pyx_t_51 = __pyx_v_ii;
        __pyx_t_24 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_50 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_51)) ))) + ((__pyx_v_jj * __pyx_v_dlr) * __pyx_v_v1))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 485, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_24);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_24);
        __pyx_t_3 = 0;
        __pyx_t_24 = 0;
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_VPolybis, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 485, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }

    /* "tofu/geom/_GG03.pyx":486
 *                 nn += 1
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))             # <<<<<<<<<<<<<<
 *     else:
 *         for ii in range(0,NP-1):
 */
    __pyx_t_52 = 0;
    __pyx_t_53 = 0;
    __pyx_t_2 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_52 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_53)) )))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_54 = 1;
    __pyx_t_55 = 0;
    __pyx_t_24 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_54 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_55)) )))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 486, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_24);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_24);
    __pyx_t_2 = 0;
    __pyx_t_24 = 0;
    __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_VPolybis, __pyx_t_3); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 486, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":472
 *     LMinMax = np.array([0.,1.],dtype=float)
 *     N = np.empty((NP-1,),dtype=int)
 *     if DIn==0.:             # <<<<<<<<<<<<<<
 *         for ii in range(0,NP-1):
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":488
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))
 *     else:
 *         for ii in range(0,NP-1):             # <<<<<<<<<<<<<<
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 */
  /*else*/ {
    __pyx_t_12 = (__pyx_v_NP - 1);
    for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_12; __pyx_t_7+=1) {
      __pyx_v_ii = __pyx_t_7;

      /* "tofu/geom/_GG03.pyx":489
 *     else:
 *         for ii in range(0,NP-1):
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]             # <<<<<<<<<<<<<<
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 */
      __pyx_t_56 = 0;
      __pyx_t_57 = (__pyx_v_ii + 1);
      __pyx_t_58 = 0;
      __pyx_t_59 = __pyx_v_ii;
      __pyx_t_17 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_56 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_57)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_58 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_59)) ))));
      __pyx_t_60 = 1;
      __pyx_t_61 = (__pyx_v_ii + 1);
      __pyx_t_62 = 1;
      __pyx_t_63 = __pyx_v_ii;
      __pyx_t_22 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_60 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_61)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_62 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_63)) ))));
      __pyx_v_v0 = __pyx_t_17;
      __pyx_v_v1 = __pyx_t_22;

      /* "tofu/geom/_GG03.pyx":490
 *         for ii in range(0,NP-1):
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)             # <<<<<<<<<<<<<<
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 */
      __pyx_t_64 = 1;
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_64)) )) = sqrt((pow(__pyx_v_v0, 2.0) + pow(__pyx_v_v1, 2.0)));

      /* "tofu/geom/_GG03.pyx":491
 *             v0, v1 = VPoly[0,ii+1]-VPoly[0,ii], VPoly[1,ii+1]-VPoly[1,ii]
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_24 = __pyx_memoryview_fromslice(__pyx_v_LMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_24);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_24);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
      __pyx_t_24 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dLMode, __pyx_v_dLMode) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
      __pyx_t_24 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_24) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
      __pyx_t_24 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_24))) || (PyList_CheckExact(__pyx_t_24))) {
        PyObject* sequence = __pyx_t_24;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 491, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_3,&__pyx_t_4};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 491, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_3,&__pyx_t_4};
        __pyx_t_25 = PyObject_GetIter(__pyx_t_24); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 491, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_25);
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __pyx_t_26 = Py_TYPE(__pyx_t_25)->tp_iternext;
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_26(__pyx_t_25); if (unlikely(!item)) goto __pyx_L12_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_26(__pyx_t_25), 4) < 0) __PYX_ERR(0, 491, __pyx_L1_error)
        __pyx_t_26 = NULL;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
        __pyx_t_26 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 491, __pyx_L1_error)
        __pyx_L13_unpacking_done:;
      }
      __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2);
      if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_27 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_3);
      if (unlikely(!__pyx_t_27.memview)) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_28 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_28 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_L, 1);
      __pyx_v_L = __pyx_t_5;
      __pyx_t_5.memview = NULL;
      __pyx_t_5.data = NULL;
      __pyx_v_dlr = __pyx_t_22;
      __PYX_XDEC_MEMVIEW(&__pyx_v_indL, 1);
      __pyx_v_indL = __pyx_t_27;
      __pyx_t_27.memview = NULL;
      __pyx_t_27.data = NULL;
      __pyx_t_65 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_N.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_N.diminfo[0].strides) = __pyx_t_28;

      /* "tofu/geom/_GG03.pyx":492
 *             LMinMax[1] = Csqrt(v0**2 + v1**2)
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))             # <<<<<<<<<<<<<<
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 *             for jj in range(0,N[ii]):
 */
      __pyx_t_66 = 0;
      __pyx_t_67 = __pyx_v_ii;
      __pyx_t_24 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_66 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_67)) )))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __pyx_t_68 = 1;
      __pyx_t_69 = __pyx_v_ii;
      __pyx_t_4 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_68 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_69)) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_24);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_24);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
      __pyx_t_24 = 0;
      __pyx_t_4 = 0;
      __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_VPolybis, __pyx_t_3); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 492, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "tofu/geom/_GG03.pyx":493
 *             L, dlr, indL, N[ii] = _Ves_mesh_dlfromL_cython(LMinMax, dL, dLMode=dLMode, DL=None, Lim=True, margin=margin)
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]             # <<<<<<<<<<<<<<
 *             for jj in range(0,N[ii]):
 *                 LdLr.append(dlr)
 */
      __pyx_t_70 = 1;
      __pyx_t_22 = (__pyx_v_v0 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_70)) ))));
      __pyx_t_71 = 1;
      __pyx_t_17 = (__pyx_v_v1 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_71)) ))));
      __pyx_v_v0 = __pyx_t_22;
      __pyx_v_v1 = __pyx_t_17;

      /* "tofu/geom/_GG03.pyx":494
 *             VPolybis.append((VPoly[0,ii],VPoly[1,ii]))
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 *             for jj in range(0,N[ii]):             # <<<<<<<<<<<<<<
 *                 LdLr.append(dlr)
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 */
      __pyx_t_72 = __pyx_v_ii;
      __pyx_t_28 = (*__Pyx_BufPtrStrided1d(long *, __pyx_pybuffernd_N.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_N.diminfo[0].strides));
      for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_28; __pyx_t_38+=1) {
        __pyx_v_jj = __pyx_t_38;

        /* "tofu/geom/_GG03.pyx":495
 *             v0, v1 = v0/LMinMax[1], v1/LMinMax[1]
 *             for jj in range(0,N[ii]):
 *                 LdLr.append(dlr)             # <<<<<<<<<<<<<<
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0 + DIn*VIn[0,ii], VPoly[1,ii] + L[jj]*v1 + DIn*VIn[1,ii]))
 */
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dlr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 495, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_LdLr, __pyx_t_3); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 495, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":496
 *             for jj in range(0,N[ii]):
 *                 LdLr.append(dlr)
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)             # <<<<<<<<<<<<<<
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0 + DIn*VIn[0,ii], VPoly[1,ii] + L[jj]*v1 + DIn*VIn[1,ii]))
 *                 Lind.append(nn)
 */
        __pyx_t_73 = 0;
        __pyx_t_74 = __pyx_v_ii;
        __pyx_t_75 = __pyx_v_jj;
        __pyx_t_3 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_73 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_74)) ))) + ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_75)) ))) * __pyx_v_v0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 496, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_LRref, __pyx_t_3); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 496, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":497
 *                 LdLr.append(dlr)
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0 + DIn*VIn[0,ii], VPoly[1,ii] + L[jj]*v1 + DIn*VIn[1,ii]))             # <<<<<<<<<<<<<<
 *                 Lind.append(nn)
 *                 nn += 1
 */
        __pyx_t_76 = 0;
        __pyx_t_77 = __pyx_v_ii;
        __pyx_t_78 = __pyx_v_jj;
        __pyx_t_3 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_76 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_77)) ))) + ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_78)) ))) * __pyx_v_v0))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_24 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_24);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_24);
        __pyx_t_24 = 0;
        __pyx_t_24 = PyObject_GetItem(__pyx_v_VIn, __pyx_t_1); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __pyx_t_24 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_79 = 1;
        __pyx_t_80 = __pyx_v_ii;
        __pyx_t_81 = __pyx_v_jj;
        __pyx_t_1 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_79 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_80)) ))) + ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_L.data) + __pyx_t_81)) ))) * __pyx_v_v1))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_GetItem(__pyx_v_VIn, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_24);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_24);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
        __pyx_t_24 = 0;
        __pyx_t_4 = 0;
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_LPtsCross, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 497, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":498
 *                 LRref.append(VPoly[0,ii] + L[jj]*v0)
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0 + DIn*VIn[0,ii], VPoly[1,ii] + L[jj]*v1 + DIn*VIn[1,ii]))
 *                 Lind.append(nn)             # <<<<<<<<<<<<<<
 *                 nn += 1
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))
 */
        __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_Lind, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 498, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":499
 *                 LPtsCross.append((VPoly[0,ii] + L[jj]*v0 + DIn*VIn[0,ii], VPoly[1,ii] + L[jj]*v1 + DIn*VIn[1,ii]))
 *                 Lind.append(nn)
 *                 nn += 1             # <<<<<<<<<<<<<<
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))
 */
        __pyx_v_nn = (__pyx_v_nn + 1);

        /* "tofu/geom/_GG03.pyx":500
 *                 Lind.append(nn)
 *                 nn += 1
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))             # <<<<<<<<<<<<<<
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))
 * 
 */
        __pyx_t_82 = 0;
        __pyx_t_83 = __pyx_v_ii;
        __pyx_t_2 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_82 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_83)) ))) + ((__pyx_v_jj * __pyx_v_dlr) * __pyx_v_v0))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_84 = 1;
        __pyx_t_85 = __pyx_v_ii;
        __pyx_t_4 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_84 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_85)) ))) + ((__pyx_v_jj * __pyx_v_dlr) * __pyx_v_v1))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 500, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 500, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_t_4);
        __pyx_t_2 = 0;
        __pyx_t_4 = 0;
        __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_VPolybis, __pyx_t_24); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 500, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
      }
    }

    /* "tofu/geom/_GG03.pyx":501
 *                 nn += 1
 *                 VPolybis.append((VPoly[0,ii] + jj*dlr*v0, VPoly[1,ii] + jj*dlr*v1))
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))             # <<<<<<<<<<<<<<
 * 
 *     PtsCross, dLr, ind, Rref = np.array(LPtsCross).T, np.array(LdLr), np.array(Lind,dtype=int), np.array(LRref)
 */
    __pyx_t_86 = 0;
    __pyx_t_87 = 0;
    __pyx_t_24 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_86 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_87)) )))); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    __pyx_t_88 = 1;
    __pyx_t_89 = 0;
    __pyx_t_4 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_88 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_89)) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_24);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_24);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __pyx_t_24 = 0;
    __pyx_t_4 = 0;
    __pyx_t_34 = __Pyx_PyList_Append(__pyx_v_VPolybis, __pyx_t_2); if (unlikely(__pyx_t_34 == ((int)-1))) __PYX_ERR(0, 501, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":503
 *         VPolybis.append((VPoly[0,0],VPoly[1,0]))
 * 
 *     PtsCross, dLr, ind, Rref = np.array(LPtsCross).T, np.array(LdLr), np.array(Lind,dtype=int), np.array(LRref)             # <<<<<<<<<<<<<<
 *     if D1 is not None:
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_24);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_24, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_24, __pyx_v_LPtsCross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_24)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_LPtsCross};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_24, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_24)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_LPtsCross};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_24, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_LPtsCross);
      __Pyx_GIVEREF(__pyx_v_LPtsCross);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_LPtsCross);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_24, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  __pyx_t_24 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_T); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_24) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_24, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 503, __pyx_L1_error)
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_LdLr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_LdLr};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_LdLr};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v_LdLr);
      __Pyx_GIVEREF(__pyx_v_LdLr);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_LdLr);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 503, __pyx_L1_error)
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_Lind);
  __Pyx_GIVEREF(__pyx_v_Lind);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_Lind);
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 503, __pyx_L1_error)
  __pyx_t_25 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_25) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_25, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 503, __pyx_L1_error)
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_LRref); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_LRref};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_LRref};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_90 = PyTuple_New(1+1); if (unlikely(!__pyx_t_90)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_90);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_90, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_LRref);
      __Pyx_GIVEREF(__pyx_v_LRref);
      PyTuple_SET_ITEM(__pyx_t_90, 0+1, __pyx_v_LRref);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_90, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_90); __pyx_t_90 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 503, __pyx_L1_error)
  __pyx_t_91 = ((PyArrayObject *)__pyx_t_24);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_91, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 503, __pyx_L1_error)
  }
  __pyx_t_91 = 0;
  __pyx_v_PtsCross = ((PyArrayObject *)__pyx_t_24);
  __pyx_t_24 = 0;
  __pyx_t_92 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_92, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 503, __pyx_L1_error)
  }
  __pyx_t_92 = 0;
  __pyx_v_dLr = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_25);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
      }
      __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
    }
    __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 503, __pyx_L1_error)
  }
  __pyx_t_6 = 0;
  __pyx_v_ind = ((PyArrayObject *)__pyx_t_25);
  __pyx_t_25 = 0;
  __pyx_t_92 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_92, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_7 < 0)) {
      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
      }
      __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
    }
    __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 503, __pyx_L1_error)
  }
  __pyx_t_92 = 0;
  __pyx_v_Rref = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":504
 * 
 *     PtsCross, dLr, ind, Rref = np.array(LPtsCross).T, np.array(LdLr), np.array(Lind,dtype=int), np.array(LRref)
 *     if D1 is not None:             # <<<<<<<<<<<<<<
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])
 *         PtsCross = PtsCross[:,indin]
 */
  __pyx_t_11 = (__pyx_v_D1 != Py_None);
  __pyx_t_93 = (__pyx_t_11 != 0);
  if (__pyx_t_93) {

    /* "tofu/geom/_GG03.pyx":505
 *     PtsCross, dLr, ind, Rref = np.array(LPtsCross).T, np.array(LdLr), np.array(Lind,dtype=int), np.array(LRref)
 *     if D1 is not None:
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])             # <<<<<<<<<<<<<<
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__102); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_25 = __Pyx_GetItemInt(__pyx_v_D1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_25, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __pyx_t_25 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__104); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_D1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_24 = PyObject_RichCompare(__pyx_t_25, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_24); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __pyx_v_indin = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":506
 *     if D1 is not None:
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])
 *         PtsCross = PtsCross[:,indin]             # <<<<<<<<<<<<<<
 *         dLr, ind = dLr[indin], ind[indin]
 *     if D2 is not None:
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_slice__105);
    __Pyx_GIVEREF(__pyx_slice__105);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__105);
    __Pyx_INCREF(__pyx_v_indin);
    __Pyx_GIVEREF(__pyx_v_indin);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_indin);
    __pyx_t_24 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_1); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_24) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_24, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 506, __pyx_L1_error)
    __pyx_t_91 = ((PyArrayObject *)__pyx_t_24);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_91, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 506, __pyx_L1_error)
    }
    __pyx_t_91 = 0;
    __Pyx_DECREF_SET(__pyx_v_PtsCross, ((PyArrayObject *)__pyx_t_24));
    __pyx_t_24 = 0;

    /* "tofu/geom/_GG03.pyx":507
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]             # <<<<<<<<<<<<<<
 *     if D2 is not None:
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])
 */
    __pyx_t_24 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), __pyx_v_indin); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    if (!(likely(((__pyx_t_24) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_24, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 507, __pyx_L1_error)
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_indin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 507, __pyx_L1_error)
    __pyx_t_92 = ((PyArrayObject *)__pyx_t_24);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_92, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 507, __pyx_L1_error)
    }
    __pyx_t_92 = 0;
    __Pyx_DECREF_SET(__pyx_v_dLr, ((PyArrayObject *)__pyx_t_24));
    __pyx_t_24 = 0;
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 507, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":504
 * 
 *     PtsCross, dLr, ind, Rref = np.array(LPtsCross).T, np.array(LdLr), np.array(Lind,dtype=int), np.array(LRref)
 *     if D1 is not None:             # <<<<<<<<<<<<<<
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])
 *         PtsCross = PtsCross[:,indin]
 */
  }

  /* "tofu/geom/_GG03.pyx":508
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]
 *     if D2 is not None:             # <<<<<<<<<<<<<<
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])
 *         PtsCross = PtsCross[:,indin]
 */
  __pyx_t_93 = (__pyx_v_D2 != Py_None);
  __pyx_t_11 = (__pyx_t_93 != 0);
  if (__pyx_t_11) {

    /* "tofu/geom/_GG03.pyx":509
 *         dLr, ind = dLr[indin], ind[indin]
 *     if D2 is not None:
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])             # <<<<<<<<<<<<<<
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]
 */
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__107); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_24 = __Pyx_GetItemInt(__pyx_v_D2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_24, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __pyx_t_24 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__109); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_D2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_25 = PyObject_RichCompare(__pyx_t_24, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_25); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_25); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 509, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_XDECREF_SET(__pyx_v_indin, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":510
 *     if D2 is not None:
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])
 *         PtsCross = PtsCross[:,indin]             # <<<<<<<<<<<<<<
 *         dLr, ind = dLr[indin], ind[indin]
 * 
 */
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_slice__110);
    __Pyx_GIVEREF(__pyx_slice__110);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__110);
    __Pyx_INCREF(__pyx_v_indin);
    __Pyx_GIVEREF(__pyx_v_indin);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_indin);
    __pyx_t_25 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_1); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_25) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_25, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 510, __pyx_L1_error)
    __pyx_t_91 = ((PyArrayObject *)__pyx_t_25);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_91, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 510, __pyx_L1_error)
    }
    __pyx_t_91 = 0;
    __Pyx_DECREF_SET(__pyx_v_PtsCross, ((PyArrayObject *)__pyx_t_25));
    __pyx_t_25 = 0;

    /* "tofu/geom/_GG03.pyx":511
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]             # <<<<<<<<<<<<<<
 * 
 *     return PtsCross, dLr, ind, N, Rref, np.array(VPolybis).T
 */
    __pyx_t_25 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), __pyx_v_indin); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    if (!(likely(((__pyx_t_25) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_25, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 511, __pyx_L1_error)
    __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_indin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 511, __pyx_L1_error)
    __pyx_t_92 = ((PyArrayObject *)__pyx_t_25);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_92, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8);
        }
        __pyx_t_10 = __pyx_t_9 = __pyx_t_8 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
    }
    __pyx_t_92 = 0;
    __Pyx_DECREF_SET(__pyx_v_dLr, ((PyArrayObject *)__pyx_t_25));
    __pyx_t_25 = 0;
    __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_7 < 0)) {
        PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
        }
        __pyx_t_8 = __pyx_t_9 = __pyx_t_10 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 511, __pyx_L1_error)
    }
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":508
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]
 *     if D2 is not None:             # <<<<<<<<<<<<<<
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])
 *         PtsCross = PtsCross[:,indin]
 */
  }

  /* "tofu/geom/_GG03.pyx":513
 *         dLr, ind = dLr[indin], ind[indin]
 * 
 *     return PtsCross, dLr, ind, N, Rref, np.array(VPolybis).T             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_25 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_25, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
  __pyx_t_25 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_25)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_25);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_25) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_VPolybis); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_25, __pyx_v_VPolybis};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_25, __pyx_v_VPolybis};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_24 = PyTuple_New(1+1); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_24);
      __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_25); __pyx_t_25 = NULL;
      __Pyx_INCREF(__pyx_v_VPolybis);
      __Pyx_GIVEREF(__pyx_v_VPolybis);
      PyTuple_SET_ITEM(__pyx_t_24, 0+1, __pyx_v_VPolybis);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_PtsCross));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_PtsCross));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_PtsCross));
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_dLr));
  __Pyx_INCREF(((PyObject *)__pyx_v_ind));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_ind));
  __Pyx_INCREF(((PyObject *)__pyx_v_N));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_N));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_N));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":460
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Cross(double[:,::1] VPoly, double dL, str dLMode='abs', D1=None, D2=None, double margin=1.e-9, double DIn=0., VIn=None):             # <<<<<<<<<<<<<<
 *     cdef int ii, jj, nn=0, NP=VPoly.shape[1]
 *     cdef double[::1] LMinMax, L
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_XDECREF(__pyx_t_25);
  __PYX_XDEC_MEMVIEW(&__pyx_t_27, 1);
  __Pyx_XDECREF(__pyx_t_90);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_N.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Cross", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_N.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_LMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_L, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indL, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_N);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsCross);
  __Pyx_XDECREF(__pyx_v_LPtsCross);
  __Pyx_XDECREF(__pyx_v_LdLr);
  __Pyx_XDECREF(__pyx_v_Lind);
  __Pyx_XDECREF(__pyx_v_LRref);
  __Pyx_XDECREF(__pyx_v_VPolybis);
  __Pyx_XDECREF(__pyx_v_indin);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":547
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[::1] RMinMax, double[::1] ZMinMax,
 *                                    DR=None, DZ=None, DPhi=None, VPoly=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_23_Ves_Vmesh_Tor_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_22_Ves_Vmesh_Tor_SubFromD_cython[] = " Return the desired submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_23_Ves_Vmesh_Tor_SubFromD_cython = {"_Ves_Vmesh_Tor_SubFromD_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_23_Ves_Vmesh_Tor_SubFromD_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_22_Ves_Vmesh_Tor_SubFromD_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_23_Ves_Vmesh_Tor_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_dR;
  double __pyx_v_dZ;
  double __pyx_v_dRPhi;
  __Pyx_memviewslice __pyx_v_RMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ZMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_DR = 0;
  PyObject *__pyx_v_DZ = 0;
  PyObject *__pyx_v_DPhi = 0;
  PyObject *__pyx_v_VPoly = 0;
  PyObject *__pyx_v_Out = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Tor_SubFromD_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dR,&__pyx_n_s_dZ,&__pyx_n_s_dRPhi,&__pyx_n_s_RMinMax,&__pyx_n_s_ZMinMax,&__pyx_n_s_DR,&__pyx_n_s_DZ,&__pyx_n_s_DPhi,&__pyx_n_s_VPoly,&__pyx_n_s_Out,&__pyx_n_s_margin,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":549
 * def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi,
 *                                    double[::1] RMinMax, double[::1] ZMinMax,
 *                                    DR=None, DZ=None, DPhi=None, VPoly=None,             # <<<<<<<<<<<<<<
 *                                    str Out='(X,Y,Z)', double margin=1.e-9):
 *     " Return the desired submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) "
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject*)__pyx_kp_s_X_Y_Z);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dR)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dZ)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromD_cython", 0, 5, 11, 1); __PYX_ERR(0, 547, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dRPhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromD_cython", 0, 5, 11, 2); __PYX_ERR(0, 547, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromD_cython", 0, 5, 11, 3); __PYX_ERR(0, 547, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ZMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromD_cython", 0, 5, 11, 4); __PYX_ERR(0, 547, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DR);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DZ);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DPhi);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Vmesh_Tor_SubFromD_cython") < 0)) __PYX_ERR(0, 547, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dR = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_dR == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L3_error)
    __pyx_v_dZ = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L3_error)
    __pyx_v_dRPhi = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dRPhi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 547, __pyx_L3_error)
    __pyx_v_RMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[3]); if (unlikely(!__pyx_v_RMinMax.memview)) __PYX_ERR(0, 548, __pyx_L3_error)
    __pyx_v_ZMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[4]); if (unlikely(!__pyx_v_ZMinMax.memview)) __PYX_ERR(0, 548, __pyx_L3_error)
    __pyx_v_DR = values[5];
    __pyx_v_DZ = values[6];
    __pyx_v_DPhi = values[7];
    __pyx_v_VPoly = values[8];
    __pyx_v_Out = ((PyObject*)values[9]);
    if (values[10]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 550, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromD_cython", 0, 5, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 547, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Tor_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Out), (&PyString_Type), 1, "Out", 1))) __PYX_ERR(0, 550, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_22_Ves_Vmesh_Tor_SubFromD_cython(__pyx_self, __pyx_v_dR, __pyx_v_dZ, __pyx_v_dRPhi, __pyx_v_RMinMax, __pyx_v_ZMinMax, __pyx_v_DR, __pyx_v_DZ, __pyx_v_DPhi, __pyx_v_VPoly, __pyx_v_Out, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":547
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[::1] RMinMax, double[::1] ZMinMax,
 *                                    DR=None, DZ=None, DPhi=None, VPoly=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_22_Ves_Vmesh_Tor_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dR, double __pyx_v_dZ, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_RMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, PyObject *__pyx_v_DR, PyObject *__pyx_v_DZ, PyObject *__pyx_v_DPhi, PyObject *__pyx_v_VPoly, PyObject *__pyx_v_Out, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_R0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Z = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dRPhir = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dPhir = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED double __pyx_v_dRr0;
  double __pyx_v_dRr;
  double __pyx_v_dZr;
  double __pyx_v_DPhi0;
  double __pyx_v_DPhi1;
  double __pyx_v_abs0;
  double __pyx_v_abs1;
  double __pyx_v_phi;
  double __pyx_v_indiijj;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_indR0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_indR = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_indZ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Phin = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_NR0;
  CYTHON_UNUSED int __pyx_v_NR;
  int __pyx_v_NZ;
  int __pyx_v_Rn;
  int __pyx_v_Zn;
  int __pyx_v_nRPhi0;
  int __pyx_v_indR0ii;
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_nPhi0;
  int __pyx_v_nPhi1;
  int __pyx_v_zz;
  int __pyx_v_NP;
  int __pyx_v_NRPhi_int;
  int __pyx_v_Rratio;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_indI = 0;
  PyArrayObject *__pyx_v_iii = 0;
  PyArrayObject *__pyx_v_dV = 0;
  PyArrayObject *__pyx_v_ind = 0;
  CYTHON_UNUSED long __pyx_v_NPhimax;
  PyObject *__pyx_v_indin = NULL;
  PyObject *__pyx_v_Ru = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
  __Pyx_Buffer __pyx_pybuffer_dV;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_iii;
  __Pyx_Buffer __pyx_pybuffer_iii;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indI;
  __Pyx_Buffer __pyx_pybuffer_indI;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_9;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_11;
  size_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  double __pyx_t_15;
  double __pyx_t_16;
  double __pyx_t_17;
  __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_19;
  long __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  int __pyx_t_31;
  int __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  PyArrayObject *__pyx_t_49 = NULL;
  PyObject *__pyx_t_50 = NULL;
  PyObject *__pyx_t_51 = NULL;
  PyObject *__pyx_t_52 = NULL;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  PyArrayObject *__pyx_t_64 = NULL;
  PyObject *__pyx_t_65 = NULL;
  PyObject *__pyx_t_66 = NULL;
  Py_ssize_t __pyx_t_67;
  int __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Tor_SubFromD_cython", 0);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_indI.pybuffer.buf = NULL;
  __pyx_pybuffer_indI.refcount = 0;
  __pyx_pybuffernd_indI.data = NULL;
  __pyx_pybuffernd_indI.rcbuffer = &__pyx_pybuffer_indI;
  __pyx_pybuffer_iii.pybuffer.buf = NULL;
  __pyx_pybuffer_iii.refcount = 0;
  __pyx_pybuffernd_iii.data = NULL;
  __pyx_pybuffernd_iii.rcbuffer = &__pyx_pybuffer_iii;
  __pyx_pybuffer_dV.pybuffer.buf = NULL;
  __pyx_pybuffer_dV.refcount = 0;
  __pyx_pybuffernd_dV.data = NULL;
  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;

  /* "tofu/geom/_GG03.pyx":562
 * 
 *     # Get the actual R and Z resolutions and mesh elements
 *     R0, dRr0, indR0, NR0 = _Ves_mesh_dlfromL_cython(RMinMax, dR, None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, DR, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_RMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 562, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 562, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 562, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 562, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 562, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_3);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 562, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_R0 = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dRr0 = __pyx_t_9;
  __pyx_v_indR0 = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_v_NR0 = __pyx_t_11;

  /* "tofu/geom/_GG03.pyx":563
 *     # Get the actual R and Z resolutions and mesh elements
 *     R0, dRr0, indR0, NR0 = _Ves_mesh_dlfromL_cython(RMinMax, dR, None, Lim=True, margin=margin)
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, DR, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 *     Rn = len(R)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_RMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dR); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_DR);
  __Pyx_GIVEREF(__pyx_v_DR);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_DR);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 563, __pyx_L1_error)
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_margin, __pyx_t_5) < 0) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 563, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 563, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 563, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 563, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 563, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 563, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_R = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dRr = __pyx_t_9;
  __pyx_v_indR = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_v_NR = __pyx_t_11;

  /* "tofu/geom/_GG03.pyx":564
 *     R0, dRr0, indR0, NR0 = _Ves_mesh_dlfromL_cython(RMinMax, dR, None, Lim=True, margin=margin)
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, DR, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Rn = len(R)
 *     Zn = len(Z)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_ZMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dZ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_DZ);
  __Pyx_GIVEREF(__pyx_v_DZ);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_DZ);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 564, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_1};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 564, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_1};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 564, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 564, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_5);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Z = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dZr = __pyx_t_9;
  __pyx_v_indZ = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_v_NZ = __pyx_t_11;

  /* "tofu/geom/_GG03.pyx":565
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, DR, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 *     Rn = len(R)             # <<<<<<<<<<<<<<
 *     Zn = len(Z)
 * 
 */
  __pyx_t_12 = __Pyx_MemoryView_Len(__pyx_v_R); 
  __pyx_v_Rn = __pyx_t_12;

  /* "tofu/geom/_GG03.pyx":566
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 *     Rn = len(R)
 *     Zn = len(Z)             # <<<<<<<<<<<<<<
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 */
  __pyx_t_12 = __Pyx_MemoryView_Len(__pyx_v_Z); 
  __pyx_v_Zn = __pyx_t_12;

  /* "tofu/geom/_GG03.pyx":569
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:             # <<<<<<<<<<<<<<
 *         DPhi0, DPhi1 = -Cpi, Cpi
 *     else:
 */
  __pyx_t_13 = (__pyx_v_DPhi == Py_None);
  __pyx_t_14 = (__pyx_t_13 != 0);
  if (__pyx_t_14) {

    /* "tofu/geom/_GG03.pyx":570
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:
 *         DPhi0, DPhi1 = -Cpi, Cpi             # <<<<<<<<<<<<<<
 *     else:
 *         DPhi0, DPhi1 = Catan2(Csin(DPhi[0]),Ccos(DPhi[0])), Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))
 */
    __pyx_t_9 = (-M_PI);
    __pyx_t_15 = M_PI;
    __pyx_v_DPhi0 = __pyx_t_9;
    __pyx_v_DPhi1 = __pyx_t_15;

    /* "tofu/geom/_GG03.pyx":569
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:             # <<<<<<<<<<<<<<
 *         DPhi0, DPhi1 = -Cpi, Cpi
 *     else:
 */
    goto __pyx_L9;
  }

  /* "tofu/geom/_GG03.pyx":572
 *         DPhi0, DPhi1 = -Cpi, Cpi
 *     else:
 *         DPhi0, DPhi1 = Catan2(Csin(DPhi[0]),Ccos(DPhi[0])), Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))             # <<<<<<<<<<<<<<
 * 
 *     dRPhir, dPhir = np.empty((Rn,)), np.empty((Rn,))
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_16 = atan2(sin(__pyx_t_15), cos(__pyx_t_9));
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 572, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_17 = atan2(sin(__pyx_t_9), cos(__pyx_t_15));
    __pyx_v_DPhi0 = __pyx_t_16;
    __pyx_v_DPhi1 = __pyx_t_17;
  }
  __pyx_L9:;

  /* "tofu/geom/_GG03.pyx":574
 *         DPhi0, DPhi1 = Catan2(Csin(DPhi[0]),Ccos(DPhi[0])), Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))
 * 
 *     dRPhir, dPhir = np.empty((Rn,)), np.empty((Rn,))             # <<<<<<<<<<<<<<
 *     Phin = np.empty((Rn,),dtype=int)
 *     NRPhi = np.empty((Rn,))
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_3);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_3);
  if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 574, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_dRPhir = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dPhir = __pyx_t_18;
  __pyx_t_18.memview = NULL;
  __pyx_t_18.data = NULL;

  /* "tofu/geom/_GG03.pyx":575
 * 
 *     dRPhir, dPhir = np.empty((Rn,)), np.empty((Rn,))
 *     Phin = np.empty((Rn,),dtype=int)             # <<<<<<<<<<<<<<
 *     NRPhi = np.empty((Rn,))
 *     NRPhi0 = np.zeros((Rn,),dtype=int)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_4);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 575, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_Phin = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "tofu/geom/_GG03.pyx":576
 *     dRPhir, dPhir = np.empty((Rn,)), np.empty((Rn,))
 *     Phin = np.empty((Rn,),dtype=int)
 *     NRPhi = np.empty((Rn,))             # <<<<<<<<<<<<<<
 *     NRPhi0 = np.zeros((Rn,),dtype=int)
 *     nRPhi0, indR0ii = 0, 0
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
  if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 576, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_NRPhi = __pyx_t_18;
  __pyx_t_18.memview = NULL;
  __pyx_t_18.data = NULL;

  /* "tofu/geom/_GG03.pyx":577
 *     Phin = np.empty((Rn,),dtype=int)
 *     NRPhi = np.empty((Rn,))
 *     NRPhi0 = np.zeros((Rn,),dtype=int)             # <<<<<<<<<<<<<<
 *     nRPhi0, indR0ii = 0, 0
 *     NP, NPhimax = 0, 0
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 577, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 577, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_NRPhi0 = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "tofu/geom/_GG03.pyx":578
 *     NRPhi = np.empty((Rn,))
 *     NRPhi0 = np.zeros((Rn,),dtype=int)
 *     nRPhi0, indR0ii = 0, 0             # <<<<<<<<<<<<<<
 *     NP, NPhimax = 0, 0
 *     Rratio = int(Cceil(R[Rn-1]/R[0]))
 */
  __pyx_t_11 = 0;
  __pyx_t_19 = 0;
  __pyx_v_nRPhi0 = __pyx_t_11;
  __pyx_v_indR0ii = __pyx_t_19;

  /* "tofu/geom/_GG03.pyx":579
 *     NRPhi0 = np.zeros((Rn,),dtype=int)
 *     nRPhi0, indR0ii = 0, 0
 *     NP, NPhimax = 0, 0             # <<<<<<<<<<<<<<
 *     Rratio = int(Cceil(R[Rn-1]/R[0]))
 *     for ii in range(0,Rn):
 */
  __pyx_t_19 = 0;
  __pyx_t_20 = 0;
  __pyx_v_NP = __pyx_t_19;
  __pyx_v_NPhimax = __pyx_t_20;

  /* "tofu/geom/_GG03.pyx":580
 *     nRPhi0, indR0ii = 0, 0
 *     NP, NPhimax = 0, 0
 *     Rratio = int(Cceil(R[Rn-1]/R[0]))             # <<<<<<<<<<<<<<
 *     for ii in range(0,Rn):
 *         # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 */
  __pyx_t_21 = (__pyx_v_Rn - 1);
  __pyx_t_22 = 0;
  __pyx_v_Rratio = ((int)ceil(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_21)) ))) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_22)) ))))));

  /* "tofu/geom/_GG03.pyx":581
 *     NP, NPhimax = 0, 0
 *     Rratio = int(Cceil(R[Rn-1]/R[0]))
 *     for ii in range(0,Rn):             # <<<<<<<<<<<<<<
 *         # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 *         NRPhi[ii] = Cceil(2.*Cpi*R[ii]/dRPhi)
 */
  __pyx_t_19 = __pyx_v_Rn;
  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_19; __pyx_t_11+=1) {
    __pyx_v_ii = __pyx_t_11;

    /* "tofu/geom/_GG03.pyx":583
 *     for ii in range(0,Rn):
 *         # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 *         NRPhi[ii] = Cceil(2.*Cpi*R[ii]/dRPhi)             # <<<<<<<<<<<<<<
 *         NRPhi_int = int(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/NRPhi[ii]
 */
    __pyx_t_23 = __pyx_v_ii;
    __pyx_t_24 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_24)) )) = ceil((((2. * M_PI) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_23)) )))) / __pyx_v_dRPhi));

    /* "tofu/geom/_GG03.pyx":584
 *         # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 *         NRPhi[ii] = Cceil(2.*Cpi*R[ii]/dRPhi)
 *         NRPhi_int = int(NRPhi[ii])             # <<<<<<<<<<<<<<
 *         dPhir[ii] = 2.*Cpi/NRPhi[ii]
 *         dRPhir[ii] = dPhir[ii]*R[ii]
 */
    __pyx_t_25 = __pyx_v_ii;
    __pyx_v_NRPhi_int = ((int)(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_25)) ))));

    /* "tofu/geom/_GG03.pyx":585
 *         NRPhi[ii] = Cceil(2.*Cpi*R[ii]/dRPhi)
 *         NRPhi_int = int(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/NRPhi[ii]             # <<<<<<<<<<<<<<
 *         dRPhir[ii] = dPhir[ii]*R[ii]
 *         # Get index and cumulated indices from background
 */
    __pyx_t_26 = __pyx_v_ii;
    __pyx_t_27 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_27)) )) = ((2. * M_PI) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_26)) ))));

    /* "tofu/geom/_GG03.pyx":586
 *         NRPhi_int = int(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/NRPhi[ii]
 *         dRPhir[ii] = dPhir[ii]*R[ii]             # <<<<<<<<<<<<<<
 *         # Get index and cumulated indices from background
 *         for jj in range(indR0ii,NR0):
 */
    __pyx_t_28 = __pyx_v_ii;
    __pyx_t_29 = __pyx_v_ii;
    __pyx_t_30 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhir.data) + __pyx_t_30)) )) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_28)) ))) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_29)) ))));

    /* "tofu/geom/_GG03.pyx":588
 *         dRPhir[ii] = dPhir[ii]*R[ii]
 *         # Get index and cumulated indices from background
 *         for jj in range(indR0ii,NR0):             # <<<<<<<<<<<<<<
 *             if R0[jj]==R[ii]:
 *                 indR0ii = jj
 */
    __pyx_t_31 = __pyx_v_NR0;
    for (__pyx_t_32 = __pyx_v_indR0ii; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) {
      __pyx_v_jj = __pyx_t_32;

      /* "tofu/geom/_GG03.pyx":589
 *         # Get index and cumulated indices from background
 *         for jj in range(indR0ii,NR0):
 *             if R0[jj]==R[ii]:             # <<<<<<<<<<<<<<
 *                 indR0ii = jj
 *                 break
 */
      __pyx_t_33 = __pyx_v_jj;
      __pyx_t_34 = __pyx_v_ii;
      __pyx_t_14 = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R0.data) + __pyx_t_33)) ))) == (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_34)) )))) != 0);
      if (__pyx_t_14) {

        /* "tofu/geom/_GG03.pyx":590
 *         for jj in range(indR0ii,NR0):
 *             if R0[jj]==R[ii]:
 *                 indR0ii = jj             # <<<<<<<<<<<<<<
 *                 break
 *             else:
 */
        __pyx_v_indR0ii = __pyx_v_jj;

        /* "tofu/geom/_GG03.pyx":591
 *             if R0[jj]==R[ii]:
 *                 indR0ii = jj
 *                 break             # <<<<<<<<<<<<<<
 *             else:
 *                 nRPhi0 += <long>Cceil(2.*Cpi*R0[jj]/dRPhi)
 */
        goto __pyx_L13_break;

        /* "tofu/geom/_GG03.pyx":589
 *         # Get index and cumulated indices from background
 *         for jj in range(indR0ii,NR0):
 *             if R0[jj]==R[ii]:             # <<<<<<<<<<<<<<
 *                 indR0ii = jj
 *                 break
 */
      }

      /* "tofu/geom/_GG03.pyx":593
 *                 break
 *             else:
 *                 nRPhi0 += <long>Cceil(2.*Cpi*R0[jj]/dRPhi)             # <<<<<<<<<<<<<<
 *                 NRPhi0[ii] = nRPhi0*NZ
 *         # Get indices of phi
 */
      /*else*/ {
        __pyx_t_35 = __pyx_v_jj;
        __pyx_v_nRPhi0 = (__pyx_v_nRPhi0 + ((long)ceil((((2. * M_PI) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R0.data) + __pyx_t_35)) )))) / __pyx_v_dRPhi))));

        /* "tofu/geom/_GG03.pyx":594
 *             else:
 *                 nRPhi0 += <long>Cceil(2.*Cpi*R0[jj]/dRPhi)
 *                 NRPhi0[ii] = nRPhi0*NZ             # <<<<<<<<<<<<<<
 *         # Get indices of phi
 *         # Get the extreme indices of the mesh elements that really need to be created within those limits
 */
        __pyx_t_36 = __pyx_v_ii;
        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_36)) )) = (__pyx_v_nRPhi0 * __pyx_v_NZ);
      }
    }
    __pyx_L13_break:;

    /* "tofu/geom/_GG03.pyx":597
 *         # Get indices of phi
 *         # Get the extreme indices of the mesh elements that really need to be created within those limits
 *         abs0 = Cabs(DPhi0+Cpi)             # <<<<<<<<<<<<<<
 *         if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:
 *             nPhi0 = int(Cround((DPhi0+Cpi)/dPhir[ii]))
 */
    __pyx_v_abs0 = fabs((__pyx_v_DPhi0 + M_PI));

    /* "tofu/geom/_GG03.pyx":598
 *         # Get the extreme indices of the mesh elements that really need to be created within those limits
 *         abs0 = Cabs(DPhi0+Cpi)
 *         if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *             nPhi0 = int(Cround((DPhi0+Cpi)/dPhir[ii]))
 *         else:
 */
    __pyx_t_37 = __pyx_v_ii;
    __pyx_t_38 = __pyx_v_ii;
    __pyx_t_39 = __pyx_v_ii;
    __pyx_t_14 = (((__pyx_v_abs0 - ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_37)) ))) * floor((__pyx_v_abs0 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_38)) ))))))) < (__pyx_v_margin * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_39)) ))))) != 0);
    if (__pyx_t_14) {

      /* "tofu/geom/_GG03.pyx":599
 *         abs0 = Cabs(DPhi0+Cpi)
 *         if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:
 *             nPhi0 = int(Cround((DPhi0+Cpi)/dPhir[ii]))             # <<<<<<<<<<<<<<
 *         else:
 *             nPhi0 = int(Cfloor((DPhi0+Cpi)/dPhir[ii]))
 */
      __pyx_t_40 = __pyx_v_ii;
      __pyx_v_nPhi0 = ((int)round(((__pyx_v_DPhi0 + M_PI) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_40)) ))))));

      /* "tofu/geom/_GG03.pyx":598
 *         # Get the extreme indices of the mesh elements that really need to be created within those limits
 *         abs0 = Cabs(DPhi0+Cpi)
 *         if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *             nPhi0 = int(Cround((DPhi0+Cpi)/dPhir[ii]))
 *         else:
 */
      goto __pyx_L15;
    }

    /* "tofu/geom/_GG03.pyx":601
 *             nPhi0 = int(Cround((DPhi0+Cpi)/dPhir[ii]))
 *         else:
 *             nPhi0 = int(Cfloor((DPhi0+Cpi)/dPhir[ii]))             # <<<<<<<<<<<<<<
 *         abs1 = Cabs(DPhi1+Cpi)
 *         if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:
 */
    /*else*/ {
      __pyx_t_41 = __pyx_v_ii;
      __pyx_v_nPhi0 = ((int)floor(((__pyx_v_DPhi0 + M_PI) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_41)) ))))));
    }
    __pyx_L15:;

    /* "tofu/geom/_GG03.pyx":602
 *         else:
 *             nPhi0 = int(Cfloor((DPhi0+Cpi)/dPhir[ii]))
 *         abs1 = Cabs(DPhi1+Cpi)             # <<<<<<<<<<<<<<
 *         if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:
 *             nPhi1 = int(Cround((DPhi1+Cpi)/dPhir[ii])-1)
 */
    __pyx_v_abs1 = fabs((__pyx_v_DPhi1 + M_PI));

    /* "tofu/geom/_GG03.pyx":603
 *             nPhi0 = int(Cfloor((DPhi0+Cpi)/dPhir[ii]))
 *         abs1 = Cabs(DPhi1+Cpi)
 *         if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *             nPhi1 = int(Cround((DPhi1+Cpi)/dPhir[ii])-1)
 *         else:
 */
    __pyx_t_42 = __pyx_v_ii;
    __pyx_t_43 = __pyx_v_ii;
    __pyx_t_44 = __pyx_v_ii;
    __pyx_t_14 = (((__pyx_v_abs1 - ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_42)) ))) * floor((__pyx_v_abs1 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_43)) ))))))) < (__pyx_v_margin * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_44)) ))))) != 0);
    if (__pyx_t_14) {

      /* "tofu/geom/_GG03.pyx":604
 *         abs1 = Cabs(DPhi1+Cpi)
 *         if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:
 *             nPhi1 = int(Cround((DPhi1+Cpi)/dPhir[ii])-1)             # <<<<<<<<<<<<<<
 *         else:
 *             nPhi1 = int(Cfloor((DPhi1+Cpi)/dPhir[ii]))
 */
      __pyx_t_45 = __pyx_v_ii;
      __pyx_v_nPhi1 = ((int)(round(((__pyx_v_DPhi1 + M_PI) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_45)) ))))) - 1.0));

      /* "tofu/geom/_GG03.pyx":603
 *             nPhi0 = int(Cfloor((DPhi0+Cpi)/dPhir[ii]))
 *         abs1 = Cabs(DPhi1+Cpi)
 *         if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *             nPhi1 = int(Cround((DPhi1+Cpi)/dPhir[ii])-1)
 *         else:
 */
      goto __pyx_L16;
    }

    /* "tofu/geom/_GG03.pyx":606
 *             nPhi1 = int(Cround((DPhi1+Cpi)/dPhir[ii])-1)
 *         else:
 *             nPhi1 = int(Cfloor((DPhi1+Cpi)/dPhir[ii]))             # <<<<<<<<<<<<<<
 * 
 *         if DPhi0<DPhi1:
 */
    /*else*/ {
      __pyx_t_46 = __pyx_v_ii;
      __pyx_v_nPhi1 = ((int)floor(((__pyx_v_DPhi1 + M_PI) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_46)) ))))));
    }
    __pyx_L16:;

    /* "tofu/geom/_GG03.pyx":608
 *             nPhi1 = int(Cfloor((DPhi1+Cpi)/dPhir[ii]))
 * 
 *         if DPhi0<DPhi1:             # <<<<<<<<<<<<<<
 *             #indI.append(list(range(nPhi0,nPhi1+1)))
 *             Phin[ii] = nPhi1+1-nPhi0
 */
    __pyx_t_14 = ((__pyx_v_DPhi0 < __pyx_v_DPhi1) != 0);
    if (__pyx_t_14) {

      /* "tofu/geom/_GG03.pyx":610
 *         if DPhi0<DPhi1:
 *             #indI.append(list(range(nPhi0,nPhi1+1)))
 *             Phin[ii] = nPhi1+1-nPhi0             # <<<<<<<<<<<<<<
 *             if ii==0:
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 */
      __pyx_t_47 = __pyx_v_ii;
      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_47)) )) = ((__pyx_v_nPhi1 + 1) - __pyx_v_nPhi0);

      /* "tofu/geom/_GG03.pyx":611
 *             #indI.append(list(range(nPhi0,nPhi1+1)))
 *             Phin[ii] = nPhi1+1-nPhi0
 *             if ii==0:             # <<<<<<<<<<<<<<
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,Phin[ii]):
 */
      __pyx_t_14 = ((__pyx_v_ii == 0) != 0);
      if (__pyx_t_14) {

        /* "tofu/geom/_GG03.pyx":612
 *             Phin[ii] = nPhi1+1-nPhi0
 *             if ii==0:
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))             # <<<<<<<<<<<<<<
 *             for jj in range(0,Phin[ii]):
 *                 indI[ii,jj] = <double>( nPhi0+jj )
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_48 = __pyx_v_ii;
        __pyx_t_1 = __Pyx_PyInt_From_long((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_48)) ))) * __pyx_v_Rratio) + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
        __pyx_t_4 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (!__pyx_t_1) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_3)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else
          #endif
          {
            __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
            __Pyx_GIVEREF(__pyx_t_6);
            PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
            __pyx_t_6 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 612, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 612, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 612, __pyx_L1_error)
        __pyx_t_49 = ((PyArrayObject *)__pyx_t_3);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
          __pyx_t_31 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indI.rcbuffer->pybuffer, (PyObject*)__pyx_t_49, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_31 < 0)) {
            PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indI.rcbuffer->pybuffer, (PyObject*)__pyx_v_indI, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
            }
            __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
          }
          __pyx_pybuffernd_indI.diminfo[0].strides = __pyx_pybuffernd_indI.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indI.diminfo[0].shape = __pyx_pybuffernd_indI.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_indI.diminfo[1].strides = __pyx_pybuffernd_indI.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_indI.diminfo[1].shape = __pyx_pybuffernd_indI.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 612, __pyx_L1_error)
        }
        __pyx_t_49 = 0;
        __Pyx_XDECREF_SET(__pyx_v_indI, ((PyArrayObject *)__pyx_t_3));
        __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":611
 *             #indI.append(list(range(nPhi0,nPhi1+1)))
 *             Phin[ii] = nPhi1+1-nPhi0
 *             if ii==0:             # <<<<<<<<<<<<<<
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,Phin[ii]):
 */
      }

      /* "tofu/geom/_GG03.pyx":613
 *             if ii==0:
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,Phin[ii]):             # <<<<<<<<<<<<<<
 *                 indI[ii,jj] = <double>( nPhi0+jj )
 *         else:
 */
      __pyx_t_53 = __pyx_v_ii;
      __pyx_t_20 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_53)) )));
      for (__pyx_t_31 = 0; __pyx_t_31 < __pyx_t_20; __pyx_t_31+=1) {
        __pyx_v_jj = __pyx_t_31;

        /* "tofu/geom/_GG03.pyx":614
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,Phin[ii]):
 *                 indI[ii,jj] = <double>( nPhi0+jj )             # <<<<<<<<<<<<<<
 *         else:
 *             #indI.append(list(range(nPhi0,NRPhi_int)+list(range(0,nPhi1+1))))
 */
        __pyx_t_54 = __pyx_v_ii;
        __pyx_t_55 = __pyx_v_jj;
        *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_indI.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_indI.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_indI.diminfo[1].strides) = ((double)(__pyx_v_nPhi0 + __pyx_v_jj));
      }

      /* "tofu/geom/_GG03.pyx":608
 *             nPhi1 = int(Cfloor((DPhi1+Cpi)/dPhir[ii]))
 * 
 *         if DPhi0<DPhi1:             # <<<<<<<<<<<<<<
 *             #indI.append(list(range(nPhi0,nPhi1+1)))
 *             Phin[ii] = nPhi1+1-nPhi0
 */
      goto __pyx_L17;
    }

    /* "tofu/geom/_GG03.pyx":617
 *         else:
 *             #indI.append(list(range(nPhi0,NRPhi_int)+list(range(0,nPhi1+1))))
 *             Phin[ii] = nPhi1+1+NRPhi_int-nPhi0             # <<<<<<<<<<<<<<
 *             if ii==0:
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 */
    /*else*/ {
      __pyx_t_56 = __pyx_v_ii;
      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_56)) )) = (((__pyx_v_nPhi1 + 1) + __pyx_v_NRPhi_int) - __pyx_v_nPhi0);

      /* "tofu/geom/_GG03.pyx":618
 *             #indI.append(list(range(nPhi0,NRPhi_int)+list(range(0,nPhi1+1))))
 *             Phin[ii] = nPhi1+1+NRPhi_int-nPhi0
 *             if ii==0:             # <<<<<<<<<<<<<<
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,NRPhi_int-nPhi0):
 */
      __pyx_t_14 = ((__pyx_v_ii == 0) != 0);
      if (__pyx_t_14) {

        /* "tofu/geom/_GG03.pyx":619
 *             Phin[ii] = nPhi1+1+NRPhi_int-nPhi0
 *             if ii==0:
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))             # <<<<<<<<<<<<<<
 *             for jj in range(0,NRPhi_int-nPhi0):
 *                 indI[ii,jj] = <double>( nPhi0+jj )
 */
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_Rn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_57 = __pyx_v_ii;
        __pyx_t_6 = __Pyx_PyInt_From_long((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_57)) ))) * __pyx_v_Rratio) + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
        __pyx_t_5 = 0;
        __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_6)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (!__pyx_t_6) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_1};
            __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_1};
            __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 619, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 619, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 619, __pyx_L1_error)
        __pyx_t_49 = ((PyArrayObject *)__pyx_t_4);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
          __pyx_t_31 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indI.rcbuffer->pybuffer, (PyObject*)__pyx_t_49, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_31 < 0)) {
            PyErr_Fetch(&__pyx_t_52, &__pyx_t_51, &__pyx_t_50);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indI.rcbuffer->pybuffer, (PyObject*)__pyx_v_indI, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_50);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_52, __pyx_t_51, __pyx_t_50);
            }
            __pyx_t_52 = __pyx_t_51 = __pyx_t_50 = 0;
          }
          __pyx_pybuffernd_indI.diminfo[0].strides = __pyx_pybuffernd_indI.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indI.diminfo[0].shape = __pyx_pybuffernd_indI.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_indI.diminfo[1].strides = __pyx_pybuffernd_indI.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_indI.diminfo[1].shape = __pyx_pybuffernd_indI.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 619, __pyx_L1_error)
        }
        __pyx_t_49 = 0;
        __Pyx_XDECREF_SET(__pyx_v_indI, ((PyArrayObject *)__pyx_t_4));
        __pyx_t_4 = 0;

        /* "tofu/geom/_GG03.pyx":618
 *             #indI.append(list(range(nPhi0,NRPhi_int)+list(range(0,nPhi1+1))))
 *             Phin[ii] = nPhi1+1+NRPhi_int-nPhi0
 *             if ii==0:             # <<<<<<<<<<<<<<
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,NRPhi_int-nPhi0):
 */
      }

      /* "tofu/geom/_GG03.pyx":620
 *             if ii==0:
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,NRPhi_int-nPhi0):             # <<<<<<<<<<<<<<
 *                 indI[ii,jj] = <double>( nPhi0+jj )
 *             for jj in range(NRPhi_int-nPhi0,Phin[ii]):
 */
      __pyx_t_31 = (__pyx_v_NRPhi_int - __pyx_v_nPhi0);
      for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) {
        __pyx_v_jj = __pyx_t_32;

        /* "tofu/geom/_GG03.pyx":621
 *                 indI = np.nan*np.ones((Rn,Phin[ii]*Rratio+1))
 *             for jj in range(0,NRPhi_int-nPhi0):
 *                 indI[ii,jj] = <double>( nPhi0+jj )             # <<<<<<<<<<<<<<
 *             for jj in range(NRPhi_int-nPhi0,Phin[ii]):
 *                 indI[ii,jj] = <double>( jj- (NRPhi_int-nPhi0) )
 */
        __pyx_t_58 = __pyx_v_ii;
        __pyx_t_59 = __pyx_v_jj;
        *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_indI.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_indI.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_indI.diminfo[1].strides) = ((double)(__pyx_v_nPhi0 + __pyx_v_jj));
      }

      /* "tofu/geom/_GG03.pyx":622
 *             for jj in range(0,NRPhi_int-nPhi0):
 *                 indI[ii,jj] = <double>( nPhi0+jj )
 *             for jj in range(NRPhi_int-nPhi0,Phin[ii]):             # <<<<<<<<<<<<<<
 *                 indI[ii,jj] = <double>( jj- (NRPhi_int-nPhi0) )
 *         NP += Zn*Phin[ii]
 */
      __pyx_t_60 = __pyx_v_ii;
      __pyx_t_20 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_60)) )));
      for (__pyx_t_31 = (__pyx_v_NRPhi_int - __pyx_v_nPhi0); __pyx_t_31 < __pyx_t_20; __pyx_t_31+=1) {
        __pyx_v_jj = __pyx_t_31;

        /* "tofu/geom/_GG03.pyx":623
 *                 indI[ii,jj] = <double>( nPhi0+jj )
 *             for jj in range(NRPhi_int-nPhi0,Phin[ii]):
 *                 indI[ii,jj] = <double>( jj- (NRPhi_int-nPhi0) )             # <<<<<<<<<<<<<<
 *         NP += Zn*Phin[ii]
 * 
 */
        __pyx_t_61 = __pyx_v_ii;
        __pyx_t_62 = __pyx_v_jj;
        *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_indI.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_indI.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_indI.diminfo[1].strides) = ((double)(__pyx_v_jj - (__pyx_v_NRPhi_int - __pyx_v_nPhi0)));
      }
    }
    __pyx_L17:;

    /* "tofu/geom/_GG03.pyx":624
 *             for jj in range(NRPhi_int-nPhi0,Phin[ii]):
 *                 indI[ii,jj] = <double>( jj- (NRPhi_int-nPhi0) )
 *         NP += Zn*Phin[ii]             # <<<<<<<<<<<<<<
 * 
 *     Pts = np.empty((3,NP))
 */
    __pyx_t_63 = __pyx_v_ii;
    __pyx_v_NP = (__pyx_v_NP + (__pyx_v_Zn * (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_63)) )))));
  }

  /* "tofu/geom/_GG03.pyx":626
 *         NP += Zn*Phin[ii]
 * 
 *     Pts = np.empty((3,NP))             # <<<<<<<<<<<<<<
 *     ind = np.empty((NP,))
 *     dV = np.empty((NP,))
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 626, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 626, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 626, __pyx_L1_error)
  __pyx_t_49 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_49, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_19 < 0)) {
      PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
      }
      __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
    }
    __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 626, __pyx_L1_error)
  }
  __pyx_t_49 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":627
 * 
 *     Pts = np.empty((3,NP))
 *     ind = np.empty((NP,))             # <<<<<<<<<<<<<<
 *     dV = np.empty((NP,))
 *     # Compute Pts, dV and ind
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 627, __pyx_L1_error)
  __pyx_t_64 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_19 < 0)) {
      PyErr_Fetch(&__pyx_t_52, &__pyx_t_51, &__pyx_t_50);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_50);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_52, __pyx_t_51, __pyx_t_50);
      }
      __pyx_t_52 = __pyx_t_51 = __pyx_t_50 = 0;
    }
    __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 627, __pyx_L1_error)
  }
  __pyx_t_64 = 0;
  __pyx_v_ind = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":628
 *     Pts = np.empty((3,NP))
 *     ind = np.empty((NP,))
 *     dV = np.empty((NP,))             # <<<<<<<<<<<<<<
 *     # Compute Pts, dV and ind
 *     # This triple loop is the longest part, it takes ~90% of the CPU time
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 628, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 628, __pyx_L1_error)
  __pyx_t_64 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
    __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_19 < 0)) {
      PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
      }
      __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
    }
    __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 628, __pyx_L1_error)
  }
  __pyx_t_64 = 0;
  __pyx_v_dV = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":631
 *     # Compute Pts, dV and ind
 *     # This triple loop is the longest part, it takes ~90% of the CPU time
 *     NP = 0             # <<<<<<<<<<<<<<
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,Rn):
 */
  __pyx_v_NP = 0;

  /* "tofu/geom/_GG03.pyx":632
 *     # This triple loop is the longest part, it takes ~90% of the CPU time
 *     NP = 0
 *     if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_14 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 632, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_14) {

    /* "tofu/geom/_GG03.pyx":633
 *     NP = 0
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,Rn):             # <<<<<<<<<<<<<<
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order
 *             for zz in range(0,Zn):
 */
    __pyx_t_19 = __pyx_v_Rn;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_19; __pyx_t_11+=1) {
      __pyx_v_ii = __pyx_t_11;

      /* "tofu/geom/_GG03.pyx":634
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order             # <<<<<<<<<<<<<<
 *             for zz in range(0,Zn):
 *                 for jj in range(0,Phin[ii]):
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sort); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_isnan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_65 = PyTuple_New(2); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_65, 0, __pyx_t_1);
      __Pyx_INCREF(__pyx_slice__111);
      __Pyx_GIVEREF(__pyx_slice__111);
      PyTuple_SET_ITEM(__pyx_t_65, 1, __pyx_slice__111);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_65); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __pyx_t_65 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_65 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_65)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_65);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_65) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_65, __pyx_t_1};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_65); __pyx_t_65 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_65, __pyx_t_1};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_65); __pyx_t_65 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_66 = PyTuple_New(1+1); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_66);
          __Pyx_GIVEREF(__pyx_t_65); PyTuple_SET_ITEM(__pyx_t_66, 0, __pyx_t_65); __pyx_t_65 = NULL;
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_66, 0+1, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_66, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Invert(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 634, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 634, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 634, __pyx_L1_error)
      __pyx_t_64 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
        __pyx_t_31 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_31 < 0)) {
          PyErr_Fetch(&__pyx_t_52, &__pyx_t_51, &__pyx_t_50);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_v_iii, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_50);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_52, __pyx_t_51, __pyx_t_50);
          }
          __pyx_t_52 = __pyx_t_51 = __pyx_t_50 = 0;
        }
        __pyx_pybuffernd_iii.diminfo[0].strides = __pyx_pybuffernd_iii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iii.diminfo[0].shape = __pyx_pybuffernd_iii.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 634, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __Pyx_XDECREF_SET(__pyx_v_iii, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "tofu/geom/_GG03.pyx":635
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order
 *             for zz in range(0,Zn):             # <<<<<<<<<<<<<<
 *                 for jj in range(0,Phin[ii]):
 *                     indiijj = iii[jj]
 */
      __pyx_t_31 = __pyx_v_Zn;
      for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) {
        __pyx_v_zz = __pyx_t_32;

        /* "tofu/geom/_GG03.pyx":636
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order
 *             for zz in range(0,Zn):
 *                 for jj in range(0,Phin[ii]):             # <<<<<<<<<<<<<<
 *                     indiijj = iii[jj]
 *                     phi = -Cpi + (0.5+indiijj)*dPhir[ii]
 */
        __pyx_t_67 = __pyx_v_ii;
        __pyx_t_20 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_67)) )));
        for (__pyx_t_68 = 0; __pyx_t_68 < __pyx_t_20; __pyx_t_68+=1) {
          __pyx_v_jj = __pyx_t_68;

          /* "tofu/geom/_GG03.pyx":637
 *             for zz in range(0,Zn):
 *                 for jj in range(0,Phin[ii]):
 *                     indiijj = iii[jj]             # <<<<<<<<<<<<<<
 *                     phi = -Cpi + (0.5+indiijj)*dPhir[ii]
 *                     Pts[0,NP] = R[ii]*Ccos(phi)
 */
          __pyx_t_69 = __pyx_v_jj;
          __pyx_v_indiijj = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_iii.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_iii.diminfo[0].strides));

          /* "tofu/geom/_GG03.pyx":638
 *                 for jj in range(0,Phin[ii]):
 *                     indiijj = iii[jj]
 *                     phi = -Cpi + (0.5+indiijj)*dPhir[ii]             # <<<<<<<<<<<<<<
 *                     Pts[0,NP] = R[ii]*Ccos(phi)
 *                     Pts[1,NP] = R[ii]*Csin(phi)
 */
          __pyx_t_70 = __pyx_v_ii;
          __pyx_v_phi = ((-M_PI) + ((0.5 + __pyx_v_indiijj) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_70)) )))));

          /* "tofu/geom/_GG03.pyx":639
 *                     indiijj = iii[jj]
 *                     phi = -Cpi + (0.5+indiijj)*dPhir[ii]
 *                     Pts[0,NP] = R[ii]*Ccos(phi)             # <<<<<<<<<<<<<<
 *                     Pts[1,NP] = R[ii]*Csin(phi)
 *                     Pts[2,NP] = Z[zz]
 */
          __pyx_t_71 = __pyx_v_ii;
          __pyx_t_72 = 0;
          __pyx_t_73 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_73, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_71)) ))) * cos(__pyx_v_phi));

          /* "tofu/geom/_GG03.pyx":640
 *                     phi = -Cpi + (0.5+indiijj)*dPhir[ii]
 *                     Pts[0,NP] = R[ii]*Ccos(phi)
 *                     Pts[1,NP] = R[ii]*Csin(phi)             # <<<<<<<<<<<<<<
 *                     Pts[2,NP] = Z[zz]
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 */
          __pyx_t_74 = __pyx_v_ii;
          __pyx_t_75 = 1;
          __pyx_t_76 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_74)) ))) * sin(__pyx_v_phi));

          /* "tofu/geom/_GG03.pyx":641
 *                     Pts[0,NP] = R[ii]*Ccos(phi)
 *                     Pts[1,NP] = R[ii]*Csin(phi)
 *                     Pts[2,NP] = Z[zz]             # <<<<<<<<<<<<<<
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 *                     dV[NP] = dRr*dZr*dRPhir[ii]
 */
          __pyx_t_77 = __pyx_v_zz;
          __pyx_t_78 = 2;
          __pyx_t_79 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Z.data) + __pyx_t_77)) )));

          /* "tofu/geom/_GG03.pyx":642
 *                     Pts[1,NP] = R[ii]*Csin(phi)
 *                     Pts[2,NP] = Z[zz]
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj             # <<<<<<<<<<<<<<
 *                     dV[NP] = dRr*dZr*dRPhir[ii]
 *                     NP += 1
 */
          __pyx_t_80 = __pyx_v_ii;
          __pyx_t_81 = __pyx_v_zz;
          __pyx_t_82 = __pyx_v_ii;
          __pyx_t_83 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_83, __pyx_pybuffernd_ind.diminfo[0].strides) = (((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_80)) ))) + ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_indZ.data) + __pyx_t_81)) ))) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_82)) ))))) + __pyx_v_indiijj);

          /* "tofu/geom/_GG03.pyx":643
 *                     Pts[2,NP] = Z[zz]
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 *                     dV[NP] = dRr*dZr*dRPhir[ii]             # <<<<<<<<<<<<<<
 *                     NP += 1
 *     else:
 */
          __pyx_t_84 = __pyx_v_ii;
          __pyx_t_85 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_dV.diminfo[0].strides) = ((__pyx_v_dRr * __pyx_v_dZr) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhir.data) + __pyx_t_84)) ))));

          /* "tofu/geom/_GG03.pyx":644
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 *                     dV[NP] = dRr*dZr*dRPhir[ii]
 *                     NP += 1             # <<<<<<<<<<<<<<
 *     else:
 *         for ii in range(0,Rn):
 */
          __pyx_v_NP = (__pyx_v_NP + 1);
        }
      }
    }

    /* "tofu/geom/_GG03.pyx":632
 *     # This triple loop is the longest part, it takes ~90% of the CPU time
 *     NP = 0
 *     if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order
 */
    goto __pyx_L26;
  }

  /* "tofu/geom/_GG03.pyx":646
 *                     NP += 1
 *     else:
 *         for ii in range(0,Rn):             # <<<<<<<<<<<<<<
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])])
 *             #assert iii.size==Phin[ii] and np.all(np.unique(iii)==iii)
 */
  /*else*/ {
    __pyx_t_19 = __pyx_v_Rn;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_19; __pyx_t_11+=1) {
      __pyx_v_ii = __pyx_t_11;

      /* "tofu/geom/_GG03.pyx":647
 *     else:
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])])             # <<<<<<<<<<<<<<
 *             #assert iii.size==Phin[ii] and np.all(np.unique(iii)==iii)
 *             for zz in range(0,Zn):
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_66 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_isnan); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_66);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
      __Pyx_INCREF(__pyx_slice__112);
      __Pyx_GIVEREF(__pyx_slice__112);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_slice__112);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_66))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_66);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_66);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_66, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_66, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 647, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_66)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_66, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_66)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_66, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_65 = PyTuple_New(1+1); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_65);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_65, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_65, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_66, __pyx_t_65, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
      __pyx_t_66 = PyNumber_Invert(__pyx_t_6); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_66);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_66);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_66);
      __pyx_t_2 = 0;
      __pyx_t_66 = 0;
      __pyx_t_66 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_6); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 647, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_66);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_66); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_66};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_66};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_66);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_66);
          __pyx_t_66 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 647, __pyx_L1_error)
      __pyx_t_64 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
        __pyx_t_31 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_31 < 0)) {
          PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_v_iii, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
          }
          __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
        }
        __pyx_pybuffernd_iii.diminfo[0].strides = __pyx_pybuffernd_iii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iii.diminfo[0].shape = __pyx_pybuffernd_iii.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_31 < 0)) __PYX_ERR(0, 647, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __Pyx_XDECREF_SET(__pyx_v_iii, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "tofu/geom/_GG03.pyx":649
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])])
 *             #assert iii.size==Phin[ii] and np.all(np.unique(iii)==iii)
 *             for zz in range(0,Zn):             # <<<<<<<<<<<<<<
 *                 for jj in range(0,Phin[ii]):
 *                     indiijj = iii[jj] #indI[ii,iii[jj]]
 */
      __pyx_t_31 = __pyx_v_Zn;
      for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) {
        __pyx_v_zz = __pyx_t_32;

        /* "tofu/geom/_GG03.pyx":650
 *             #assert iii.size==Phin[ii] and np.all(np.unique(iii)==iii)
 *             for zz in range(0,Zn):
 *                 for jj in range(0,Phin[ii]):             # <<<<<<<<<<<<<<
 *                     indiijj = iii[jj] #indI[ii,iii[jj]]
 *                     Pts[0,NP] = R[ii]
 */
        __pyx_t_86 = __pyx_v_ii;
        __pyx_t_20 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_86)) )));
        for (__pyx_t_68 = 0; __pyx_t_68 < __pyx_t_20; __pyx_t_68+=1) {
          __pyx_v_jj = __pyx_t_68;

          /* "tofu/geom/_GG03.pyx":651
 *             for zz in range(0,Zn):
 *                 for jj in range(0,Phin[ii]):
 *                     indiijj = iii[jj] #indI[ii,iii[jj]]             # <<<<<<<<<<<<<<
 *                     Pts[0,NP] = R[ii]
 *                     Pts[1,NP] = Z[zz]
 */
          __pyx_t_87 = __pyx_v_jj;
          __pyx_v_indiijj = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_iii.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_iii.diminfo[0].strides));

          /* "tofu/geom/_GG03.pyx":652
 *                 for jj in range(0,Phin[ii]):
 *                     indiijj = iii[jj] #indI[ii,iii[jj]]
 *                     Pts[0,NP] = R[ii]             # <<<<<<<<<<<<<<
 *                     Pts[1,NP] = Z[zz]
 *                     Pts[2,NP] = -Cpi + (0.5+indiijj)*dPhir[ii]
 */
          __pyx_t_88 = __pyx_v_ii;
          __pyx_t_89 = 0;
          __pyx_t_90 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_88)) )));

          /* "tofu/geom/_GG03.pyx":653
 *                     indiijj = iii[jj] #indI[ii,iii[jj]]
 *                     Pts[0,NP] = R[ii]
 *                     Pts[1,NP] = Z[zz]             # <<<<<<<<<<<<<<
 *                     Pts[2,NP] = -Cpi + (0.5+indiijj)*dPhir[ii]
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 */
          __pyx_t_91 = __pyx_v_zz;
          __pyx_t_92 = 1;
          __pyx_t_93 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_93, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Z.data) + __pyx_t_91)) )));

          /* "tofu/geom/_GG03.pyx":654
 *                     Pts[0,NP] = R[ii]
 *                     Pts[1,NP] = Z[zz]
 *                     Pts[2,NP] = -Cpi + (0.5+indiijj)*dPhir[ii]             # <<<<<<<<<<<<<<
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 *                     dV[NP] = dRr*dZr*dRPhir[ii]
 */
          __pyx_t_94 = __pyx_v_ii;
          __pyx_t_95 = 2;
          __pyx_t_96 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_96, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((-M_PI) + ((0.5 + __pyx_v_indiijj) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_94)) )))));

          /* "tofu/geom/_GG03.pyx":655
 *                     Pts[1,NP] = Z[zz]
 *                     Pts[2,NP] = -Cpi + (0.5+indiijj)*dPhir[ii]
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj             # <<<<<<<<<<<<<<
 *                     dV[NP] = dRr*dZr*dRPhir[ii]
 *                     NP += 1
 */
          __pyx_t_97 = __pyx_v_ii;
          __pyx_t_98 = __pyx_v_zz;
          __pyx_t_99 = __pyx_v_ii;
          __pyx_t_100 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_100, __pyx_pybuffernd_ind.diminfo[0].strides) = (((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_97)) ))) + ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_indZ.data) + __pyx_t_98)) ))) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_99)) ))))) + __pyx_v_indiijj);

          /* "tofu/geom/_GG03.pyx":656
 *                     Pts[2,NP] = -Cpi + (0.5+indiijj)*dPhir[ii]
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 *                     dV[NP] = dRr*dZr*dRPhir[ii]             # <<<<<<<<<<<<<<
 *                     NP += 1
 * 
 */
          __pyx_t_101 = __pyx_v_ii;
          __pyx_t_102 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_102, __pyx_pybuffernd_dV.diminfo[0].strides) = ((__pyx_v_dRr * __pyx_v_dZr) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhir.data) + __pyx_t_101)) ))));

          /* "tofu/geom/_GG03.pyx":657
 *                     ind[NP] = NRPhi0[ii] + indZ[zz]*NRPhi[ii] + indiijj
 *                     dV[NP] = dRr*dZr*dRPhir[ii]
 *                     NP += 1             # <<<<<<<<<<<<<<
 * 
 *     if VPoly is not None:
 */
          __pyx_v_NP = (__pyx_v_NP + 1);
        }
      }
    }
  }
  __pyx_L26:;

  /* "tofu/geom/_GG03.pyx":659
 *                     NP += 1
 * 
 *     if VPoly is not None:             # <<<<<<<<<<<<<<
 *         if Out.lower()=='(x,y,z)':
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 */
  __pyx_t_14 = (__pyx_v_VPoly != Py_None);
  __pyx_t_13 = (__pyx_t_14 != 0);
  if (__pyx_t_13) {

    /* "tofu/geom/_GG03.pyx":660
 * 
 *     if VPoly is not None:
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 660, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_13) {

      /* "tofu/geom/_GG03.pyx":661
 *     if VPoly is not None:
 *         if Out.lower()=='(x,y,z)':
 *             R = np.hypot(Pts[0,:],Pts[1,:])             # <<<<<<<<<<<<<<
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_hypot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_tuple__114); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_66 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_tuple__116); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_66);
      __pyx_t_6 = NULL;
      __pyx_t_19 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
          __pyx_t_19 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_66};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_66};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_19, 2+__pyx_t_19); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
      } else
      #endif
      {
        __pyx_t_65 = PyTuple_New(2+__pyx_t_19); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 661, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_65);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_65, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_65, 0+__pyx_t_19, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_66);
        PyTuple_SET_ITEM(__pyx_t_65, 1+__pyx_t_19, __pyx_t_66);
        __pyx_t_3 = 0;
        __pyx_t_66 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_65, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 661, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
      if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 661, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1);
      __pyx_v_R = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;

      /* "tofu/geom/_GG03.pyx":662
 *         if Out.lower()=='(x,y,z)':
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(R)
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_65 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __pyx_t_66 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_66 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_66)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_66);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_66) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_65); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_66, __pyx_t_65};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_66); __pyx_t_66 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_66, __pyx_t_65};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_66); __pyx_t_66 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_66); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_66); __pyx_t_66 = NULL;
          __Pyx_GIVEREF(__pyx_t_65);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_65);
          __pyx_t_65 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_65 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_R, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_66 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_tuple__118); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_66);
      __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_66);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_66);
      __pyx_t_3 = 0;
      __pyx_t_66 = 0;
      __pyx_t_66 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_65))) {
        __pyx_t_66 = PyMethod_GET_SELF(__pyx_t_65);
        if (likely(__pyx_t_66)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_65);
          __Pyx_INCREF(__pyx_t_66);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_65, function);
        }
      }
      if (!__pyx_t_66) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_65, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_66, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_66); __pyx_t_66 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_66, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_66); __pyx_t_66 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_66); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_66); __pyx_t_66 = NULL;
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_65, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __pyx_t_65 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_T); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_65);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_65);
      __pyx_t_65 = 0;
      __pyx_t_65 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      if (PyDict_SetItem(__pyx_t_65, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 662, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_65, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 662, __pyx_L1_error)
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_65); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 662, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __pyx_v_indin = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "tofu/geom/_GG03.pyx":663
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]             # <<<<<<<<<<<<<<
 *             Ru = np.unique(R)
 *         else:
 */
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_slice__119);
      __Pyx_GIVEREF(__pyx_slice__119);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__119);
      __Pyx_INCREF(__pyx_v_indin);
      __Pyx_GIVEREF(__pyx_v_indin);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_indin);
      __pyx_t_65 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_3); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_65) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_65, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 663, __pyx_L1_error)
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_dV), __pyx_v_indin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 663, __pyx_L1_error)
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_indin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 663, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 663, __pyx_L1_error)
      __pyx_t_49 = ((PyArrayObject *)__pyx_t_65);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_49, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_19 < 0)) {
          PyErr_Fetch(&__pyx_t_52, &__pyx_t_51, &__pyx_t_50);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_50);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_52, __pyx_t_51, __pyx_t_50);
          }
          __pyx_t_52 = __pyx_t_51 = __pyx_t_50 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
      }
      __pyx_t_49 = 0;
      __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_65));
      __pyx_t_65 = 0;
      __pyx_t_64 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
        __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_19 < 0)) {
          PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
          }
          __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
        }
        __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __Pyx_DECREF_SET(__pyx_v_dV, ((PyArrayObject *)__pyx_t_3));
      __pyx_t_3 = 0;
      __pyx_t_64 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
        __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_19 < 0)) {
          PyErr_Fetch(&__pyx_t_52, &__pyx_t_51, &__pyx_t_50);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_50);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_52, __pyx_t_51, __pyx_t_50);
          }
          __pyx_t_52 = __pyx_t_51 = __pyx_t_50 = 0;
        }
        __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 663, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "tofu/geom/_GG03.pyx":664
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(R)             # <<<<<<<<<<<<<<
 *         else:
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_65 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_unique); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_R, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 664, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_65))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_65);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_65);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_65, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_65, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_65, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __pyx_v_Ru = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "tofu/geom/_GG03.pyx":660
 * 
 *     if VPoly is not None:
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 */
      goto __pyx_L40;
    }

    /* "tofu/geom/_GG03.pyx":666
 *             Ru = np.unique(R)
 *         else:
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(Pts[0,:])
 */
    /*else*/ {
      __pyx_t_65 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_65))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_65);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_65);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_65, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_65, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_65, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __pyx_t_65 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_tuple__122); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 666, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 666, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_65, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 666, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_indin = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":667
 *         else:
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]             # <<<<<<<<<<<<<<
 *             Ru = np.unique(Pts[0,:])
 *         if not np.all(Ru==R):
 */
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_slice__123);
      __Pyx_GIVEREF(__pyx_slice__123);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_slice__123);
      __Pyx_INCREF(__pyx_v_indin);
      __Pyx_GIVEREF(__pyx_v_indin);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_indin);
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 667, __pyx_L1_error)
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_dV), __pyx_v_indin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 667, __pyx_L1_error)
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_indin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 667, __pyx_L1_error)
      __pyx_t_49 = ((PyArrayObject *)__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_49, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_19 < 0)) {
          PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
          }
          __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 667, __pyx_L1_error)
      }
      __pyx_t_49 = 0;
      __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_2));
      __pyx_t_2 = 0;
      __pyx_t_64 = ((PyArrayObject *)__pyx_t_6);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
        __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_19 < 0)) {
          PyErr_Fetch(&__pyx_t_52, &__pyx_t_51, &__pyx_t_50);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_v_dV, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_52); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_50);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_52, __pyx_t_51, __pyx_t_50);
          }
          __pyx_t_52 = __pyx_t_51 = __pyx_t_50 = 0;
        }
        __pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 667, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __Pyx_DECREF_SET(__pyx_v_dV, ((PyArrayObject *)__pyx_t_6));
      __pyx_t_6 = 0;
      __pyx_t_64 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
        __pyx_t_19 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_64, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_19 < 0)) {
          PyErr_Fetch(&__pyx_t_50, &__pyx_t_51, &__pyx_t_52);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_50); Py_XDECREF(__pyx_t_51); Py_XDECREF(__pyx_t_52);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_50, __pyx_t_51, __pyx_t_52);
          }
          __pyx_t_50 = __pyx_t_51 = __pyx_t_52 = 0;
        }
        __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_19 < 0)) __PYX_ERR(0, 667, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "tofu/geom/_GG03.pyx":668
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(Pts[0,:])             # <<<<<<<<<<<<<<
 *         if not np.all(Ru==R):
 *             dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) if R[ii] in Ru])
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_unique); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_tuple__125); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 668, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_65 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_65 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_65)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_65);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_65) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_65, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_65); __pyx_t_65 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_65, __pyx_t_6};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_65); __pyx_t_65 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_65); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_65); __pyx_t_65 = NULL;
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_Ru = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L40:;

    /* "tofu/geom/_GG03.pyx":669
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(Pts[0,:])
 *         if not np.all(Ru==R):             # <<<<<<<<<<<<<<
 *             dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) if R[ii] in Ru])
 *     return Pts, dV, ind.astype(int), dRr, dZr, np.asarray(dRPhir)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_all); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_R, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_Ru, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_65 = PyTuple_New(1+1); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_65);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_65, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_65, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_65, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 669, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_14 = ((!__pyx_t_13) != 0);
    if (__pyx_t_14) {

      /* "tofu/geom/_GG03.pyx":670
 *             Ru = np.unique(Pts[0,:])
 *         if not np.all(Ru==R):
 *             dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) if R[ii] in Ru])             # <<<<<<<<<<<<<<
 *     return Pts, dV, ind.astype(int), dRr, dZr, np.asarray(dRPhir)
 * 
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_65 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_65);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = __Pyx_MemoryView_Len(__pyx_v_R); 
      for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_12; __pyx_t_19+=1) {
        __pyx_v_ii = __pyx_t_19;
        __pyx_t_103 = __pyx_v_ii;
        __pyx_t_6 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_103)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_14 = (__Pyx_PySequence_ContainsTF(__pyx_t_6, __pyx_v_Ru, Py_EQ)); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_13 = (__pyx_t_14 != 0);
        if (__pyx_t_13) {
          __pyx_t_104 = __pyx_v_ii;
          __pyx_t_6 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhir.data) + __pyx_t_104)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 670, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 670, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_65))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_65);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_65);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_65, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_65, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_65)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 670, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_65, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
      __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
      if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 670, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_dRPhir, 1);
      __pyx_v_dRPhir = __pyx_t_18;
      __pyx_t_18.memview = NULL;
      __pyx_t_18.data = NULL;

      /* "tofu/geom/_GG03.pyx":669
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(Pts[0,:])
 *         if not np.all(Ru==R):             # <<<<<<<<<<<<<<
 *             dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) if R[ii] in Ru])
 *     return Pts, dV, ind.astype(int), dRr, dZr, np.asarray(dRPhir)
 */
    }

    /* "tofu/geom/_GG03.pyx":659
 *                     NP += 1
 * 
 *     if VPoly is not None:             # <<<<<<<<<<<<<<
 *         if Out.lower()=='(x,y,z)':
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 */
  }

  /* "tofu/geom/_GG03.pyx":671
 *         if not np.all(Ru==R):
 *             dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) if R[ii] in Ru])
 *     return Pts, dV, ind.astype(int), dRr, dZr, np.asarray(dRPhir)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_65 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ind), __pyx_n_s_astype); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_65);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_65))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_65);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_65);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_65, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_65, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_65)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_65)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_65, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)(&PyInt_Type)));
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_65, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_65); __pyx_t_65 = 0;
  __pyx_t_65 = PyFloat_FromDouble(__pyx_v_dRr); if (unlikely(!__pyx_t_65)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_65);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dZr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_66 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_66);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_dRPhir, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_66))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_66);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_66);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_66, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_66, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_66)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_66, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_66)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_66, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_66, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 671, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_66); __pyx_t_66 = 0;
  __pyx_t_66 = PyTuple_New(6); if (unlikely(!__pyx_t_66)) __PYX_ERR(0, 671, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_66);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_66, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dV));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dV));
  PyTuple_SET_ITEM(__pyx_t_66, 1, ((PyObject *)__pyx_v_dV));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_66, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_65);
  PyTuple_SET_ITEM(__pyx_t_66, 3, __pyx_t_65);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_66, 4, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_66, 5, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_65 = 0;
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_66;
  __pyx_t_66 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":547
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[::1] RMinMax, double[::1] ZMinMax,
 *                                    DR=None, DZ=None, DPhi=None, VPoly=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
  __Pyx_XDECREF(__pyx_t_65);
  __Pyx_XDECREF(__pyx_t_66);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Tor_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_R0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Z, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dRPhir, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dPhir, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indR0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indR, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indZ, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Phin, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi0, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_indI);
  __Pyx_XDECREF((PyObject *)__pyx_v_iii);
  __Pyx_XDECREF((PyObject *)__pyx_v_dV);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_indin);
  __Pyx_XDECREF(__pyx_v_Ru);
  __PYX_XDEC_MEMVIEW(&__pyx_v_RMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ZMinMax, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":679
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromInd_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[::1] RMinMax, double[::1] ZMinMax, long[::1] ind,
 *                                      str Out='(X,Y,Z)', double margin=1.e-9):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_25_Ves_Vmesh_Tor_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_24_Ves_Vmesh_Tor_SubFromInd_cython[] = " Return the desired submesh indicated by the (numerical) indices, for the desired resolution (dR,dZ,dRphi) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_25_Ves_Vmesh_Tor_SubFromInd_cython = {"_Ves_Vmesh_Tor_SubFromInd_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_25_Ves_Vmesh_Tor_SubFromInd_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_24_Ves_Vmesh_Tor_SubFromInd_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_25_Ves_Vmesh_Tor_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_dR;
  double __pyx_v_dZ;
  double __pyx_v_dRPhi;
  __Pyx_memviewslice __pyx_v_RMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ZMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ind = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_Out = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Tor_SubFromInd_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dR,&__pyx_n_s_dZ,&__pyx_n_s_dRPhi,&__pyx_n_s_RMinMax,&__pyx_n_s_ZMinMax,&__pyx_n_s_ind,&__pyx_n_s_Out,&__pyx_n_s_margin,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    values[6] = ((PyObject*)__pyx_kp_s_X_Y_Z);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dR)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dZ)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromInd_cython", 0, 6, 8, 1); __PYX_ERR(0, 679, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dRPhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromInd_cython", 0, 6, 8, 2); __PYX_ERR(0, 679, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromInd_cython", 0, 6, 8, 3); __PYX_ERR(0, 679, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ZMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromInd_cython", 0, 6, 8, 4); __PYX_ERR(0, 679, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromInd_cython", 0, 6, 8, 5); __PYX_ERR(0, 679, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Vmesh_Tor_SubFromInd_cython") < 0)) __PYX_ERR(0, 679, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dR = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_dR == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 679, __pyx_L3_error)
    __pyx_v_dZ = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 679, __pyx_L3_error)
    __pyx_v_dRPhi = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dRPhi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 679, __pyx_L3_error)
    __pyx_v_RMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[3]); if (unlikely(!__pyx_v_RMinMax.memview)) __PYX_ERR(0, 680, __pyx_L3_error)
    __pyx_v_ZMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[4]); if (unlikely(!__pyx_v_ZMinMax.memview)) __PYX_ERR(0, 680, __pyx_L3_error)
    __pyx_v_ind = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[5]); if (unlikely(!__pyx_v_ind.memview)) __PYX_ERR(0, 680, __pyx_L3_error)
    __pyx_v_Out = ((PyObject*)values[6]);
    if (values[7]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 681, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Tor_SubFromInd_cython", 0, 6, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 679, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Tor_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Out), (&PyString_Type), 1, "Out", 1))) __PYX_ERR(0, 681, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_24_Ves_Vmesh_Tor_SubFromInd_cython(__pyx_self, __pyx_v_dR, __pyx_v_dZ, __pyx_v_dRPhi, __pyx_v_RMinMax, __pyx_v_ZMinMax, __pyx_v_ind, __pyx_v_Out, __pyx_v_margin);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_24_Ves_Vmesh_Tor_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dR, double __pyx_v_dZ, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_RMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, __Pyx_memviewslice __pyx_v_ind, PyObject *__pyx_v_Out, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_R = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Z = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dRPhirRef = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dPhir = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Ru = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dRPhir = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dRr;
  double __pyx_v_dZr;
  double __pyx_v_phi;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_indR = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_indZ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_v_NR;
  long __pyx_v_NZ;
  CYTHON_UNUSED long __pyx_v_Rn;
  CYTHON_UNUSED long __pyx_v_Zn;
  long __pyx_v_NP;
  long __pyx_v_Rratio;
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_iiR;
  int __pyx_v_iiZ;
  int __pyx_v_iiphi;
  __Pyx_memviewslice __pyx_v_Phi = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_dV = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dV;
  __Pyx_Buffer __pyx_pybuffer_dV;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_12;
  __Pyx_memviewslice __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_t_14;
  size_t __pyx_t_15;
  __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  int __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  __Pyx_memviewslice __pyx_t_31 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  long __pyx_t_36;
  int __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  PyObject *__pyx_t_90 = NULL;
  PyObject *__pyx_t_91 = NULL;
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Tor_SubFromInd_cython", 0);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_dV.pybuffer.buf = NULL;
  __pyx_pybuffer_dV.refcount = 0;
  __pyx_pybuffernd_dV.data = NULL;
  __pyx_pybuffernd_dV.rcbuffer = &__pyx_pybuffer_dV;

  /* "tofu/geom/_GG03.pyx":686
 *     cdef double dRr, dZr, phi
 *     cdef long[::1] indR, indZ, NRPhi0, NRPhi
 *     cdef long NR, NZ, Rn, Zn, NP=len(ind), Rratio             # <<<<<<<<<<<<<<
 *     cdef int ii=0, jj=0, iiR, iiZ, iiphi
 *     cdef double[:,::1] Phi
 */
  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ind); 
  __pyx_v_NP = __pyx_t_1;

  /* "tofu/geom/_GG03.pyx":687
 *     cdef long[::1] indR, indZ, NRPhi0, NRPhi
 *     cdef long NR, NZ, Rn, Zn, NP=len(ind), Rratio
 *     cdef int ii=0, jj=0, iiR, iiZ, iiphi             # <<<<<<<<<<<<<<
 *     cdef double[:,::1] Phi
 *     cdef cnp.ndarray[double,ndim=2] Pts=np.empty((3,NP))
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;

  /* "tofu/geom/_GG03.pyx":689
 *     cdef int ii=0, jj=0, iiR, iiZ, iiphi
 *     cdef double[:,::1] Phi
 *     cdef cnp.ndarray[double,ndim=2] Pts=np.empty((3,NP))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] dV=np.empty((NP,))
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_NP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 689, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_Pts = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 689, __pyx_L1_error)
    } else {__pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":690
 *     cdef double[:,::1] Phi
 *     cdef cnp.ndarray[double,ndim=2] Pts=np.empty((3,NP))
 *     cdef cnp.ndarray[double,ndim=1] dV=np.empty((NP,))             # <<<<<<<<<<<<<<
 * 
 *     # Get the actual R and Z resolutions and mesh elements
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_NP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 690, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 690, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dV.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dV = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 690, __pyx_L1_error)
    } else {__pyx_pybuffernd_dV.diminfo[0].strides = __pyx_pybuffernd_dV.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dV.diminfo[0].shape = __pyx_pybuffernd_dV.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_dV = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":693
 * 
 *     # Get the actual R and Z resolutions and mesh elements
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)
 *     Rn, Zn = len(R), len(Z)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_RMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
  __pyx_t_6 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_6) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 693, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_2,&__pyx_t_4};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 693, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_2,&__pyx_t_4};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 693, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_10(__pyx_t_9); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 4) < 0) __PYX_ERR(0, 693, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 693, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_3);
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_t_4); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 693, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_R = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_v_dRr = __pyx_t_12;
  __pyx_v_indR = __pyx_t_13;
  __pyx_t_13.memview = NULL;
  __pyx_t_13.data = NULL;
  __pyx_v_NR = __pyx_t_14;

  /* "tofu/geom/_GG03.pyx":694
 *     # Get the actual R and Z resolutions and mesh elements
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, None, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Rn, Zn = len(R), len(Z)
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_ZMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dZ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_4) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 694, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_6,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 694, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_5,&__pyx_t_6,&__pyx_t_3};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 694, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_10(__pyx_t_9); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 4) < 0) __PYX_ERR(0, 694, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 694, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2);
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_6);
  if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Z = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_v_dZr = __pyx_t_12;
  __pyx_v_indZ = __pyx_t_13;
  __pyx_t_13.memview = NULL;
  __pyx_t_13.data = NULL;
  __pyx_v_NZ = __pyx_t_14;

  /* "tofu/geom/_GG03.pyx":695
 *     R, dRr, indR, NR = _Ves_mesh_dlfromL_cython(RMinMax, dR, None, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)
 *     Rn, Zn = len(R), len(Z)             # <<<<<<<<<<<<<<
 * 
 *     # Number of Phi per R
 */
  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_R); 
  __pyx_t_15 = __Pyx_MemoryView_Len(__pyx_v_Z); 
  __pyx_v_Rn = __pyx_t_1;
  __pyx_v_Zn = __pyx_t_15;

  /* "tofu/geom/_GG03.pyx":698
 * 
 *     # Number of Phi per R
 *     dRPhirRef, dPhir = np.empty((NR,)), np.empty((NR,))             # <<<<<<<<<<<<<<
 *     Ru, dRPhir = np.zeros((NR,)), np.nan*np.ones((NR,))
 *     NRPhi, NRPhi0 = np.empty((NR,),dtype=int), np.empty((NR+1,),dtype=int)
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_NR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_NR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
  if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 698, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_dRPhirRef = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_v_dPhir = __pyx_t_16;
  __pyx_t_16.memview = NULL;
  __pyx_t_16.data = NULL;

  /* "tofu/geom/_GG03.pyx":699
 *     # Number of Phi per R
 *     dRPhirRef, dPhir = np.empty((NR,)), np.empty((NR,))
 *     Ru, dRPhir = np.zeros((NR,)), np.nan*np.ones((NR,))             # <<<<<<<<<<<<<<
 *     NRPhi, NRPhi0 = np.empty((NR,),dtype=int), np.empty((NR+1,),dtype=int)
 *     Rratio = int(Cceil(R[NR-1]/R[0]))
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_NR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
  if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ones); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_NR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 699, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_5);
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 699, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_Ru = __pyx_t_16;
  __pyx_t_16.memview = NULL;
  __pyx_t_16.data = NULL;
  __pyx_v_dRPhir = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "tofu/geom/_GG03.pyx":700
 *     dRPhirRef, dPhir = np.empty((NR,)), np.empty((NR,))
 *     Ru, dRPhir = np.zeros((NR,)), np.nan*np.ones((NR,))
 *     NRPhi, NRPhi0 = np.empty((NR,),dtype=int), np.empty((NR+1,),dtype=int)             # <<<<<<<<<<<<<<
 *     Rratio = int(Cceil(R[NR-1]/R[0]))
 *     for ii in range(0,NR):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_NR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 700, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_9);
  if (unlikely(!__pyx_t_13.memview)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_NR + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 700, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_4);
  if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 700, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_NRPhi = __pyx_t_13;
  __pyx_t_13.memview = NULL;
  __pyx_t_13.data = NULL;
  __pyx_v_NRPhi0 = __pyx_t_17;
  __pyx_t_17.memview = NULL;
  __pyx_t_17.data = NULL;

  /* "tofu/geom/_GG03.pyx":701
 *     Ru, dRPhir = np.zeros((NR,)), np.nan*np.ones((NR,))
 *     NRPhi, NRPhi0 = np.empty((NR,),dtype=int), np.empty((NR+1,),dtype=int)
 *     Rratio = int(Cceil(R[NR-1]/R[0]))             # <<<<<<<<<<<<<<
 *     for ii in range(0,NR):
 *         NRPhi[ii] = <long>(Cceil(2.*Cpi*R[ii]/dRPhi))
 */
  __pyx_t_18 = (__pyx_v_NR - 1);
  __pyx_t_19 = 0;
  __pyx_v_Rratio = ((long)ceil(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_18)) ))) / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_19)) ))))));

  /* "tofu/geom/_GG03.pyx":702
 *     NRPhi, NRPhi0 = np.empty((NR,),dtype=int), np.empty((NR+1,),dtype=int)
 *     Rratio = int(Cceil(R[NR-1]/R[0]))
 *     for ii in range(0,NR):             # <<<<<<<<<<<<<<
 *         NRPhi[ii] = <long>(Cceil(2.*Cpi*R[ii]/dRPhi))
 *         dRPhirRef[ii] = 2.*Cpi*R[ii]/<double>(NRPhi[ii])
 */
  __pyx_t_14 = __pyx_v_NR;
  for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_14; __pyx_t_20+=1) {
    __pyx_v_ii = __pyx_t_20;

    /* "tofu/geom/_GG03.pyx":703
 *     Rratio = int(Cceil(R[NR-1]/R[0]))
 *     for ii in range(0,NR):
 *         NRPhi[ii] = <long>(Cceil(2.*Cpi*R[ii]/dRPhi))             # <<<<<<<<<<<<<<
 *         dRPhirRef[ii] = 2.*Cpi*R[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/<double>(NRPhi[ii])
 */
    __pyx_t_21 = __pyx_v_ii;
    __pyx_t_22 = __pyx_v_ii;
    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_22)) )) = ((long)ceil((((2. * M_PI) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_21)) )))) / __pyx_v_dRPhi)));

    /* "tofu/geom/_GG03.pyx":704
 *     for ii in range(0,NR):
 *         NRPhi[ii] = <long>(Cceil(2.*Cpi*R[ii]/dRPhi))
 *         dRPhirRef[ii] = 2.*Cpi*R[ii]/<double>(NRPhi[ii])             # <<<<<<<<<<<<<<
 *         dPhir[ii] = 2.*Cpi/<double>(NRPhi[ii])
 *         if ii==0:
 */
    __pyx_t_23 = __pyx_v_ii;
    __pyx_t_24 = __pyx_v_ii;
    __pyx_t_25 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_25)) )) = (((2. * M_PI) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_23)) )))) / ((double)(*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_24)) )))));

    /* "tofu/geom/_GG03.pyx":705
 *         NRPhi[ii] = <long>(Cceil(2.*Cpi*R[ii]/dRPhi))
 *         dRPhirRef[ii] = 2.*Cpi*R[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/<double>(NRPhi[ii])             # <<<<<<<<<<<<<<
 *         if ii==0:
 *             NRPhi0[ii] = 0
 */
    __pyx_t_26 = __pyx_v_ii;
    __pyx_t_27 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_27)) )) = ((2. * M_PI) / ((double)(*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_26)) )))));

    /* "tofu/geom/_GG03.pyx":706
 *         dRPhirRef[ii] = 2.*Cpi*R[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/<double>(NRPhi[ii])
 *         if ii==0:             # <<<<<<<<<<<<<<
 *             NRPhi0[ii] = 0
 *             Phi = np.empty((NR,NRPhi[ii]*Rratio+1))
 */
    __pyx_t_28 = ((__pyx_v_ii == 0) != 0);
    if (__pyx_t_28) {

      /* "tofu/geom/_GG03.pyx":707
 *         dPhir[ii] = 2.*Cpi/<double>(NRPhi[ii])
 *         if ii==0:
 *             NRPhi0[ii] = 0             # <<<<<<<<<<<<<<
 *             Phi = np.empty((NR,NRPhi[ii]*Rratio+1))
 *         else:
 */
      __pyx_t_29 = __pyx_v_ii;
      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_29)) )) = 0;

      /* "tofu/geom/_GG03.pyx":708
 *         if ii==0:
 *             NRPhi0[ii] = 0
 *             Phi = np.empty((NR,NRPhi[ii]*Rratio+1))             # <<<<<<<<<<<<<<
 *         else:
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]*NZ
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_long(__pyx_v_NR); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_30 = __pyx_v_ii;
      __pyx_t_3 = __Pyx_PyInt_From_long((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_30)) ))) * __pyx_v_Rratio) + 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 708, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 708, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_31 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_4);
      if (unlikely(!__pyx_t_31.memview)) __PYX_ERR(0, 708, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_Phi, 1);
      __pyx_v_Phi = __pyx_t_31;
      __pyx_t_31.memview = NULL;
      __pyx_t_31.data = NULL;

      /* "tofu/geom/_GG03.pyx":706
 *         dRPhirRef[ii] = 2.*Cpi*R[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = 2.*Cpi/<double>(NRPhi[ii])
 *         if ii==0:             # <<<<<<<<<<<<<<
 *             NRPhi0[ii] = 0
 *             Phi = np.empty((NR,NRPhi[ii]*Rratio+1))
 */
      goto __pyx_L9;
    }

    /* "tofu/geom/_GG03.pyx":710
 *             Phi = np.empty((NR,NRPhi[ii]*Rratio+1))
 *         else:
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]*NZ             # <<<<<<<<<<<<<<
 *         for jj in range(0,NRPhi[ii]):
 *             Phi[ii,jj] = -Cpi + (0.5+<double>jj)*dPhir[ii]
 */
    /*else*/ {
      __pyx_t_32 = (__pyx_v_ii - 1);
      __pyx_t_33 = (__pyx_v_ii - 1);
      __pyx_t_34 = __pyx_v_ii;
      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_34)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_32)) ))) + ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_33)) ))) * __pyx_v_NZ));
    }
    __pyx_L9:;

    /* "tofu/geom/_GG03.pyx":711
 *         else:
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]*NZ
 *         for jj in range(0,NRPhi[ii]):             # <<<<<<<<<<<<<<
 *             Phi[ii,jj] = -Cpi + (0.5+<double>jj)*dPhir[ii]
 * 
 */
    __pyx_t_35 = __pyx_v_ii;
    __pyx_t_36 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_35)) )));
    for (__pyx_t_37 = 0; __pyx_t_37 < __pyx_t_36; __pyx_t_37+=1) {
      __pyx_v_jj = __pyx_t_37;

      /* "tofu/geom/_GG03.pyx":712
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]*NZ
 *         for jj in range(0,NRPhi[ii]):
 *             Phi[ii,jj] = -Cpi + (0.5+<double>jj)*dPhir[ii]             # <<<<<<<<<<<<<<
 * 
 *     if Out.lower()=='(x,y,z)':
 */
      __pyx_t_38 = __pyx_v_ii;
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 712, __pyx_L1_error) }
      __pyx_t_39 = __pyx_v_ii;
      __pyx_t_40 = __pyx_v_jj;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_39 * __pyx_v_Phi.strides[0]) )) + __pyx_t_40)) )) = ((-M_PI) + ((0.5 + ((double)__pyx_v_jj)) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_38)) )))));
    }
  }

  /* "tofu/geom/_GG03.pyx":714
 *             Phi[ii,jj] = -Cpi + (0.5+<double>jj)*dPhir[ii]
 * 
 *     if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 714, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_28 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_28 < 0)) __PYX_ERR(0, 714, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_28) {

    /* "tofu/geom/_GG03.pyx":715
 * 
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,NP):             # <<<<<<<<<<<<<<
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 */
    __pyx_t_14 = __pyx_v_NP;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_14; __pyx_t_20+=1) {
      __pyx_v_ii = __pyx_t_20;

      /* "tofu/geom/_GG03.pyx":716
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):             # <<<<<<<<<<<<<<
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 */
      __pyx_t_36 = (__pyx_v_NR + 1);
      for (__pyx_t_37 = 0; __pyx_t_37 < __pyx_t_36; __pyx_t_37+=1) {
        __pyx_v_jj = __pyx_t_37;

        /* "tofu/geom/_GG03.pyx":717
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiR = jj-1
 */
        __pyx_t_41 = __pyx_v_ii;
        __pyx_t_42 = __pyx_v_jj;
        __pyx_t_28 = ((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_41)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_42)) )))) < 0.) != 0);
        if (__pyx_t_28) {

          /* "tofu/geom/_GG03.pyx":718
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break             # <<<<<<<<<<<<<<
 *             iiR = jj-1
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 */
          goto __pyx_L16_break;

          /* "tofu/geom/_GG03.pyx":717
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiR = jj-1
 */
        }
      }
      __pyx_L16_break:;

      /* "tofu/geom/_GG03.pyx":719
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 *             iiR = jj-1             # <<<<<<<<<<<<<<
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 */
      __pyx_v_iiR = (__pyx_v_jj - 1);

      /* "tofu/geom/_GG03.pyx":720
 *                     break
 *             iiR = jj-1
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]             # <<<<<<<<<<<<<<
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 *             phi = Phi[iiR,iiphi]
 */
      __pyx_t_43 = __pyx_v_ii;
      __pyx_t_44 = __pyx_v_iiR;
      __pyx_t_45 = __pyx_v_iiR;
      __pyx_v_iiZ = (((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_43)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_44)) )))) / (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_45)) ))));

      /* "tofu/geom/_GG03.pyx":721
 *             iiR = jj-1
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]             # <<<<<<<<<<<<<<
 *             phi = Phi[iiR,iiphi]
 *             Pts[0,ii] = R[iiR]*Ccos(phi)
 */
      __pyx_t_46 = __pyx_v_ii;
      __pyx_t_47 = __pyx_v_iiR;
      __pyx_t_48 = __pyx_v_iiR;
      __pyx_v_iiphi = (((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_46)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_47)) )))) - (__pyx_v_iiZ * (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_48)) )))));

      /* "tofu/geom/_GG03.pyx":722
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 *             phi = Phi[iiR,iiphi]             # <<<<<<<<<<<<<<
 *             Pts[0,ii] = R[iiR]*Ccos(phi)
 *             Pts[1,ii] = R[iiR]*Csin(phi)
 */
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 722, __pyx_L1_error) }
      __pyx_t_49 = __pyx_v_iiR;
      __pyx_t_50 = __pyx_v_iiphi;
      __pyx_v_phi = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_49 * __pyx_v_Phi.strides[0]) )) + __pyx_t_50)) )));

      /* "tofu/geom/_GG03.pyx":723
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 *             phi = Phi[iiR,iiphi]
 *             Pts[0,ii] = R[iiR]*Ccos(phi)             # <<<<<<<<<<<<<<
 *             Pts[1,ii] = R[iiR]*Csin(phi)
 *             Pts[2,ii] = Z[iiZ]
 */
      __pyx_t_51 = __pyx_v_iiR;
      __pyx_t_52 = 0;
      __pyx_t_53 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_51)) ))) * cos(__pyx_v_phi));

      /* "tofu/geom/_GG03.pyx":724
 *             phi = Phi[iiR,iiphi]
 *             Pts[0,ii] = R[iiR]*Ccos(phi)
 *             Pts[1,ii] = R[iiR]*Csin(phi)             # <<<<<<<<<<<<<<
 *             Pts[2,ii] = Z[iiZ]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 */
      __pyx_t_54 = __pyx_v_iiR;
      __pyx_t_55 = 1;
      __pyx_t_56 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_54)) ))) * sin(__pyx_v_phi));

      /* "tofu/geom/_GG03.pyx":725
 *             Pts[0,ii] = R[iiR]*Ccos(phi)
 *             Pts[1,ii] = R[iiR]*Csin(phi)
 *             Pts[2,ii] = Z[iiZ]             # <<<<<<<<<<<<<<
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:
 */
      __pyx_t_57 = __pyx_v_iiZ;
      __pyx_t_58 = 2;
      __pyx_t_59 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Z.data) + __pyx_t_57)) )));

      /* "tofu/geom/_GG03.pyx":726
 *             Pts[1,ii] = R[iiR]*Csin(phi)
 *             Pts[2,ii] = Z[iiZ]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]             # <<<<<<<<<<<<<<
 *             if Ru[iiR]==0.:
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 */
      __pyx_t_60 = __pyx_v_iiR;
      __pyx_t_61 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_dV.diminfo[0].strides) = ((__pyx_v_dRr * __pyx_v_dZr) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_60)) ))));

      /* "tofu/geom/_GG03.pyx":727
 *             Pts[2,ii] = Z[iiZ]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 *                 Ru[iiR] = 1.
 */
      __pyx_t_62 = __pyx_v_iiR;
      __pyx_t_28 = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Ru.data) + __pyx_t_62)) ))) == 0.) != 0);
      if (__pyx_t_28) {

        /* "tofu/geom/_GG03.pyx":728
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:
 *                 dRPhir[iiR] = dRPhirRef[iiR]             # <<<<<<<<<<<<<<
 *                 Ru[iiR] = 1.
 *     else:
 */
        __pyx_t_63 = __pyx_v_iiR;
        __pyx_t_64 = __pyx_v_iiR;
        *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhir.data) + __pyx_t_64)) )) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_63)) )));

        /* "tofu/geom/_GG03.pyx":729
 *             if Ru[iiR]==0.:
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 *                 Ru[iiR] = 1.             # <<<<<<<<<<<<<<
 *     else:
 *         for ii in range(0,NP):
 */
        __pyx_t_65 = __pyx_v_iiR;
        *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Ru.data) + __pyx_t_65)) )) = 1.;

        /* "tofu/geom/_GG03.pyx":727
 *             Pts[2,ii] = Z[iiZ]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 *                 Ru[iiR] = 1.
 */
      }
    }

    /* "tofu/geom/_GG03.pyx":714
 *             Phi[ii,jj] = -Cpi + (0.5+<double>jj)*dPhir[ii]
 * 
 *     if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):
 */
    goto __pyx_L12;
  }

  /* "tofu/geom/_GG03.pyx":731
 *                 Ru[iiR] = 1.
 *     else:
 *         for ii in range(0,NP):             # <<<<<<<<<<<<<<
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 */
  /*else*/ {
    __pyx_t_14 = __pyx_v_NP;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_14; __pyx_t_20+=1) {
      __pyx_v_ii = __pyx_t_20;

      /* "tofu/geom/_GG03.pyx":732
 *     else:
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):             # <<<<<<<<<<<<<<
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 */
      __pyx_t_36 = (__pyx_v_NR + 1);
      for (__pyx_t_37 = 0; __pyx_t_37 < __pyx_t_36; __pyx_t_37+=1) {
        __pyx_v_jj = __pyx_t_37;

        /* "tofu/geom/_GG03.pyx":733
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiR = jj-1
 */
        __pyx_t_66 = __pyx_v_ii;
        __pyx_t_67 = __pyx_v_jj;
        __pyx_t_28 = ((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_66)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_67)) )))) < 0.) != 0);
        if (__pyx_t_28) {

          /* "tofu/geom/_GG03.pyx":734
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break             # <<<<<<<<<<<<<<
 *             iiR = jj-1
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 */
          goto __pyx_L22_break;

          /* "tofu/geom/_GG03.pyx":733
 *         for ii in range(0,NP):
 *             for jj in range(0,NR+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiR = jj-1
 */
        }
      }
      __pyx_L22_break:;

      /* "tofu/geom/_GG03.pyx":735
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 *             iiR = jj-1             # <<<<<<<<<<<<<<
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 */
      __pyx_v_iiR = (__pyx_v_jj - 1);

      /* "tofu/geom/_GG03.pyx":736
 *                     break
 *             iiR = jj-1
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]             # <<<<<<<<<<<<<<
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 *             Pts[0,ii] = R[iiR]
 */
      __pyx_t_68 = __pyx_v_ii;
      __pyx_t_69 = __pyx_v_iiR;
      __pyx_t_70 = __pyx_v_iiR;
      __pyx_v_iiZ = (((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_68)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_69)) )))) / (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_70)) ))));

      /* "tofu/geom/_GG03.pyx":737
 *             iiR = jj-1
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]             # <<<<<<<<<<<<<<
 *             Pts[0,ii] = R[iiR]
 *             Pts[1,ii] = Z[iiZ]
 */
      __pyx_t_71 = __pyx_v_ii;
      __pyx_t_72 = __pyx_v_iiR;
      __pyx_t_73 = __pyx_v_iiR;
      __pyx_v_iiphi = (((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_71)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_72)) )))) - (__pyx_v_iiZ * (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_73)) )))));

      /* "tofu/geom/_GG03.pyx":738
 *             iiZ = (ind[ii] - NRPhi0[iiR])//NRPhi[iiR]
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 *             Pts[0,ii] = R[iiR]             # <<<<<<<<<<<<<<
 *             Pts[1,ii] = Z[iiZ]
 *             Pts[2,ii] = Phi[iiR,iiphi]
 */
      __pyx_t_74 = __pyx_v_iiR;
      __pyx_t_75 = 0;
      __pyx_t_76 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_76, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_R.data) + __pyx_t_74)) )));

      /* "tofu/geom/_GG03.pyx":739
 *             iiphi = ind[ii] - NRPhi0[iiR] - iiZ*NRPhi[iiR]
 *             Pts[0,ii] = R[iiR]
 *             Pts[1,ii] = Z[iiZ]             # <<<<<<<<<<<<<<
 *             Pts[2,ii] = Phi[iiR,iiphi]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 */
      __pyx_t_77 = __pyx_v_iiZ;
      __pyx_t_78 = 1;
      __pyx_t_79 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Z.data) + __pyx_t_77)) )));

      /* "tofu/geom/_GG03.pyx":740
 *             Pts[0,ii] = R[iiR]
 *             Pts[1,ii] = Z[iiZ]
 *             Pts[2,ii] = Phi[iiR,iiphi]             # <<<<<<<<<<<<<<
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:
 */
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 740, __pyx_L1_error) }
      __pyx_t_80 = __pyx_v_iiR;
      __pyx_t_81 = __pyx_v_iiphi;
      __pyx_t_82 = 2;
      __pyx_t_83 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_80 * __pyx_v_Phi.strides[0]) )) + __pyx_t_81)) )));

      /* "tofu/geom/_GG03.pyx":741
 *             Pts[1,ii] = Z[iiZ]
 *             Pts[2,ii] = Phi[iiR,iiphi]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]             # <<<<<<<<<<<<<<
 *             if Ru[iiR]==0.:
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 */
      __pyx_t_84 = __pyx_v_iiR;
      __pyx_t_85 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dV.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_dV.diminfo[0].strides) = ((__pyx_v_dRr * __pyx_v_dZr) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_84)) ))));

      /* "tofu/geom/_GG03.pyx":742
 *             Pts[2,ii] = Phi[iiR,iiphi]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 *                 Ru[iiR] = 1.
 */
      __pyx_t_86 = __pyx_v_iiR;
      __pyx_t_28 = (((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Ru.data) + __pyx_t_86)) ))) == 0.) != 0);
      if (__pyx_t_28) {

        /* "tofu/geom/_GG03.pyx":743
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:
 *                 dRPhir[iiR] = dRPhirRef[iiR]             # <<<<<<<<<<<<<<
 *                 Ru[iiR] = 1.
 * 
 */
        __pyx_t_87 = __pyx_v_iiR;
        __pyx_t_88 = __pyx_v_iiR;
        *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhir.data) + __pyx_t_88)) )) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_87)) )));

        /* "tofu/geom/_GG03.pyx":744
 *             if Ru[iiR]==0.:
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 *                 Ru[iiR] = 1.             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dV, dRr, dZr, np.asarray(dRPhir)[~np.isnan(dRPhir)]
 */
        __pyx_t_89 = __pyx_v_iiR;
        *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_Ru.data) + __pyx_t_89)) )) = 1.;

        /* "tofu/geom/_GG03.pyx":742
 *             Pts[2,ii] = Phi[iiR,iiphi]
 *             dV[ii] = dRr*dZr*dRPhirRef[iiR]
 *             if Ru[iiR]==0.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiR] = dRPhirRef[iiR]
 *                 Ru[iiR] = 1.
 */
      }
    }
  }
  __pyx_L12:;

  /* "tofu/geom/_GG03.pyx":746
 *                 Ru[iiR] = 1.
 * 
 *     return Pts, dV, dRr, dZr, np.asarray(dRPhir)[~np.isnan(dRPhir)]             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dRr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_dZr); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dRPhir, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_2};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_90 = PyTuple_New(1+1); if (unlikely(!__pyx_t_90)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_90);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_90, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_90, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_90, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_90); __pyx_t_90 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_90 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_90)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_90);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_90, __pyx_n_s_isnan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_90); __pyx_t_90 = 0;
  __pyx_t_90 = __pyx_memoryview_fromslice(__pyx_v_dRPhir, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_90)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_90);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_90); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_90); __pyx_t_90 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_90};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_90); __pyx_t_90 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_90};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_90); __pyx_t_90 = 0;
    } else
    #endif
    {
      __pyx_t_91 = PyTuple_New(1+1); if (unlikely(!__pyx_t_91)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_91);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_91, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_90);
      PyTuple_SET_ITEM(__pyx_t_91, 0+1, __pyx_t_90);
      __pyx_t_90 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_91, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_91); __pyx_t_91 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Invert(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetItem(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dV));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dV));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_dV));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_9 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":679
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromInd_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[::1] RMinMax, double[::1] ZMinMax, long[::1] ind,
 *                                      str Out='(X,Y,Z)', double margin=1.e-9):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
  __Pyx_XDECREF(__pyx_t_90);
  __Pyx_XDECREF(__pyx_t_91);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Tor_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dV.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_R, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Z, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dRPhirRef, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dPhir, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ru, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dRPhir, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indR, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indZ, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Phi, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_dV);
  __PYX_XDEC_MEMVIEW(&__pyx_v_RMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ZMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ind, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":756
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                    double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                    DX=None, DY=None, DZ=None, VPoly=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_27_Ves_Vmesh_Lin_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_26_Ves_Vmesh_Lin_SubFromD_cython[] = " Return the desired submesh indicated by the limits (DX,DY,DZ), for the desired resolution (dX,dY,dZ) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_27_Ves_Vmesh_Lin_SubFromD_cython = {"_Ves_Vmesh_Lin_SubFromD_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_27_Ves_Vmesh_Lin_SubFromD_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_26_Ves_Vmesh_Lin_SubFromD_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_27_Ves_Vmesh_Lin_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_dX;
  double __pyx_v_dY;
  double __pyx_v_dZ;
  __Pyx_memviewslice __pyx_v_XMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_YMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ZMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_DX = 0;
  PyObject *__pyx_v_DY = 0;
  PyObject *__pyx_v_DZ = 0;
  PyObject *__pyx_v_VPoly = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Lin_SubFromD_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dX,&__pyx_n_s_dY,&__pyx_n_s_dZ,&__pyx_n_s_XMinMax,&__pyx_n_s_YMinMax,&__pyx_n_s_ZMinMax,&__pyx_n_s_DX,&__pyx_n_s_DY,&__pyx_n_s_DZ,&__pyx_n_s_VPoly,&__pyx_n_s_margin,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":758
 * def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ,
 *                                    double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                    DX=None, DY=None, DZ=None, VPoly=None,             # <<<<<<<<<<<<<<
 *                                    double margin=1.e-9):
 *     " Return the desired submesh indicated by the limits (DX,DY,DZ), for the desired resolution (dX,dY,dZ) "
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dY)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromD_cython", 0, 6, 11, 1); __PYX_ERR(0, 756, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dZ)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromD_cython", 0, 6, 11, 2); __PYX_ERR(0, 756, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_XMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromD_cython", 0, 6, 11, 3); __PYX_ERR(0, 756, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_YMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromD_cython", 0, 6, 11, 4); __PYX_ERR(0, 756, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ZMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromD_cython", 0, 6, 11, 5); __PYX_ERR(0, 756, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DX);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DY);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DZ);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Vmesh_Lin_SubFromD_cython") < 0)) __PYX_ERR(0, 756, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dX = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_dX == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 756, __pyx_L3_error)
    __pyx_v_dY = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dY == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 756, __pyx_L3_error)
    __pyx_v_dZ = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 756, __pyx_L3_error)
    __pyx_v_XMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[3]); if (unlikely(!__pyx_v_XMinMax.memview)) __PYX_ERR(0, 757, __pyx_L3_error)
    __pyx_v_YMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[4]); if (unlikely(!__pyx_v_YMinMax.memview)) __PYX_ERR(0, 757, __pyx_L3_error)
    __pyx_v_ZMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[5]); if (unlikely(!__pyx_v_ZMinMax.memview)) __PYX_ERR(0, 757, __pyx_L3_error)
    __pyx_v_DX = values[6];
    __pyx_v_DY = values[7];
    __pyx_v_DZ = values[8];
    __pyx_v_VPoly = values[9];
    if (values[10]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 759, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromD_cython", 0, 6, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 756, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Lin_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_26_Ves_Vmesh_Lin_SubFromD_cython(__pyx_self, __pyx_v_dX, __pyx_v_dY, __pyx_v_dZ, __pyx_v_XMinMax, __pyx_v_YMinMax, __pyx_v_ZMinMax, __pyx_v_DX, __pyx_v_DY, __pyx_v_DZ, __pyx_v_VPoly, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":756
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                    double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                    DX=None, DY=None, DZ=None, VPoly=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_26_Ves_Vmesh_Lin_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dX, double __pyx_v_dY, double __pyx_v_dZ, __Pyx_memviewslice __pyx_v_XMinMax, __Pyx_memviewslice __pyx_v_YMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, PyObject *__pyx_v_DX, PyObject *__pyx_v_DY, PyObject *__pyx_v_DZ, PyObject *__pyx_v_VPoly, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_X = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Y = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Z = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dXr;
  double __pyx_v_dYr;
  double __pyx_v_dZr;
  double __pyx_v_dV;
  PyArrayObject *__pyx_v_indX = 0;
  PyArrayObject *__pyx_v_indY = 0;
  PyArrayObject *__pyx_v_indZ = 0;
  int __pyx_v_NX;
  int __pyx_v_NY;
  CYTHON_UNUSED int __pyx_v_NZ;
  int __pyx_v_Xn;
  int __pyx_v_Yn;
  int __pyx_v_Zn;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_ind = 0;
  PyObject *__pyx_v_indin = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indX;
  __Pyx_Buffer __pyx_pybuffer_indX;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indY;
  __Pyx_Buffer __pyx_pybuffer_indY;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indZ;
  __Pyx_Buffer __pyx_pybuffer_indZ;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_9;
  int __pyx_t_10;
  PyArrayObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  size_t __pyx_t_16;
  size_t __pyx_t_17;
  size_t __pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  PyArrayObject *__pyx_t_25 = NULL;
  PyArrayObject *__pyx_t_26 = NULL;
  int __pyx_t_27;
  int __pyx_t_28;
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Lin_SubFromD_cython", 0);
  __pyx_pybuffer_indX.pybuffer.buf = NULL;
  __pyx_pybuffer_indX.refcount = 0;
  __pyx_pybuffernd_indX.data = NULL;
  __pyx_pybuffernd_indX.rcbuffer = &__pyx_pybuffer_indX;
  __pyx_pybuffer_indY.pybuffer.buf = NULL;
  __pyx_pybuffer_indY.refcount = 0;
  __pyx_pybuffernd_indY.data = NULL;
  __pyx_pybuffernd_indY.rcbuffer = &__pyx_pybuffer_indY;
  __pyx_pybuffer_indZ.pybuffer.buf = NULL;
  __pyx_pybuffer_indZ.refcount = 0;
  __pyx_pybuffernd_indZ.data = NULL;
  __pyx_pybuffernd_indZ.rcbuffer = &__pyx_pybuffer_indZ;
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;

  /* "tofu/geom/_GG03.pyx":770
 * 
 *     # Get the actual X, Y and Z resolutions and mesh elements
 *     X, dXr, indX, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DX, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Y, dYr, indY, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, DY, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_XMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_DX);
  __Pyx_GIVEREF(__pyx_v_DX);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_DX);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 770, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 770, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 770, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 770, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_3);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 770, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 770, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_X = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dXr = __pyx_t_9;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
    __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_12 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_v_indX, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_indX.diminfo[0].strides = __pyx_pybuffernd_indX.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indX.diminfo[0].shape = __pyx_pybuffernd_indX.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 770, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_indX = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_NX = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":771
 *     # Get the actual X, Y and Z resolutions and mesh elements
 *     X, dXr, indX, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DX, Lim=True, margin=margin)
 *     Y, dYr, indY, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, DY, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 *     Xn, Yn, Zn = len(X), len(Y), len(Z)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_YMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_DY);
  __Pyx_GIVEREF(__pyx_v_DY);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_DY);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 771, __pyx_L1_error)
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_margin, __pyx_t_5) < 0) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 771, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 771, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 771, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 771, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 771, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 771, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 771, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Y = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dYr = __pyx_t_9;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY.rcbuffer->pybuffer);
    __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_12 < 0)) {
      PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY.rcbuffer->pybuffer, (PyObject*)__pyx_v_indY, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      }
      __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_indY.diminfo[0].strides = __pyx_pybuffernd_indY.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indY.diminfo[0].shape = __pyx_pybuffernd_indY.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 771, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_indY = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_NY = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":772
 *     X, dXr, indX, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DX, Lim=True, margin=margin)
 *     Y, dYr, indY, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, DY, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Xn, Yn, Zn = len(X), len(Y), len(Z)
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_ZMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dZ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_DZ);
  __Pyx_GIVEREF(__pyx_v_DZ);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_DZ);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 772, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 772, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_1};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 772, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_1};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 772, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 772, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 772, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_2);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 772, __pyx_L1_error)
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_Z = __pyx_t_8;
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_v_dZr = __pyx_t_9;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer);
    __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_12 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_indZ.diminfo[0].strides = __pyx_pybuffernd_indZ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ.diminfo[0].shape = __pyx_pybuffernd_indZ.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 772, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_indZ = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_NZ = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":773
 *     Y, dYr, indY, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, DY, Lim=True, margin=margin)
 *     Z, dZr, indZ, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, DZ, Lim=True, margin=margin)
 *     Xn, Yn, Zn = len(X), len(Y), len(Z)             # <<<<<<<<<<<<<<
 * 
 *     Pts = np.array([np.tile(X,(Yn*Zn,1)).flatten(), np.tile(np.repeat(Y,Xn),(Zn,1)).flatten(), np.repeat(Z,Xn*Yn)])
 */
  __pyx_t_16 = __Pyx_MemoryView_Len(__pyx_v_X); 
  __pyx_t_17 = __Pyx_MemoryView_Len(__pyx_v_Y); 
  __pyx_t_18 = __Pyx_MemoryView_Len(__pyx_v_Z); 
  __pyx_v_Xn = __pyx_t_16;
  __pyx_v_Yn = __pyx_t_17;
  __pyx_v_Zn = __pyx_t_18;

  /* "tofu/geom/_GG03.pyx":775
 *     Xn, Yn, Zn = len(X), len(Y), len(Z)
 * 
 *     Pts = np.array([np.tile(X,(Yn*Zn,1)).flatten(), np.tile(np.repeat(Y,Xn),(Zn,1)).flatten(), np.repeat(Z,Xn*Yn)])             # <<<<<<<<<<<<<<
 *     ind = np.repeat(NX*NY*indZ,Xn*Yn) + np.tile(np.repeat(NX*indY,Xn),(Zn,1)).flatten() + np.tile(indX,(Yn*Zn,1)).flatten()
 *     dV = dXr*dYr*dZr
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_tile); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_X, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_19 = __Pyx_PyInt_From_int((__pyx_v_Yn * __pyx_v_Zn)); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_int_1);
  __pyx_t_19 = 0;
  __pyx_t_19 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_19)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_19);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_2, __pyx_t_20};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_2, __pyx_t_20};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  } else
  #endif
  {
    __pyx_t_21 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    if (__pyx_t_19) {
      __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19); __pyx_t_19 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_10, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_20);
    PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_10, __pyx_t_20);
    __pyx_t_2 = 0;
    __pyx_t_20 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_21, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_flatten); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 775, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_21 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_tile); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_repeat); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_Y, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_22 = __Pyx_PyInt_From_int(__pyx_v_Xn); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_23 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
    __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_19);
    if (likely(__pyx_t_23)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
      __Pyx_INCREF(__pyx_t_23);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_19, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_19)) {
    PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_2, __pyx_t_22};
    __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
    PyObject *__pyx_temp[3] = {__pyx_t_23, __pyx_t_2, __pyx_t_22};
    __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0;
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  } else
  #endif
  {
    __pyx_t_24 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_24);
    if (__pyx_t_23) {
      __Pyx_GIVEREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_23); __pyx_t_23 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_24, 0+__pyx_t_10, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_22);
    PyTuple_SET_ITEM(__pyx_t_24, 1+__pyx_t_10, __pyx_t_22);
    __pyx_t_2 = 0;
    __pyx_t_22 = 0;
    __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_24, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  }
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_Zn); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_GIVEREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_19);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_int_1);
  __pyx_t_19 = 0;
  __pyx_t_19 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
    __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_20);
    if (likely(__pyx_t_19)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_19);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_20, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_20)) {
    PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_21, __pyx_t_24};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
    PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_21, __pyx_t_24};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  } else
  #endif
  {
    __pyx_t_22 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
    if (__pyx_t_19) {
      __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_19); __pyx_t_19 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_21);
    PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_10, __pyx_t_21);
    __Pyx_GIVEREF(__pyx_t_24);
    PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_10, __pyx_t_24);
    __pyx_t_21 = 0;
    __pyx_t_24 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_22, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  }
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_flatten); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_20);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_20, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_20); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 775, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_repeat); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_Z, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_24 = __Pyx_PyInt_From_int((__pyx_v_Xn * __pyx_v_Yn)); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __pyx_t_21 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) {
    __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_22);
    if (likely(__pyx_t_21)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
      __Pyx_INCREF(__pyx_t_21);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_22, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_22)) {
    PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_4, __pyx_t_24};
    __pyx_t_20 = __Pyx_PyFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_22)) {
    PyObject *__pyx_temp[3] = {__pyx_t_21, __pyx_t_4, __pyx_t_24};
    __pyx_t_20 = __Pyx_PyCFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
  } else
  #endif
  {
    __pyx_t_19 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_19);
    if (__pyx_t_21) {
      __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_21); __pyx_t_21 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_24);
    PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_t_24);
    __pyx_t_4 = 0;
    __pyx_t_24 = 0;
    __pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_19, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  }
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = PyList_New(3); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 775, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_22, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_22, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_20);
  PyList_SET_ITEM(__pyx_t_22, 2, __pyx_t_20);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_t_20 = 0;
  __pyx_t_20 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_20)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_20);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_20) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_22); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_20, __pyx_t_22};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_20, __pyx_t_22};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 775, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_20); __pyx_t_20 = NULL;
      __Pyx_GIVEREF(__pyx_t_22);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_22);
      __pyx_t_22 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 775, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 775, __pyx_L1_error)
  __pyx_t_25 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      }
      __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 775, __pyx_L1_error)
  }
  __pyx_t_25 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":776
 * 
 *     Pts = np.array([np.tile(X,(Yn*Zn,1)).flatten(), np.tile(np.repeat(Y,Xn),(Zn,1)).flatten(), np.repeat(Z,Xn*Yn)])
 *     ind = np.repeat(NX*NY*indZ,Xn*Yn) + np.tile(np.repeat(NX*indY,Xn),(Zn,1)).flatten() + np.tile(indX,(Yn*Zn,1)).flatten()             # <<<<<<<<<<<<<<
 *     dV = dXr*dYr*dZr
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_repeat); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_NX * __pyx_v_NY)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_22 = PyNumber_Multiply(__pyx_t_5, ((PyObject *)__pyx_v_indZ)); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_Xn * __pyx_v_Yn)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_20 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_20)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_20);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_22, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
    PyObject *__pyx_temp[3] = {__pyx_t_20, __pyx_t_22, __pyx_t_5};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  #endif
  {
    __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_20) {
      __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_20); __pyx_t_20 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_22);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_t_22);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_t_5);
    __pyx_t_22 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_tile); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_20 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_19 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_repeat); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_NX); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_24 = PyNumber_Multiply(__pyx_t_20, ((PyObject *)__pyx_v_indY)); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_24);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_Xn); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_4 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_19);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_19, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_19)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_24, __pyx_t_20};
    __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_24, __pyx_t_20};
    __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  } else
  #endif
  {
    __pyx_t_21 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_21);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_24);
    PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_10, __pyx_t_24);
    __Pyx_GIVEREF(__pyx_t_20);
    PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_10, __pyx_t_20);
    __pyx_t_24 = 0;
    __pyx_t_20 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_21, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  }
  __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
  __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_Zn); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_19);
  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_GIVEREF(__pyx_t_19);
  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_1);
  __pyx_t_19 = 0;
  __pyx_t_19 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) {
    __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_22);
    if (likely(__pyx_t_19)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
      __Pyx_INCREF(__pyx_t_19);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_22, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_22)) {
    PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_5, __pyx_t_21};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_22)) {
    PyObject *__pyx_temp[3] = {__pyx_t_19, __pyx_t_5, __pyx_t_21};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  } else
  #endif
  {
    __pyx_t_20 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    if (__pyx_t_19) {
      __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_10, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_21);
    PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_10, __pyx_t_21);
    __pyx_t_5 = 0;
    __pyx_t_21 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  }
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_flatten); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_22))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_22);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_22, function);
    }
  }
  if (__pyx_t_1) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_22); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __pyx_t_22 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tile); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_Yn * __pyx_v_Zn)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  __pyx_t_10 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_20);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_20, function);
      __pyx_t_10 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_20)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_v_indX), __pyx_t_21};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
    PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_v_indX), __pyx_t_21};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_1) {
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_indX));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_indX));
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, ((PyObject *)__pyx_v_indX));
    __Pyx_GIVEREF(__pyx_t_21);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_t_21);
    __pyx_t_21 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_flatten); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_20);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_20, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_20); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyNumber_Add(__pyx_t_22, __pyx_t_6); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 776, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_20) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_20, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 776, __pyx_L1_error)
  __pyx_t_26 = ((PyArrayObject *)__pyx_t_20);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 776, __pyx_L1_error)
  }
  __pyx_t_26 = 0;
  __pyx_v_ind = ((PyArrayObject *)__pyx_t_20);
  __pyx_t_20 = 0;

  /* "tofu/geom/_GG03.pyx":777
 *     Pts = np.array([np.tile(X,(Yn*Zn,1)).flatten(), np.tile(np.repeat(Y,Xn),(Zn,1)).flatten(), np.repeat(Z,Xn*Yn)])
 *     ind = np.repeat(NX*NY*indZ,Xn*Yn) + np.tile(np.repeat(NX*indY,Xn),(Zn,1)).flatten() + np.tile(indX,(Yn*Zn,1)).flatten()
 *     dV = dXr*dYr*dZr             # <<<<<<<<<<<<<<
 * 
 *     if VPoly is not None:
 */
  __pyx_v_dV = ((__pyx_v_dXr * __pyx_v_dYr) * __pyx_v_dZr);

  /* "tofu/geom/_GG03.pyx":779
 *     dV = dXr*dYr*dZr
 * 
 *     if VPoly is not None:             # <<<<<<<<<<<<<<
 *         indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, radius=0.0)
 *         Pts, ind = Pts[:,indin], ind[indin]
 */
  __pyx_t_27 = (__pyx_v_VPoly != Py_None);
  __pyx_t_28 = (__pyx_t_27 != 0);
  if (__pyx_t_28) {

    /* "tofu/geom/_GG03.pyx":780
 * 
 *     if VPoly is not None:
 *         indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *         Pts, ind = Pts[:,indin], ind[indin]
 * 
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_VPoly, __pyx_n_s_T); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_20 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_22); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      __Pyx_GOTREF(__pyx_t_20);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_22};
        __pyx_t_20 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_22};
        __pyx_t_20 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 780, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_22);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_22);
        __pyx_t_22 = 0;
        __pyx_t_20 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __pyx_t_20 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_tuple__128); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_20, __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __pyx_t_20 = PyTuple_New(1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_20);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 780, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 780, __pyx_L1_error)
    __pyx_t_22 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_20, __pyx_t_5); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 780, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_indin = __pyx_t_22;
    __pyx_t_22 = 0;

    /* "tofu/geom/_GG03.pyx":781
 *     if VPoly is not None:
 *         indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, radius=0.0)
 *         Pts, ind = Pts[:,indin], ind[indin]             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dV, ind.astype(int), dXr, dYr, dZr
 */
    __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
    __Pyx_INCREF(__pyx_slice__129);
    __Pyx_GIVEREF(__pyx_slice__129);
    PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_slice__129);
    __Pyx_INCREF(__pyx_v_indin);
    __Pyx_GIVEREF(__pyx_v_indin);
    PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_v_indin);
    __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 781, __pyx_L1_error)
    __pyx_t_22 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_indin); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 781, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_22);
    if (!(likely(((__pyx_t_22) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_22, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 781, __pyx_L1_error)
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
        }
        __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 781, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_22);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_10 < 0)) {
        PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
        }
        __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 781, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_22));
    __pyx_t_22 = 0;

    /* "tofu/geom/_GG03.pyx":779
 *     dV = dXr*dYr*dZr
 * 
 *     if VPoly is not None:             # <<<<<<<<<<<<<<
 *         indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, radius=0.0)
 *         Pts, ind = Pts[:,indin], ind[indin]
 */
  }

  /* "tofu/geom/_GG03.pyx":783
 *         Pts, ind = Pts[:,indin], ind[indin]
 * 
 *     return Pts, dV, ind.astype(int), dXr, dYr, dZr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_22 = PyFloat_FromDouble(__pyx_v_dV); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_22);
  __pyx_t_20 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ind), __pyx_n_s_astype); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_20);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_20, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_20, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_20)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)(&PyInt_Type))};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)(&PyInt_Type))};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)(&PyInt_Type)));
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
  __pyx_t_20 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_20);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dYr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_dZr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_21 = PyTuple_New(6); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_21);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(__pyx_t_22);
  PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_22);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_20);
  PyTuple_SET_ITEM(__pyx_t_21, 3, __pyx_t_20);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_21, 4, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_21, 5, __pyx_t_6);
  __pyx_t_22 = 0;
  __pyx_t_5 = 0;
  __pyx_t_20 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_21;
  __pyx_t_21 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":756
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                    double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                    DX=None, DY=None, DZ=None, VPoly=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_23);
  __Pyx_XDECREF(__pyx_t_24);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Lin_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_X, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Y, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Z, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_indX);
  __Pyx_XDECREF((PyObject *)__pyx_v_indY);
  __Pyx_XDECREF((PyObject *)__pyx_v_indZ);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_indin);
  __PYX_XDEC_MEMVIEW(&__pyx_v_XMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_YMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ZMinMax, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":786
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromInd_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                      double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                      cnp.ndarray[long,ndim=1] ind, double margin=1.e-9):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_29_Ves_Vmesh_Lin_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_28_Ves_Vmesh_Lin_SubFromInd_cython[] = " Return the desired submesh indicated by the limits (DX,DY,DZ), for the desired resolution (dX,dY,dZ) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_29_Ves_Vmesh_Lin_SubFromInd_cython = {"_Ves_Vmesh_Lin_SubFromInd_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_29_Ves_Vmesh_Lin_SubFromInd_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_28_Ves_Vmesh_Lin_SubFromInd_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_29_Ves_Vmesh_Lin_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_dX;
  double __pyx_v_dY;
  double __pyx_v_dZ;
  __Pyx_memviewslice __pyx_v_XMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_YMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ZMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_ind = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Lin_SubFromInd_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dX,&__pyx_n_s_dY,&__pyx_n_s_dZ,&__pyx_n_s_XMinMax,&__pyx_n_s_YMinMax,&__pyx_n_s_ZMinMax,&__pyx_n_s_ind,&__pyx_n_s_margin,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dY)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, 1); __PYX_ERR(0, 786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dZ)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, 2); __PYX_ERR(0, 786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_XMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, 3); __PYX_ERR(0, 786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_YMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, 4); __PYX_ERR(0, 786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ZMinMax)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, 5); __PYX_ERR(0, 786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, 6); __PYX_ERR(0, 786, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Vmesh_Lin_SubFromInd_cython") < 0)) __PYX_ERR(0, 786, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dX = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_dX == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L3_error)
    __pyx_v_dY = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dY == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L3_error)
    __pyx_v_dZ = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dZ == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 786, __pyx_L3_error)
    __pyx_v_XMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[3]); if (unlikely(!__pyx_v_XMinMax.memview)) __PYX_ERR(0, 787, __pyx_L3_error)
    __pyx_v_YMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[4]); if (unlikely(!__pyx_v_YMinMax.memview)) __PYX_ERR(0, 787, __pyx_L3_error)
    __pyx_v_ZMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[5]); if (unlikely(!__pyx_v_ZMinMax.memview)) __PYX_ERR(0, 787, __pyx_L3_error)
    __pyx_v_ind = ((PyArrayObject *)values[6]);
    if (values[7]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 788, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Vmesh_Lin_SubFromInd_cython", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 786, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Lin_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(0, 788, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_28_Ves_Vmesh_Lin_SubFromInd_cython(__pyx_self, __pyx_v_dX, __pyx_v_dY, __pyx_v_dZ, __pyx_v_XMinMax, __pyx_v_YMinMax, __pyx_v_ZMinMax, __pyx_v_ind, __pyx_v_margin);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_28_Ves_Vmesh_Lin_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dX, double __pyx_v_dY, double __pyx_v_dZ, __Pyx_memviewslice __pyx_v_XMinMax, __Pyx_memviewslice __pyx_v_YMinMax, __Pyx_memviewslice __pyx_v_ZMinMax, PyArrayObject *__pyx_v_ind, double __pyx_v_margin) {
  PyArrayObject *__pyx_v_X = 0;
  PyArrayObject *__pyx_v_Y = 0;
  PyArrayObject *__pyx_v_Z = 0;
  double __pyx_v_dXr;
  double __pyx_v_dYr;
  double __pyx_v_dZr;
  double __pyx_v_dV;
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_bla = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_indX = 0;
  PyArrayObject *__pyx_v_indY = 0;
  PyArrayObject *__pyx_v_indZ = 0;
  int __pyx_v_NX;
  int __pyx_v_NY;
  CYTHON_UNUSED int __pyx_v_NZ;
  PyArrayObject *__pyx_v_Pts = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_X;
  __Pyx_Buffer __pyx_pybuffer_X;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Y;
  __Pyx_Buffer __pyx_pybuffer_Y;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Z;
  __Pyx_Buffer __pyx_pybuffer_Z;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indX;
  __Pyx_Buffer __pyx_pybuffer_indX;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indY;
  __Pyx_Buffer __pyx_pybuffer_indY;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indZ;
  __Pyx_Buffer __pyx_pybuffer_indZ;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  double __pyx_t_8;
  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_10;
  PyArrayObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyArrayObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  __Pyx_RefNannySetupContext("_Ves_Vmesh_Lin_SubFromInd_cython", 0);
  __pyx_pybuffer_X.pybuffer.buf = NULL;
  __pyx_pybuffer_X.refcount = 0;
  __pyx_pybuffernd_X.data = NULL;
  __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X;
  __pyx_pybuffer_Y.pybuffer.buf = NULL;
  __pyx_pybuffer_Y.refcount = 0;
  __pyx_pybuffernd_Y.data = NULL;
  __pyx_pybuffernd_Y.rcbuffer = &__pyx_pybuffer_Y;
  __pyx_pybuffer_Z.pybuffer.buf = NULL;
  __pyx_pybuffer_Z.refcount = 0;
  __pyx_pybuffernd_Z.data = NULL;
  __pyx_pybuffernd_Z.rcbuffer = &__pyx_pybuffer_Z;
  __pyx_pybuffer_indX.pybuffer.buf = NULL;
  __pyx_pybuffer_indX.refcount = 0;
  __pyx_pybuffernd_indX.data = NULL;
  __pyx_pybuffernd_indX.rcbuffer = &__pyx_pybuffer_indX;
  __pyx_pybuffer_indY.pybuffer.buf = NULL;
  __pyx_pybuffer_indY.refcount = 0;
  __pyx_pybuffernd_indY.data = NULL;
  __pyx_pybuffernd_indY.rcbuffer = &__pyx_pybuffer_indY;
  __pyx_pybuffer_indZ.pybuffer.buf = NULL;
  __pyx_pybuffer_indZ.refcount = 0;
  __pyx_pybuffernd_indZ.data = NULL;
  __pyx_pybuffernd_indZ.rcbuffer = &__pyx_pybuffer_indZ;
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 786, __pyx_L1_error)
  }
  __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];

  /* "tofu/geom/_GG03.pyx":799
 * 
 *     # Get the actual X, Y and Z resolutions and mesh elements
 *     X, dXr, bla, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Y, dYr, bla, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, None, Lim=True, margin=margin)
 *     Z, dZr, bla, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_XMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 799, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 799, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_4,&__pyx_t_1,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 799, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 799, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 799, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 799, __pyx_L1_error)
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_1);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
    __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_12 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 799, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_X = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_dXr = __pyx_t_8;
  __pyx_v_bla = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_NX = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":800
 *     # Get the actual X, Y and Z resolutions and mesh elements
 *     X, dXr, bla, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, None, Lim=True, margin=margin)
 *     Y, dYr, bla, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Z, dZr, bla, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_YMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dY); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 800, __pyx_L1_error)
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_margin, __pyx_t_5) < 0) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 800, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 800, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_3};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 800, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 800, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 800, __pyx_L1_error)
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y.rcbuffer->pybuffer);
    __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_12 < 0)) {
      PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y.rcbuffer->pybuffer, (PyObject*)__pyx_v_Y, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      }
      __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_Y.diminfo[0].strides = __pyx_pybuffernd_Y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Y.diminfo[0].shape = __pyx_pybuffernd_Y.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 800, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_Y = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_dYr = __pyx_t_8;
  __PYX_XDEC_MEMVIEW(&__pyx_v_bla, 1);
  __pyx_v_bla = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_NY = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":801
 *     X, dXr, bla, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, None, Lim=True, margin=margin)
 *     Y, dYr, bla, NY = _Ves_mesh_dlfromL_cython(YMinMax, dY, None, Lim=True, margin=margin)
 *     Z, dZr, bla, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 * 
 *     indZ = ind // (NX*NY)
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_ZMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dZ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 801, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 801, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_1};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 801, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_1};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 801, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) __PYX_ERR(0, 801, __pyx_L1_error)
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 801, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 801, __pyx_L1_error)
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_5);
  if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z.rcbuffer->pybuffer);
    __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_12 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z.rcbuffer->pybuffer, (PyObject*)__pyx_v_Z, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_Z.diminfo[0].strides = __pyx_pybuffernd_Z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Z.diminfo[0].shape = __pyx_pybuffernd_Z.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 801, __pyx_L1_error)
  }
  __pyx_t_11 = 0;
  __pyx_v_Z = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_dZr = __pyx_t_8;
  __PYX_XDEC_MEMVIEW(&__pyx_v_bla, 1);
  __pyx_v_bla = __pyx_t_9;
  __pyx_t_9.memview = NULL;
  __pyx_t_9.data = NULL;
  __pyx_v_NZ = __pyx_t_10;

  /* "tofu/geom/_GG03.pyx":803
 *     Z, dZr, bla, NZ = _Ves_mesh_dlfromL_cython(ZMinMax, dZ, None, Lim=True, margin=margin)
 * 
 *     indZ = ind // (NX*NY)             # <<<<<<<<<<<<<<
 *     indY = (ind - NX*NY*indZ) // NX
 *     indX = ind - NX*NY*indZ - NX*indY
 */
  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_NX * __pyx_v_NY)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_FloorDivide(((PyObject *)__pyx_v_ind), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 803, __pyx_L1_error)
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      }
      __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_indZ.diminfo[0].strides = __pyx_pybuffernd_indZ.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ.diminfo[0].shape = __pyx_pybuffernd_indZ.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 803, __pyx_L1_error)
  }
  __pyx_t_16 = 0;
  __pyx_v_indZ = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":804
 * 
 *     indZ = ind // (NX*NY)
 *     indY = (ind - NX*NY*indZ) // NX             # <<<<<<<<<<<<<<
 *     indX = ind - NX*NY*indZ - NX*indY
 *     Pts = np.array([X[indX.astype(int)], Y[indY.astype(int)], Z[indZ.astype(int)]])
 */
  __pyx_t_1 = __Pyx_PyInt_From_int((__pyx_v_NX * __pyx_v_NY)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, ((PyObject *)__pyx_v_indZ)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_ind), __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyNumber_FloorDivide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 804, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 804, __pyx_L1_error)
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY.rcbuffer->pybuffer, (PyObject*)__pyx_v_indY, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_indY.diminfo[0].strides = __pyx_pybuffernd_indY.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indY.diminfo[0].shape = __pyx_pybuffernd_indY.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 804, __pyx_L1_error)
  }
  __pyx_t_16 = 0;
  __pyx_v_indY = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "tofu/geom/_GG03.pyx":805
 *     indZ = ind // (NX*NY)
 *     indY = (ind - NX*NY*indZ) // NX
 *     indX = ind - NX*NY*indZ - NX*indY             # <<<<<<<<<<<<<<
 *     Pts = np.array([X[indX.astype(int)], Y[indY.astype(int)], Z[indZ.astype(int)]])
 *     dV = dXr*dYr*dZr
 */
  __pyx_t_5 = __Pyx_PyInt_From_int((__pyx_v_NX * __pyx_v_NY)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, ((PyObject *)__pyx_v_indZ)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Subtract(((PyObject *)__pyx_v_ind), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_indY)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 805, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 805, __pyx_L1_error)
  __pyx_t_16 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_v_indX, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_15); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_13);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      }
      __pyx_t_15 = __pyx_t_14 = __pyx_t_13 = 0;
    }
    __pyx_pybuffernd_indX.diminfo[0].strides = __pyx_pybuffernd_indX.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indX.diminfo[0].shape = __pyx_pybuffernd_indX.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 805, __pyx_L1_error)
  }
  __pyx_t_16 = 0;
  __pyx_v_indX = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":806
 *     indY = (ind - NX*NY*indZ) // NX
 *     indX = ind - NX*NY*indZ - NX*indY
 *     Pts = np.array([X[indX.astype(int)], Y[indY.astype(int)], Z[indZ.astype(int)]])             # <<<<<<<<<<<<<<
 *     dV = dXr*dYr*dZr
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_indX), __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)(&PyInt_Type)));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_X), __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_indY), __pyx_n_s_astype); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_17 = PyTuple_New(1+1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyTuple_SET_ITEM(__pyx_t_17, 0+1, ((PyObject *)(&PyInt_Type)));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_Y), __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_17 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_indZ), __pyx_n_s_astype); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_17))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_17);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_17, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_17, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_17)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_17)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_17, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyTuple_SET_ITEM(__pyx_t_18, 0+1, ((PyObject *)(&PyInt_Type)));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_17, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
  __pyx_t_17 = PyObject_GetItem(((PyObject *)__pyx_v_Z), __pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_17);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_17);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_17 = 0;
  __pyx_t_17 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_17)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_17);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_17) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 806, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_17, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_17); __pyx_t_17 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 806, __pyx_L1_error)
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __pyx_t_10 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_10 < 0)) {
      PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __pyx_t_13 = __pyx_t_14 = __pyx_t_15 = 0;
    }
    __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 806, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":807
 *     indX = ind - NX*NY*indZ - NX*indY
 *     Pts = np.array([X[indX.astype(int)], Y[indY.astype(int)], Z[indZ.astype(int)]])
 *     dV = dXr*dYr*dZr             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dV, dXr, dYr, dZr
 */
  __pyx_v_dV = ((__pyx_v_dXr * __pyx_v_dYr) * __pyx_v_dZr);

  /* "tofu/geom/_GG03.pyx":809
 *     dV = dXr*dYr*dZr
 * 
 *     return Pts, dV, dXr, dYr, dZr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dV); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_dYr); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dZr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_17 = PyTuple_New(5); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_17);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_17, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_17, 4, __pyx_t_1);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_r = __pyx_t_17;
  __pyx_t_17 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":786
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromInd_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                      double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                      cnp.ndarray[long,ndim=1] ind, double margin=1.e-9):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Vmesh_Lin_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_X);
  __Pyx_XDECREF((PyObject *)__pyx_v_Y);
  __Pyx_XDECREF((PyObject *)__pyx_v_Z);
  __PYX_XDEC_MEMVIEW(&__pyx_v_bla, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_indX);
  __Pyx_XDECREF((PyObject *)__pyx_v_indY);
  __Pyx_XDECREF((PyObject *)__pyx_v_indZ);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __PYX_XDEC_MEMVIEW(&__pyx_v_XMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_YMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ZMinMax, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":822
 * ########################################################
 * 
 * def _getBoundsInter2AngSeg(bool Full, double Phi0, double Phi1, double DPhi0, double DPhi1):             # <<<<<<<<<<<<<<
 *     """ Return Inter=True if an intersection exist (all angles in radians in [-pi;pi])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_31_getBoundsInter2AngSeg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_30_getBoundsInter2AngSeg[] = " Return Inter=True if an intersection exist (all angles in radians in [-pi;pi])\n\n    If Inter, return Bounds, a list of tuples indicating the segments defining the intersection, with\n    The intervals are ordered from lowest index to highest index (with respect to [Phi0,Phi1])\n    ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_31_getBoundsInter2AngSeg = {"_getBoundsInter2AngSeg", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_31_getBoundsInter2AngSeg, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_30_getBoundsInter2AngSeg};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_31_getBoundsInter2AngSeg(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyBoolObject *__pyx_v_Full = 0;
  double __pyx_v_Phi0;
  double __pyx_v_Phi1;
  double __pyx_v_DPhi0;
  double __pyx_v_DPhi1;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_getBoundsInter2AngSeg (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Full,&__pyx_n_s_Phi0,&__pyx_n_s_Phi1,&__pyx_n_s_DPhi0,&__pyx_n_s_DPhi1,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Full)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Phi0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_getBoundsInter2AngSeg", 1, 5, 5, 1); __PYX_ERR(0, 822, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Phi1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_getBoundsInter2AngSeg", 1, 5, 5, 2); __PYX_ERR(0, 822, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DPhi0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_getBoundsInter2AngSeg", 1, 5, 5, 3); __PYX_ERR(0, 822, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DPhi1)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_getBoundsInter2AngSeg", 1, 5, 5, 4); __PYX_ERR(0, 822, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_getBoundsInter2AngSeg") < 0)) __PYX_ERR(0, 822, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_Full = ((PyBoolObject *)values[0]);
    __pyx_v_Phi0 = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_Phi0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L3_error)
    __pyx_v_Phi1 = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_Phi1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L3_error)
    __pyx_v_DPhi0 = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_DPhi0 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L3_error)
    __pyx_v_DPhi1 = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_DPhi1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 822, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_getBoundsInter2AngSeg", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 822, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._getBoundsInter2AngSeg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Full), __pyx_ptype_7cpython_4bool_bool, 1, "Full", 0))) __PYX_ERR(0, 822, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_30_getBoundsInter2AngSeg(__pyx_self, __pyx_v_Full, __pyx_v_Phi0, __pyx_v_Phi1, __pyx_v_DPhi0, __pyx_v_DPhi1);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_30_getBoundsInter2AngSeg(CYTHON_UNUSED PyObject *__pyx_self, PyBoolObject *__pyx_v_Full, double __pyx_v_Phi0, double __pyx_v_Phi1, double __pyx_v_DPhi0, double __pyx_v_DPhi1) {
  PyObject *__pyx_v_Bounds = NULL;
  int __pyx_v_Inter;
  PyObject *__pyx_v_Faces = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("_getBoundsInter2AngSeg", 0);

  /* "tofu/geom/_GG03.pyx":828
 *     The intervals are ordered from lowest index to highest index (with respect to [Phi0,Phi1])
 *     """
 *     if Full:             # <<<<<<<<<<<<<<
 *         Bounds = [[DPhi0,DPhi1]] if DPhi0<=DPhi1 else [[-Cpi,DPhi1],[DPhi0,Cpi]]
 *         Inter = True
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_Full)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 828, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":829
 *     """
 *     if Full:
 *         Bounds = [[DPhi0,DPhi1]] if DPhi0<=DPhi1 else [[-Cpi,DPhi1],[DPhi0,Cpi]]             # <<<<<<<<<<<<<<
 *         Inter = True
 *         Faces = [None, None]
 */
    if (((__pyx_v_DPhi0 <= __pyx_v_DPhi1) != 0)) {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __pyx_t_4 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_5);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
      __pyx_t_5 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 829, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_v_Bounds = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":830
 *     if Full:
 *         Bounds = [[DPhi0,DPhi1]] if DPhi0<=DPhi1 else [[-Cpi,DPhi1],[DPhi0,Cpi]]
 *         Inter = True             # <<<<<<<<<<<<<<
 *         Faces = [None, None]
 * 
 */
    __pyx_v_Inter = 1;

    /* "tofu/geom/_GG03.pyx":831
 *         Bounds = [[DPhi0,DPhi1]] if DPhi0<=DPhi1 else [[-Cpi,DPhi1],[DPhi0,Cpi]]
 *         Inter = True
 *         Faces = [None, None]             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
    __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyList_SET_ITEM(__pyx_t_2, 0, Py_None);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyList_SET_ITEM(__pyx_t_2, 1, Py_None);
    __pyx_v_Faces = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":828
 *     The intervals are ordered from lowest index to highest index (with respect to [Phi0,Phi1])
 *     """
 *     if Full:             # <<<<<<<<<<<<<<
 *         Bounds = [[DPhi0,DPhi1]] if DPhi0<=DPhi1 else [[-Cpi,DPhi1],[DPhi0,Cpi]]
 *         Inter = True
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":834
 * 
 *     else:
 *         Inter, Bounds, Faces = False, None, [False,False]             # <<<<<<<<<<<<<<
 *         if Phi0<=Phi1:
 *             if DPhi0<=DPhi1:
 */
  /*else*/ {
    __pyx_t_1 = 0;
    __pyx_t_2 = Py_None;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 834, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    PyList_SET_ITEM(__pyx_t_4, 0, Py_False);
    __Pyx_INCREF(Py_False);
    __Pyx_GIVEREF(Py_False);
    PyList_SET_ITEM(__pyx_t_4, 1, Py_False);
    __pyx_v_Inter = __pyx_t_1;
    __pyx_v_Bounds = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_Faces = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":835
 *     else:
 *         Inter, Bounds, Faces = False, None, [False,False]
 *         if Phi0<=Phi1:             # <<<<<<<<<<<<<<
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:
 */
    __pyx_t_1 = ((__pyx_v_Phi0 <= __pyx_v_Phi1) != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":836
 *         Inter, Bounds, Faces = False, None, [False,False]
 *         if Phi0<=Phi1:
 *             if DPhi0<=DPhi1:             # <<<<<<<<<<<<<<
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                     Inter = True
 */
      __pyx_t_1 = ((__pyx_v_DPhi0 <= __pyx_v_DPhi1) != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":837
 *         if Phi0<=Phi1:
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Inter = True
 *                     Bounds = [[None,None]]
 */
        __pyx_t_7 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L7_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_DPhi1 >= __pyx_v_Phi0) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L7_bool_binop_done:;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":838
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                     Inter = True             # <<<<<<<<<<<<<<
 *                     Bounds = [[None,None]]
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 */
          __pyx_v_Inter = 1;

          /* "tofu/geom/_GG03.pyx":839
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                     Inter = True
 *                     Bounds = [[None,None]]             # <<<<<<<<<<<<<<
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                     Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 */
          __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 839, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyList_SET_ITEM(__pyx_t_4, 0, Py_None);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyList_SET_ITEM(__pyx_t_4, 1, Py_None);
          __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":840
 *                     Inter = True
 *                     Bounds = [[None,None]]
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0             # <<<<<<<<<<<<<<
 *                     Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                     Faces[0] = DPhi0<=Phi0
 */
          if (((__pyx_v_DPhi0 <= __pyx_v_Phi0) != 0)) {
            __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = __pyx_t_4;
            __pyx_t_4 = 0;
          } else {
            __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = __pyx_t_4;
            __pyx_t_4 = 0;
          }
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 840, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 0, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 840, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":841
 *                     Bounds = [[None,None]]
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                     Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1             # <<<<<<<<<<<<<<
 *                     Faces[0] = DPhi0<=Phi0
 *                     Faces[1] = DPhi1>=Phi1
 */
          if (((__pyx_v_DPhi1 >= __pyx_v_Phi1) != 0)) {
            __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = __pyx_t_4;
            __pyx_t_4 = 0;
          } else {
            __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = __pyx_t_4;
            __pyx_t_4 = 0;
          }
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 841, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (unlikely(__Pyx_SetItemInt(__pyx_t_4, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 841, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":842
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                     Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                     Faces[0] = DPhi0<=Phi0             # <<<<<<<<<<<<<<
 *                     Faces[1] = DPhi1>=Phi1
 *             else:
 */
          __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_DPhi0 <= __pyx_v_Phi0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 842, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 0, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 842, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":843
 *                     Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                     Faces[0] = DPhi0<=Phi0
 *                     Faces[1] = DPhi1>=Phi1             # <<<<<<<<<<<<<<
 *             else:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 */
          __pyx_t_2 = __Pyx_PyBool_FromLong((__pyx_v_DPhi1 >= __pyx_v_Phi1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 843, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 843, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":837
 *         if Phi0<=Phi1:
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Inter = True
 *                     Bounds = [[None,None]]
 */
        }

        /* "tofu/geom/_GG03.pyx":836
 *         Inter, Bounds, Faces = False, None, [False,False]
 *         if Phi0<=Phi1:
 *             if DPhi0<=DPhi1:             # <<<<<<<<<<<<<<
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                     Inter = True
 */
        goto __pyx_L5;
      }

      /* "tofu/geom/_GG03.pyx":845
 *                     Faces[1] = DPhi1>=Phi1
 *             else:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 */
      /*else*/ {
        __pyx_t_7 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
        if (!__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L10_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_DPhi1 >= __pyx_v_Phi0) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L10_bool_binop_done:;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":846
 *             else:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True             # <<<<<<<<<<<<<<
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 */
          __pyx_v_Inter = 1;

          /* "tofu/geom/_GG03.pyx":847
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 *                         Faces = [True,True]
 */
          __pyx_t_7 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
          if (__pyx_t_7) {
          } else {
            __pyx_t_1 = __pyx_t_7;
            goto __pyx_L13_bool_binop_done;
          }
          __pyx_t_7 = ((__pyx_v_DPhi1 >= __pyx_v_Phi0) != 0);
          __pyx_t_1 = __pyx_t_7;
          __pyx_L13_bool_binop_done:;
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":848
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]             # <<<<<<<<<<<<<<
 *                         Faces = [True,True]
 *                     else:
 */
            __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_2);
            PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_4);
            PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
            __pyx_t_2 = 0;
            __pyx_t_4 = 0;
            __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_4);
            PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_2);
            PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
            __pyx_t_4 = 0;
            __pyx_t_2 = 0;
            __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 848, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_6);
            PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_3);
            PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
            __pyx_t_6 = 0;
            __pyx_t_3 = 0;
            __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_2);
            __pyx_t_2 = 0;

            /* "tofu/geom/_GG03.pyx":849
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 *                         Faces = [True,True]             # <<<<<<<<<<<<<<
 *                     else:
 *                         Bounds = [[None,None]]
 */
            __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_INCREF(Py_True);
            __Pyx_GIVEREF(Py_True);
            PyList_SET_ITEM(__pyx_t_2, 0, Py_True);
            __Pyx_INCREF(Py_True);
            __Pyx_GIVEREF(Py_True);
            PyList_SET_ITEM(__pyx_t_2, 1, Py_True);
            __Pyx_DECREF_SET(__pyx_v_Faces, ((PyObject*)__pyx_t_2));
            __pyx_t_2 = 0;

            /* "tofu/geom/_GG03.pyx":847
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 *                         Faces = [True,True]
 */
            goto __pyx_L12;
          }

          /* "tofu/geom/_GG03.pyx":851
 *                         Faces = [True,True]
 *                     else:
 *                         Bounds = [[None,None]]             # <<<<<<<<<<<<<<
 *                         if DPhi0<=Phi1:
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 */
          /*else*/ {
            __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 851, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_INCREF(Py_None);
            __Pyx_GIVEREF(Py_None);
            PyList_SET_ITEM(__pyx_t_2, 0, Py_None);
            __Pyx_INCREF(Py_None);
            __Pyx_GIVEREF(Py_None);
            PyList_SET_ITEM(__pyx_t_2, 1, Py_None);
            __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 851, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_2);
            PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
            __pyx_t_2 = 0;
            __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_3);
            __pyx_t_3 = 0;

            /* "tofu/geom/_GG03.pyx":852
 *                     else:
 *                         Bounds = [[None,None]]
 *                         if DPhi0<=Phi1:             # <<<<<<<<<<<<<<
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                             Bounds[0][1] = Phi1
 */
            __pyx_t_1 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
            if (__pyx_t_1) {

              /* "tofu/geom/_GG03.pyx":853
 *                         Bounds = [[None,None]]
 *                         if DPhi0<=Phi1:
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0             # <<<<<<<<<<<<<<
 *                             Bounds[0][1] = Phi1
 *                             Faces[0] = DPhi0<=Phi0
 */
              if (((__pyx_v_DPhi0 <= __pyx_v_Phi0) != 0)) {
                __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = __pyx_t_2;
                __pyx_t_2 = 0;
              } else {
                __pyx_t_2 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = __pyx_t_2;
                __pyx_t_2 = 0;
              }
              __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 853, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 853, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "tofu/geom/_GG03.pyx":854
 *                         if DPhi0<=Phi1:
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                             Bounds[0][1] = Phi1             # <<<<<<<<<<<<<<
 *                             Faces[0] = DPhi0<=Phi0
 *                             Faces[1] = True
 */
              __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 854, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 854, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 854, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "tofu/geom/_GG03.pyx":855
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                             Bounds[0][1] = Phi1
 *                             Faces[0] = DPhi0<=Phi0             # <<<<<<<<<<<<<<
 *                             Faces[1] = True
 *                         else:
 */
              __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_DPhi0 <= __pyx_v_Phi0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 855, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 855, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "tofu/geom/_GG03.pyx":856
 *                             Bounds[0][1] = Phi1
 *                             Faces[0] = DPhi0<=Phi0
 *                             Faces[1] = True             # <<<<<<<<<<<<<<
 *                         else:
 *                             Bounds[0][0] = Phi0
 */
              if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 1, Py_True, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 856, __pyx_L1_error)

              /* "tofu/geom/_GG03.pyx":852
 *                     else:
 *                         Bounds = [[None,None]]
 *                         if DPhi0<=Phi1:             # <<<<<<<<<<<<<<
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                             Bounds[0][1] = Phi1
 */
              goto __pyx_L15;
            }

            /* "tofu/geom/_GG03.pyx":858
 *                             Faces[1] = True
 *                         else:
 *                             Bounds[0][0] = Phi0             # <<<<<<<<<<<<<<
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                             Faces[0] = True
 */
            /*else*/ {
              __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 858, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 858, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 0, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 858, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "tofu/geom/_GG03.pyx":859
 *                         else:
 *                             Bounds[0][0] = Phi0
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1             # <<<<<<<<<<<<<<
 *                             Faces[0] = True
 *                             Faces[1] = DPhi1>=Phi1
 */
              if (((__pyx_v_DPhi1 >= __pyx_v_Phi1) != 0)) {
                __pyx_t_2 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = __pyx_t_2;
                __pyx_t_2 = 0;
              } else {
                __pyx_t_2 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_2);
                __pyx_t_3 = __pyx_t_2;
                __pyx_t_2 = 0;
              }
              __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_2, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 859, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

              /* "tofu/geom/_GG03.pyx":860
 *                             Bounds[0][0] = Phi0
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                             Faces[0] = True             # <<<<<<<<<<<<<<
 *                             Faces[1] = DPhi1>=Phi1
 *         else:
 */
              if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 0, Py_True, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 860, __pyx_L1_error)

              /* "tofu/geom/_GG03.pyx":861
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                             Faces[0] = True
 *                             Faces[1] = DPhi1>=Phi1             # <<<<<<<<<<<<<<
 *         else:
 *             if DPhi0<=DPhi1:
 */
              __pyx_t_3 = __Pyx_PyBool_FromLong((__pyx_v_DPhi1 >= __pyx_v_Phi1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 1, __pyx_t_3, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 861, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
            __pyx_L15:;
          }
          __pyx_L12:;

          /* "tofu/geom/_GG03.pyx":845
 *                     Faces[1] = DPhi1>=Phi1
 *             else:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 */
        }
      }
      __pyx_L5:;

      /* "tofu/geom/_GG03.pyx":835
 *     else:
 *         Inter, Bounds, Faces = False, None, [False,False]
 *         if Phi0<=Phi1:             # <<<<<<<<<<<<<<
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 and DPhi1>=Phi0:
 */
      goto __pyx_L4;
    }

    /* "tofu/geom/_GG03.pyx":863
 *                             Faces[1] = DPhi1>=Phi1
 *         else:
 *             if DPhi0<=DPhi1:             # <<<<<<<<<<<<<<
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True
 */
    /*else*/ {
      __pyx_t_1 = ((__pyx_v_DPhi0 <= __pyx_v_DPhi1) != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":864
 *         else:
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 */
        __pyx_t_7 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
        if (!__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L18_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_DPhi1 >= __pyx_v_Phi0) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L18_bool_binop_done:;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":865
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True             # <<<<<<<<<<<<<<
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 */
          __pyx_v_Inter = 1;

          /* "tofu/geom/_GG03.pyx":866
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 *                         Faces = [True,True]
 */
          __pyx_t_7 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
          if (__pyx_t_7) {
          } else {
            __pyx_t_1 = __pyx_t_7;
            goto __pyx_L21_bool_binop_done;
          }
          __pyx_t_7 = ((__pyx_v_DPhi1 >= __pyx_v_Phi0) != 0);
          __pyx_t_1 = __pyx_t_7;
          __pyx_L21_bool_binop_done:;
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":867
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]             # <<<<<<<<<<<<<<
 *                         Faces = [True,True]
 *                     else:
 */
            __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_2 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_3);
            PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_2);
            PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_2);
            __pyx_t_3 = 0;
            __pyx_t_2 = 0;
            __pyx_t_2 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_2);
            PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_3);
            PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
            __pyx_t_2 = 0;
            __pyx_t_3 = 0;
            __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 867, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_6);
            PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_4);
            PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
            __pyx_t_6 = 0;
            __pyx_t_4 = 0;
            __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_3);
            __pyx_t_3 = 0;

            /* "tofu/geom/_GG03.pyx":868
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 *                         Faces = [True,True]             # <<<<<<<<<<<<<<
 *                     else:
 *                         Bounds = [[None,None]]
 */
            __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 868, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_INCREF(Py_True);
            __Pyx_GIVEREF(Py_True);
            PyList_SET_ITEM(__pyx_t_3, 0, Py_True);
            __Pyx_INCREF(Py_True);
            __Pyx_GIVEREF(Py_True);
            PyList_SET_ITEM(__pyx_t_3, 1, Py_True);
            __Pyx_DECREF_SET(__pyx_v_Faces, ((PyObject*)__pyx_t_3));
            __pyx_t_3 = 0;

            /* "tofu/geom/_GG03.pyx":866
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                         Bounds = [[Phi0,DPhi1],[DPhi0,Phi1]]
 *                         Faces = [True,True]
 */
            goto __pyx_L20;
          }

          /* "tofu/geom/_GG03.pyx":870
 *                         Faces = [True,True]
 *                     else:
 *                         Bounds = [[None,None]]             # <<<<<<<<<<<<<<
 *                         if DPhi0<=Phi1:
 *                             Bounds[0][0] = DPhi0
 */
          /*else*/ {
            __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 870, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_INCREF(Py_None);
            __Pyx_GIVEREF(Py_None);
            PyList_SET_ITEM(__pyx_t_3, 0, Py_None);
            __Pyx_INCREF(Py_None);
            __Pyx_GIVEREF(Py_None);
            PyList_SET_ITEM(__pyx_t_3, 1, Py_None);
            __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 870, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_3);
            PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
            __pyx_t_3 = 0;
            __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_4);
            __pyx_t_4 = 0;

            /* "tofu/geom/_GG03.pyx":871
 *                     else:
 *                         Bounds = [[None,None]]
 *                         if DPhi0<=Phi1:             # <<<<<<<<<<<<<<
 *                             Bounds[0][0] = DPhi0
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 */
            __pyx_t_1 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
            if (__pyx_t_1) {

              /* "tofu/geom/_GG03.pyx":872
 *                         Bounds = [[None,None]]
 *                         if DPhi0<=Phi1:
 *                             Bounds[0][0] = DPhi0             # <<<<<<<<<<<<<<
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                             Faces[1] = DPhi1>=Phi1
 */
              __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 872, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

              /* "tofu/geom/_GG03.pyx":873
 *                         if DPhi0<=Phi1:
 *                             Bounds[0][0] = DPhi0
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1             # <<<<<<<<<<<<<<
 *                             Faces[1] = DPhi1>=Phi1
 *                         else:
 */
              if (((__pyx_v_DPhi1 >= __pyx_v_Phi1) != 0)) {
                __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_4 = __pyx_t_3;
                __pyx_t_3 = 0;
              } else {
                __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_4 = __pyx_t_3;
                __pyx_t_3 = 0;
              }
              __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 873, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 873, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

              /* "tofu/geom/_GG03.pyx":874
 *                             Bounds[0][0] = DPhi0
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                             Faces[1] = DPhi1>=Phi1             # <<<<<<<<<<<<<<
 *                         else:
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 */
              __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_DPhi1 >= __pyx_v_Phi1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 874, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 1, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 874, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

              /* "tofu/geom/_GG03.pyx":871
 *                     else:
 *                         Bounds = [[None,None]]
 *                         if DPhi0<=Phi1:             # <<<<<<<<<<<<<<
 *                             Bounds[0][0] = DPhi0
 *                             Bounds[0][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 */
              goto __pyx_L23;
            }

            /* "tofu/geom/_GG03.pyx":876
 *                             Faces[1] = DPhi1>=Phi1
 *                         else:
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0             # <<<<<<<<<<<<<<
 *                             Bounds[0][1] = DPhi1
 *                             Faces[0] = DPhi0<=Phi0
 */
            /*else*/ {
              if (((__pyx_v_DPhi0 <= __pyx_v_Phi0) != 0)) {
                __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_4 = __pyx_t_3;
                __pyx_t_3 = 0;
              } else {
                __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error)
                __Pyx_GOTREF(__pyx_t_3);
                __pyx_t_4 = __pyx_t_3;
                __pyx_t_3 = 0;
              }
              __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 876, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 0, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 876, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

              /* "tofu/geom/_GG03.pyx":877
 *                         else:
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                             Bounds[0][1] = DPhi1             # <<<<<<<<<<<<<<
 *                             Faces[0] = DPhi0<=Phi0
 *             else:
 */
              __pyx_t_4 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 877, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 877, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              if (unlikely(__Pyx_SetItemInt(__pyx_t_3, 1, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 877, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

              /* "tofu/geom/_GG03.pyx":878
 *                             Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                             Bounds[0][1] = DPhi1
 *                             Faces[0] = DPhi0<=Phi0             # <<<<<<<<<<<<<<
 *             else:
 *                 Inter = True
 */
              __pyx_t_4 = __Pyx_PyBool_FromLong((__pyx_v_DPhi0 <= __pyx_v_Phi0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 878, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 0, __pyx_t_4, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 878, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            }
            __pyx_L23:;
          }
          __pyx_L20:;

          /* "tofu/geom/_GG03.pyx":864
 *         else:
 *             if DPhi0<=DPhi1:
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Inter = True
 *                     if DPhi0<=Phi1 and DPhi1>=Phi0:
 */
        }

        /* "tofu/geom/_GG03.pyx":863
 *                             Faces[1] = DPhi1>=Phi1
 *         else:
 *             if DPhi0<=DPhi1:             # <<<<<<<<<<<<<<
 *                 if DPhi0<=Phi1 or DPhi1>=Phi0:
 *                     Inter = True
 */
        goto __pyx_L16;
      }

      /* "tofu/geom/_GG03.pyx":880
 *                             Faces[0] = DPhi0<=Phi0
 *             else:
 *                 Inter = True             # <<<<<<<<<<<<<<
 *                 if DPhi0>=Phi0 and DPhi1>=Phi0:
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]
 */
      /*else*/ {
        __pyx_v_Inter = 1;

        /* "tofu/geom/_GG03.pyx":881
 *             else:
 *                 Inter = True
 *                 if DPhi0>=Phi0 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]
 *                     Faces = [True,True]
 */
        __pyx_t_7 = ((__pyx_v_DPhi0 >= __pyx_v_Phi0) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L25_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_DPhi1 >= __pyx_v_Phi0) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L25_bool_binop_done:;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":882
 *                 Inter = True
 *                 if DPhi0>=Phi0 and DPhi1>=Phi0:
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]             # <<<<<<<<<<<<<<
 *                     Faces = [True,True]
 *                 elif DPhi0<=Phi1 and DPhi1<=Phi1:
 */
          __pyx_t_4 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
          __pyx_t_4 = 0;
          __pyx_t_3 = 0;
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
          __pyx_t_3 = 0;
          __pyx_t_4 = 0;
          __pyx_t_4 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
          __pyx_t_4 = 0;
          __pyx_t_3 = 0;
          __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 882, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_6);
          PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_2);
          PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_5);
          __pyx_t_6 = 0;
          __pyx_t_2 = 0;
          __pyx_t_5 = 0;
          __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_3);
          __pyx_t_3 = 0;

          /* "tofu/geom/_GG03.pyx":883
 *                 if DPhi0>=Phi0 and DPhi1>=Phi0:
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]
 *                     Faces = [True,True]             # <<<<<<<<<<<<<<
 *                 elif DPhi0<=Phi1 and DPhi1<=Phi1:
 *                     Bounds = [[Phi0,Cpi],[-Cpi,DPhi1],[DPhi0,Phi1]]
 */
          __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 883, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_INCREF(Py_True);
          __Pyx_GIVEREF(Py_True);
          PyList_SET_ITEM(__pyx_t_3, 0, Py_True);
          __Pyx_INCREF(Py_True);
          __Pyx_GIVEREF(Py_True);
          PyList_SET_ITEM(__pyx_t_3, 1, Py_True);
          __Pyx_DECREF_SET(__pyx_v_Faces, ((PyObject*)__pyx_t_3));
          __pyx_t_3 = 0;

          /* "tofu/geom/_GG03.pyx":881
 *             else:
 *                 Inter = True
 *                 if DPhi0>=Phi0 and DPhi1>=Phi0:             # <<<<<<<<<<<<<<
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]
 *                     Faces = [True,True]
 */
          goto __pyx_L24;
        }

        /* "tofu/geom/_GG03.pyx":884
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]
 *                     Faces = [True,True]
 *                 elif DPhi0<=Phi1 and DPhi1<=Phi1:             # <<<<<<<<<<<<<<
 *                     Bounds = [[Phi0,Cpi],[-Cpi,DPhi1],[DPhi0,Phi1]]
 *                     Faces = [True,True]
 */
        __pyx_t_7 = ((__pyx_v_DPhi0 <= __pyx_v_Phi1) != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L27_bool_binop_done;
        }
        __pyx_t_7 = ((__pyx_v_DPhi1 <= __pyx_v_Phi1) != 0);
        __pyx_t_1 = __pyx_t_7;
        __pyx_L27_bool_binop_done:;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":885
 *                     Faces = [True,True]
 *                 elif DPhi0<=Phi1 and DPhi1<=Phi1:
 *                     Bounds = [[Phi0,Cpi],[-Cpi,DPhi1],[DPhi0,Phi1]]             # <<<<<<<<<<<<<<
 *                     Faces = [True,True]
 *                 else:
 */
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
          __pyx_t_3 = 0;
          __pyx_t_5 = 0;
          __pyx_t_5 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
          __pyx_t_5 = 0;
          __pyx_t_3 = 0;
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
          __pyx_t_3 = 0;
          __pyx_t_5 = 0;
          __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_2);
          PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_6);
          PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
          __pyx_t_2 = 0;
          __pyx_t_6 = 0;
          __pyx_t_4 = 0;
          __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "tofu/geom/_GG03.pyx":886
 *                 elif DPhi0<=Phi1 and DPhi1<=Phi1:
 *                     Bounds = [[Phi0,Cpi],[-Cpi,DPhi1],[DPhi0,Phi1]]
 *                     Faces = [True,True]             # <<<<<<<<<<<<<<
 *                 else:
 *                     Bounds = [[None,Cpi],[-Cpi,None]]
 */
          __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 886, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(Py_True);
          __Pyx_GIVEREF(Py_True);
          PyList_SET_ITEM(__pyx_t_5, 0, Py_True);
          __Pyx_INCREF(Py_True);
          __Pyx_GIVEREF(Py_True);
          PyList_SET_ITEM(__pyx_t_5, 1, Py_True);
          __Pyx_DECREF_SET(__pyx_v_Faces, ((PyObject*)__pyx_t_5));
          __pyx_t_5 = 0;

          /* "tofu/geom/_GG03.pyx":884
 *                     Bounds = [[Phi0,DPhi1],[DPhi0,Cpi],[-Cpi,Phi1]]
 *                     Faces = [True,True]
 *                 elif DPhi0<=Phi1 and DPhi1<=Phi1:             # <<<<<<<<<<<<<<
 *                     Bounds = [[Phi0,Cpi],[-Cpi,DPhi1],[DPhi0,Phi1]]
 *                     Faces = [True,True]
 */
          goto __pyx_L24;
        }

        /* "tofu/geom/_GG03.pyx":888
 *                     Faces = [True,True]
 *                 else:
 *                     Bounds = [[None,Cpi],[-Cpi,None]]             # <<<<<<<<<<<<<<
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                     Bounds[1][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 */
        /*else*/ {
          __pyx_t_5 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 888, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 888, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyList_SET_ITEM(__pyx_t_4, 0, Py_None);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_5 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 888, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 888, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_5);
          PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyList_SET_ITEM(__pyx_t_6, 1, Py_None);
          __pyx_t_5 = 0;
          __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 888, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_6);
          PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
          __pyx_t_4 = 0;
          __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_Bounds, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "tofu/geom/_GG03.pyx":889
 *                 else:
 *                     Bounds = [[None,Cpi],[-Cpi,None]]
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0             # <<<<<<<<<<<<<<
 *                     Bounds[1][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                     Faces[0] = DPhi0<=Phi0
 */
          if (((__pyx_v_DPhi0 <= __pyx_v_Phi0) != 0)) {
            __pyx_t_6 = PyFloat_FromDouble(__pyx_v_Phi0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 889, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_5 = __pyx_t_6;
            __pyx_t_6 = 0;
          } else {
            __pyx_t_6 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 889, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_5 = __pyx_t_6;
            __pyx_t_6 = 0;
          }
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_Bounds, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 889, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 0, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 889, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "tofu/geom/_GG03.pyx":890
 *                     Bounds = [[None,Cpi],[-Cpi,None]]
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                     Bounds[1][1] = Phi1 if DPhi1>=Phi1 else DPhi1             # <<<<<<<<<<<<<<
 *                     Faces[0] = DPhi0<=Phi0
 *                     Faces[1] = DPhi1>=Phi1
 */
          if (((__pyx_v_DPhi1 >= __pyx_v_Phi1) != 0)) {
            __pyx_t_6 = PyFloat_FromDouble(__pyx_v_Phi1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 890, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_5 = __pyx_t_6;
            __pyx_t_6 = 0;
          } else {
            __pyx_t_6 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 890, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_5 = __pyx_t_6;
            __pyx_t_6 = 0;
          }
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_Bounds, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 890, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (unlikely(__Pyx_SetItemInt(__pyx_t_6, 1, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 890, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "tofu/geom/_GG03.pyx":891
 *                     Bounds[0][0] = Phi0 if DPhi0<=Phi0 else DPhi0
 *                     Bounds[1][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                     Faces[0] = DPhi0<=Phi0             # <<<<<<<<<<<<<<
 *                     Faces[1] = DPhi1>=Phi1
 *     return Inter, Bounds, Faces
 */
          __pyx_t_5 = __Pyx_PyBool_FromLong((__pyx_v_DPhi0 <= __pyx_v_Phi0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 891, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 0, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 891, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

          /* "tofu/geom/_GG03.pyx":892
 *                     Bounds[1][1] = Phi1 if DPhi1>=Phi1 else DPhi1
 *                     Faces[0] = DPhi0<=Phi0
 *                     Faces[1] = DPhi1>=Phi1             # <<<<<<<<<<<<<<
 *     return Inter, Bounds, Faces
 * 
 */
          __pyx_t_5 = __Pyx_PyBool_FromLong((__pyx_v_DPhi1 >= __pyx_v_Phi1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 892, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Faces, 1, __pyx_t_5, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 892, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
        __pyx_L24:;
      }
      __pyx_L16:;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":893
 *                     Faces[0] = DPhi0<=Phi0
 *                     Faces[1] = DPhi1>=Phi1
 *     return Inter, Bounds, Faces             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_Inter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_Bounds);
  __Pyx_GIVEREF(__pyx_v_Bounds);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_Bounds);
  __Pyx_INCREF(__pyx_v_Faces);
  __Pyx_GIVEREF(__pyx_v_Faces);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_Faces);
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":822
 * ########################################################
 * 
 * def _getBoundsInter2AngSeg(bool Full, double Phi0, double Phi1, double DPhi0, double DPhi1):             # <<<<<<<<<<<<<<
 *     """ Return Inter=True if an intersection exist (all angles in radians in [-pi;pi])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("tofu.geom._GG03._getBoundsInter2AngSeg", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Bounds);
  __Pyx_XDECREF(__pyx_v_Faces);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":901
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_33_Ves_Smesh_Tor_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_32_Ves_Smesh_Tor_SubFromD_cython[] = " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_33_Ves_Smesh_Tor_SubFromD_cython = {"_Ves_Smesh_Tor_SubFromD_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_33_Ves_Smesh_Tor_SubFromD_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_32_Ves_Smesh_Tor_SubFromD_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_33_Ves_Smesh_Tor_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_dL;
  double __pyx_v_dRPhi;
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_DR = 0;
  PyObject *__pyx_v_DZ = 0;
  PyObject *__pyx_v_DPhi = 0;
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  PyObject *__pyx_v_PhiMinMax = 0;
  PyObject *__pyx_v_Out = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_Tor_SubFromD_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dL,&__pyx_n_s_dRPhi,&__pyx_n_s_VPoly,&__pyx_n_s_DR,&__pyx_n_s_DZ,&__pyx_n_s_DPhi,&__pyx_n_s_DIn,&__pyx_n_s_VIn,&__pyx_n_s_PhiMinMax,&__pyx_n_s_Out,&__pyx_n_s_margin,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":903
 * def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi,
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,             # <<<<<<<<<<<<<<
 *                                    double DIn=0., VIn=None, PhiMinMax=None,
 *                                    str Out='(X,Y,Z)', double margin=1.e-9):
 */
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);

    /* "tofu/geom/_GG03.pyx":904
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,
 *                                    double DIn=0., VIn=None, PhiMinMax=None,             # <<<<<<<<<<<<<<
 *                                    str Out='(X,Y,Z)', double margin=1.e-9):
 *     " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) "
 */
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject*)__pyx_kp_s_X_Y_Z);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dRPhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromD_cython", 0, 3, 11, 1); __PYX_ERR(0, 901, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromD_cython", 0, 3, 11, 2); __PYX_ERR(0, 901, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DR);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DZ);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DPhi);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_PhiMinMax);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_Tor_SubFromD_cython") < 0)) __PYX_ERR(0, 901, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L3_error)
    __pyx_v_dRPhi = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dRPhi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 901, __pyx_L3_error)
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[2]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 902, __pyx_L3_error)
    __pyx_v_DR = values[3];
    __pyx_v_DZ = values[4];
    __pyx_v_DPhi = values[5];
    if (values[6]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 904, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[7];
    __pyx_v_PhiMinMax = values[8];
    __pyx_v_Out = ((PyObject*)values[9]);
    if (values[10]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 905, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromD_cython", 0, 3, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 901, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Tor_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Out), (&PyString_Type), 1, "Out", 1))) __PYX_ERR(0, 905, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_32_Ves_Smesh_Tor_SubFromD_cython(__pyx_self, __pyx_v_dL, __pyx_v_dRPhi, __pyx_v_VPoly, __pyx_v_DR, __pyx_v_DZ, __pyx_v_DPhi, __pyx_v_DIn, __pyx_v_VIn, __pyx_v_PhiMinMax, __pyx_v_Out, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":901
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_32_Ves_Smesh_Tor_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, PyObject *__pyx_v_DR, PyObject *__pyx_v_DZ, PyObject *__pyx_v_DPhi, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_PhiMinMax, PyObject *__pyx_v_Out, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_dPhir = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_DPhi0;
  double __pyx_v_DPhi1;
  CYTHON_UNUSED double __pyx_v_DDPhi;
  double __pyx_v_DPhiMinMax;
  double __pyx_v_abs0;
  double __pyx_v_abs1;
  double __pyx_v_phi;
  double __pyx_v_indiijj;
  __Pyx_memviewslice __pyx_v_Phin = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_Indin = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_v_NR0;
  int __pyx_v_nRPhi0;
  int __pyx_v_indR0ii;
  int __pyx_v_ii;
  int __pyx_v_jj0;
  int __pyx_v_jj;
  int __pyx_v_nPhi0;
  int __pyx_v_nPhi1;
  int __pyx_v_NP;
  CYTHON_UNUSED int __pyx_v_NRPhi_int;
  int __pyx_v_Rratio;
  int __pyx_v_Ln;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_indI = 0;
  PyArrayObject *__pyx_v_PtsCross = 0;
  PyArrayObject *__pyx_v_VPbis = 0;
  PyArrayObject *__pyx_v_R0 = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyArrayObject *__pyx_v_ind = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_dRPhir = 0;
  PyArrayObject *__pyx_v_iii = 0;
  PyArrayObject *__pyx_v_indL = 0;
  PyArrayObject *__pyx_v_NL = 0;
  PyArrayObject *__pyx_v_indok = 0;
  int __pyx_v_Full;
  PyObject *__pyx_v_Inter = NULL;
  PyObject *__pyx_v_Bounds = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_Faces = NULL;
  PyObject *__pyx_v_BC = NULL;
  Py_ssize_t __pyx_v_nBounds;
  PyObject *__pyx_v_indin = NULL;
  CYTHON_UNUSED long __pyx_v_NPhimax;
  PyObject *__pyx_v_indBounds = NULL;
  Py_ssize_t __pyx_v_kk;
  PyObject *__pyx_v_kkb = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_NL;
  __Pyx_Buffer __pyx_pybuffer_NL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsCross;
  __Pyx_Buffer __pyx_pybuffer_PtsCross;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_R0;
  __Pyx_Buffer __pyx_pybuffer_R0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPbis;
  __Pyx_Buffer __pyx_pybuffer_VPbis;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dRPhir;
  __Pyx_Buffer __pyx_pybuffer_dRPhir;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_iii;
  __Pyx_Buffer __pyx_pybuffer_iii;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indI;
  __Pyx_Buffer __pyx_pybuffer_indI;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indL;
  __Pyx_Buffer __pyx_pybuffer_indL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indok;
  __Pyx_Buffer __pyx_pybuffer_indok;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  double __pyx_t_7;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  PyArrayObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyArrayObject *__pyx_t_23 = NULL;
  PyArrayObject *__pyx_t_24 = NULL;
  __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_26 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_27;
  long __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  int __pyx_t_37;
  int __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  PyObject *(*__pyx_t_55)(PyObject *);
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  __Pyx_RefNannySetupContext("_Ves_Smesh_Tor_SubFromD_cython", 0);
  __Pyx_INCREF(__pyx_v_PhiMinMax);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_indI.pybuffer.buf = NULL;
  __pyx_pybuffer_indI.refcount = 0;
  __pyx_pybuffernd_indI.data = NULL;
  __pyx_pybuffernd_indI.rcbuffer = &__pyx_pybuffer_indI;
  __pyx_pybuffer_PtsCross.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsCross.refcount = 0;
  __pyx_pybuffernd_PtsCross.data = NULL;
  __pyx_pybuffernd_PtsCross.rcbuffer = &__pyx_pybuffer_PtsCross;
  __pyx_pybuffer_VPbis.pybuffer.buf = NULL;
  __pyx_pybuffer_VPbis.refcount = 0;
  __pyx_pybuffernd_VPbis.data = NULL;
  __pyx_pybuffernd_VPbis.rcbuffer = &__pyx_pybuffer_VPbis;
  __pyx_pybuffer_R0.pybuffer.buf = NULL;
  __pyx_pybuffer_R0.refcount = 0;
  __pyx_pybuffernd_R0.data = NULL;
  __pyx_pybuffernd_R0.rcbuffer = &__pyx_pybuffer_R0;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_dRPhir.pybuffer.buf = NULL;
  __pyx_pybuffer_dRPhir.refcount = 0;
  __pyx_pybuffernd_dRPhir.data = NULL;
  __pyx_pybuffernd_dRPhir.rcbuffer = &__pyx_pybuffer_dRPhir;
  __pyx_pybuffer_iii.pybuffer.buf = NULL;
  __pyx_pybuffer_iii.refcount = 0;
  __pyx_pybuffernd_iii.data = NULL;
  __pyx_pybuffernd_iii.rcbuffer = &__pyx_pybuffer_iii;
  __pyx_pybuffer_indL.pybuffer.buf = NULL;
  __pyx_pybuffer_indL.refcount = 0;
  __pyx_pybuffernd_indL.data = NULL;
  __pyx_pybuffernd_indL.rcbuffer = &__pyx_pybuffer_indL;
  __pyx_pybuffer_NL.pybuffer.buf = NULL;
  __pyx_pybuffer_NL.refcount = 0;
  __pyx_pybuffernd_NL.data = NULL;
  __pyx_pybuffernd_NL.rcbuffer = &__pyx_pybuffer_NL;
  __pyx_pybuffer_indok.pybuffer.buf = NULL;
  __pyx_pybuffer_indok.refcount = 0;
  __pyx_pybuffernd_indok.data = NULL;
  __pyx_pybuffernd_indok.rcbuffer = &__pyx_pybuffer_indok;

  /* "tofu/geom/_GG03.pyx":911
 *     cdef double abs0, abs1, phi, indiijj
 *     cdef long[::1] indR0, indR, indZ, Phin, NRPhi0, Indin
 *     cdef int NR0, NR, NZ, Rn, Zn, nRPhi0, indR0ii, ii, jj0=0, jj, nPhi0, nPhi1, zz, NP, NRPhi_int, Rratio, Ln             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] Pts, indI, PtsCross, VPbis
 *     cdef cnp.ndarray[double,ndim=1] R0, dS, ind, dLr, Rref, dRPhir, iii
 */
  __pyx_v_jj0 = 0;

  /* "tofu/geom/_GG03.pyx":917
 * 
 *     # Pre-format input
 *     if PhiMinMax is None:             # <<<<<<<<<<<<<<
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi
 */
  __pyx_t_1 = (__pyx_v_PhiMinMax == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "tofu/geom/_GG03.pyx":918
 *     # Pre-format input
 *     if PhiMinMax is None:
 *         PhiMinMax = [-Cpi,Cpi]             # <<<<<<<<<<<<<<
 *         DPhiMinMax = 2.*Cpi
 *         Full = True
 */
    __pyx_t_3 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_PhiMinMax, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "tofu/geom/_GG03.pyx":919
 *     if PhiMinMax is None:
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi             # <<<<<<<<<<<<<<
 *         Full = True
 *     else:
 */
    __pyx_v_DPhiMinMax = (2. * M_PI);

    /* "tofu/geom/_GG03.pyx":920
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi
 *         Full = True             # <<<<<<<<<<<<<<
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 */
    __pyx_v_Full = 1;

    /* "tofu/geom/_GG03.pyx":917
 * 
 *     # Pre-format input
 *     if PhiMinMax is None:             # <<<<<<<<<<<<<<
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":922
 *         Full = True
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]             # <<<<<<<<<<<<<<
 *         DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]
 *         Full = False
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(atan2(sin(__pyx_t_6), cos(__pyx_t_7))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(atan2(sin(__pyx_t_7), cos(__pyx_t_6))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 922, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_PhiMinMax, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":923
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 *         DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]             # <<<<<<<<<<<<<<
 *         Full = False
 * 
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 923, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_t_7;
    } else {
      __pyx_t_3 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_t_7;
    }
    __pyx_v_DPhiMinMax = __pyx_t_6;

    /* "tofu/geom/_GG03.pyx":924
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 *         DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]
 *         Full = False             # <<<<<<<<<<<<<<
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 */
    __pyx_v_Full = 0;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":927
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:             # <<<<<<<<<<<<<<
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]
 *     else:
 */
  __pyx_t_2 = (__pyx_v_DPhi == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":928
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]             # <<<<<<<<<<<<<<
 *     else:
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 928, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_DPhi0 = __pyx_t_6;
    __pyx_v_DPhi1 = __pyx_t_7;

    /* "tofu/geom/_GG03.pyx":927
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:             # <<<<<<<<<<<<<<
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]
 *     else:
 */
    goto __pyx_L4;
  }

  /* "tofu/geom/_GG03.pyx":930
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]
 *     else:
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))             # <<<<<<<<<<<<<<
 *         DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 930, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = (__pyx_t_3 == Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((__pyx_t_1 != 0)) {
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = atan2(sin(__pyx_t_6), cos(__pyx_t_8));
    }
    __pyx_v_DPhi0 = __pyx_t_7;

    /* "tofu/geom/_GG03.pyx":931
 *     else:
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))
 *         DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))             # <<<<<<<<<<<<<<
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0
 * 
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = (__pyx_t_3 == Py_None);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((__pyx_t_1 != 0)) {
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_8;
    } else {
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = atan2(sin(__pyx_t_8), cos(__pyx_t_6));
    }
    __pyx_v_DPhi1 = __pyx_t_7;
  }
  __pyx_L4:;

  /* "tofu/geom/_GG03.pyx":932
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))
 *         DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0             # <<<<<<<<<<<<<<
 * 
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)
 */
  if (((__pyx_v_DPhi1 > __pyx_v_DPhi0) != 0)) {
    __pyx_t_7 = (__pyx_v_DPhi1 - __pyx_v_DPhi0);
  } else {
    __pyx_t_7 = (((2. * M_PI) + __pyx_v_DPhi1) - __pyx_v_DPhi0);
  }
  __pyx_v_DDPhi = __pyx_t_7;

  /* "tofu/geom/_GG03.pyx":934
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0
 * 
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)             # <<<<<<<<<<<<<<
 * 
 *     if Inter:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_getBoundsInter2AngSeg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_Full); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_DPhi0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_DPhi1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = NULL;
  __pyx_t_14 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_14 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_t_5, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_14, 5+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_t_5, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_14, 5+__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  } else
  #endif
  {
    __pyx_t_15 = PyTuple_New(5+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    if (__pyx_t_13) {
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_14, __pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_14, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_14, __pyx_t_12);
    __pyx_t_5 = 0;
    __pyx_t_9 = 0;
    __pyx_t_10 = 0;
    __pyx_t_11 = 0;
    __pyx_t_12 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 934, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_t_12);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_12 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_16 = Py_TYPE(__pyx_t_11)->tp_iternext;
    index = 0; __pyx_t_4 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 1; __pyx_t_15 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_15)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_15);
    index = 2; __pyx_t_12 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_12)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_12);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_11), 3) < 0) __PYX_ERR(0, 934, __pyx_L1_error)
    __pyx_t_16 = NULL;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_16 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 934, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_Inter = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_Bounds = __pyx_t_15;
  __pyx_t_15 = 0;
  __pyx_v_Faces = __pyx_t_12;
  __pyx_t_12 = 0;

  /* "tofu/geom/_GG03.pyx":936
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)
 * 
 *     if Inter:             # <<<<<<<<<<<<<<
 * 
 *         BC = list(Bounds)
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Inter); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 936, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":938
 *     if Inter:
 * 
 *         BC = list(Bounds)             # <<<<<<<<<<<<<<
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):
 */
    __pyx_t_3 = PySequence_List(__pyx_v_Bounds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 938, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_BC = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":939
 * 
 *         BC = list(Bounds)
 *         nBounds = len(Bounds)             # <<<<<<<<<<<<<<
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:
 */
    __pyx_t_17 = PyObject_Length(__pyx_v_Bounds); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 939, __pyx_L1_error)
    __pyx_v_nBounds = __pyx_t_17;

    /* "tofu/geom/_GG03.pyx":940
 *         BC = list(Bounds)
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):             # <<<<<<<<<<<<<<
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi
 */
    __pyx_t_17 = __pyx_v_nBounds;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_17; __pyx_t_14+=1) {
      __pyx_v_ii = __pyx_t_14;

      /* "tofu/geom/_GG03.pyx":941
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:
 */
      __pyx_t_3 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_15 = PyObject_RichCompare(__pyx_t_3, __pyx_t_12, Py_LT); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 941, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 941, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":942
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi             # <<<<<<<<<<<<<<
 *             if BC[ii][1]<=PhiMinMax[0]:
 *                 BC[ii][1] += 2.*Cpi
 */
        __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii));
        __pyx_t_15 = PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii);
        __pyx_t_18 = 0;
        __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_15, __pyx_t_18, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 942, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_3 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 942, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 942, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(__Pyx_SetItemInt(__pyx_t_15, __pyx_t_18, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 942, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

        /* "tofu/geom/_GG03.pyx":941
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:
 */
      }

      /* "tofu/geom/_GG03.pyx":943
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][1] += 2.*Cpi
 * 
 */
      __pyx_t_15 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_15, __pyx_t_4, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":944
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:
 *                 BC[ii][1] += 2.*Cpi             # <<<<<<<<<<<<<<
 * 
 *         # Get the actual R and Z resolutions and mesh elements
 */
        __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii));
        __pyx_t_3 = PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii);
        __pyx_t_18 = 1;
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_18, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_15 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 944, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_12 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 944, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (unlikely(__Pyx_SetItemInt(__pyx_t_3, __pyx_t_18, __pyx_t_12, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 944, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":943
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][1] += 2.*Cpi
 * 
 */
      }
    }

    /* "tofu/geom/_GG03.pyx":947
 * 
 *         # Get the actual R and Z resolutions and mesh elements
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)             # <<<<<<<<<<<<<<
 *         R0 = np.copy(Rref)
 *         NR0 = R0.size
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_Smesh_Cross); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_15 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_15);
    __pyx_t_12 = 0;
    __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_D1, Py_None) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_D2, Py_None) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
    __pyx_t_12 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_margin, __pyx_t_12) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_DIn, __pyx_t_12) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_VIn, __pyx_v_VIn) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, __pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) {
      PyObject* sequence = __pyx_t_12;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 947, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_15,&__pyx_t_4,&__pyx_t_3,&__pyx_t_11,&__pyx_t_10,&__pyx_t_9};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 947, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_15,&__pyx_t_4,&__pyx_t_3,&__pyx_t_11,&__pyx_t_10,&__pyx_t_9};
      __pyx_t_5 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_5)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_16(__pyx_t_5); if (unlikely(!item)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_5), 6) < 0) __PYX_ERR(0, 947, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 947, __pyx_L1_error)
      __pyx_L13_unpacking_done:;
    }
    if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 947, __pyx_L1_error)
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 947, __pyx_L1_error)
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 947, __pyx_L1_error)
    if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 947, __pyx_L1_error)
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 947, __pyx_L1_error)
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 947, __pyx_L1_error)
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_15);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __pyx_v_PtsCross = ((PyArrayObject *)__pyx_t_15);
    __pyx_t_15 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_dLr = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_v_indL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_indL.diminfo[0].strides = __pyx_pybuffernd_indL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indL.diminfo[0].shape = __pyx_pybuffernd_indL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __pyx_v_indL = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_11);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __pyx_v_NL = ((PyArrayObject *)__pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_Rref = ((PyArrayObject *)__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":948
 *         # Get the actual R and Z resolutions and mesh elements
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *         R0 = np.copy(Rref)             # <<<<<<<<<<<<<<
 *         NR0 = R0.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_copy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 948, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_10, ((PyObject *)__pyx_v_Rref)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 948, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_Rref)};
        __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_12);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_Rref)};
        __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_12);
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, ((PyObject *)__pyx_v_Rref));
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 948, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 948, __pyx_L1_error)
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_12);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_R0.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_R0.rcbuffer->pybuffer, (PyObject*)__pyx_v_R0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_R0.diminfo[0].strides = __pyx_pybuffernd_R0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R0.diminfo[0].shape = __pyx_pybuffernd_R0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 948, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_R0 = ((PyArrayObject *)__pyx_t_12);
    __pyx_t_12 = 0;

    /* "tofu/geom/_GG03.pyx":949
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *         R0 = np.copy(Rref)
 *         NR0 = R0.size             # <<<<<<<<<<<<<<
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DR is not None:
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_R0), __pyx_n_s_size); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 949, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_NR0 = __pyx_t_14;

    /* "tofu/geom/_GG03.pyx":950
 *         R0 = np.copy(Rref)
 *         NR0 = R0.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)             # <<<<<<<<<<<<<<
 *         if DR is not None:
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_PtsCross->dimensions[1])); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)) < 0) __PYX_ERR(0, 950, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_indin = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":951
 *         NR0 = R0.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DR is not None:             # <<<<<<<<<<<<<<
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 *         if DZ is not None:
 */
    __pyx_t_1 = (__pyx_v_DR != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "tofu/geom/_GG03.pyx":952
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DR is not None:
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])             # <<<<<<<<<<<<<<
 *         if DZ is not None:
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])
 */
      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_DR, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = PyObject_RichCompare(((PyObject *)__pyx_v_R0), __pyx_t_9, Py_GE); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyNumber_And(__pyx_v_indin, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_DR, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_RichCompare(((PyObject *)__pyx_v_R0), __pyx_t_11, Py_LE); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyNumber_And(__pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 952, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "tofu/geom/_GG03.pyx":951
 *         NR0 = R0.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DR is not None:             # <<<<<<<<<<<<<<
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 *         if DZ is not None:
 */
    }

    /* "tofu/geom/_GG03.pyx":953
 *         if DR is not None:
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 *         if DZ is not None:             # <<<<<<<<<<<<<<
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 */
    __pyx_t_2 = (__pyx_v_DZ != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":954
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 *         if DZ is not None:
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])             # <<<<<<<<<<<<<<
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()
 */
      __pyx_t_11 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__131); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_DZ, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyNumber_And(__pyx_v_indin, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__133); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_DZ, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_LE); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyNumber_And(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 954, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "tofu/geom/_GG03.pyx":953
 *         if DR is not None:
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 *         if DZ is not None:             # <<<<<<<<<<<<<<
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 */
    }

    /* "tofu/geom/_GG03.pyx":955
 *         if DZ is not None:
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]             # <<<<<<<<<<<<<<
 *         Ln = indin.sum()
 *         Indin = indin.nonzero()[0]
 */
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_slice__134);
    __Pyx_GIVEREF(__pyx_slice__134);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_slice__134);
    __Pyx_INCREF(__pyx_v_indin);
    __Pyx_GIVEREF(__pyx_v_indin);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_indin);
    __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 955, __pyx_L1_error)
    __pyx_t_11 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), __pyx_v_indin); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 955, __pyx_L1_error)
    __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_indL), __pyx_v_indin); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 955, __pyx_L1_error)
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_Rref), __pyx_v_indin); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 955, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 955, __pyx_L1_error)
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 955, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __Pyx_DECREF_SET(__pyx_v_PtsCross, ((PyArrayObject *)__pyx_t_10));
    __pyx_t_10 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_11);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 955, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __Pyx_DECREF_SET(__pyx_v_dLr, ((PyArrayObject *)__pyx_t_11));
    __pyx_t_11 = 0;
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_12);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_v_indL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_indL.diminfo[0].strides = __pyx_pybuffernd_indL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indL.diminfo[0].shape = __pyx_pybuffernd_indL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 955, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __Pyx_DECREF_SET(__pyx_v_indL, ((PyArrayObject *)__pyx_t_12));
    __pyx_t_12 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 955, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __Pyx_DECREF_SET(__pyx_v_Rref, ((PyArrayObject *)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":956
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()             # <<<<<<<<<<<<<<
 *         Indin = indin.nonzero()[0]
 * 
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (__pyx_t_11) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 956, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 956, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 956, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_Ln = __pyx_t_14;

    /* "tofu/geom/_GG03.pyx":957
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()
 *         Indin = indin.nonzero()[0]             # <<<<<<<<<<<<<<
 * 
 *         dRPhir, dPhir = np.empty((Ln,)), np.empty((Ln,))
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (__pyx_t_11) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 957, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 957, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_12);
    if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 957, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_Indin = __pyx_t_25;
    __pyx_t_25.memview = NULL;
    __pyx_t_25.data = NULL;

    /* "tofu/geom/_GG03.pyx":959
 *         Indin = indin.nonzero()[0]
 * 
 *         dRPhir, dPhir = np.empty((Ln,)), np.empty((Ln,))             # <<<<<<<<<<<<<<
 *         Phin = np.zeros((Ln,),dtype=int)
 *         NRPhi = np.empty((Ln,))
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 959, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
        __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
        __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 959, __pyx_L1_error)
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 959, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_11);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_9};
        __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_9};
        __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_11);
    if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 959, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_12);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_v_dRPhir, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_dRPhir.diminfo[0].strides = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dRPhir.diminfo[0].shape = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 959, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_dRPhir = ((PyArrayObject *)__pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_v_dPhir = __pyx_t_26;
    __pyx_t_26.memview = NULL;
    __pyx_t_26.data = NULL;

    /* "tofu/geom/_GG03.pyx":960
 * 
 *         dRPhir, dPhir = np.empty((Ln,)), np.empty((Ln,))
 *         Phin = np.zeros((Ln,),dtype=int)             # <<<<<<<<<<<<<<
 *         NRPhi = np.empty((Ln,))
 *         NRPhi0 = np.zeros((Ln,),dtype=int)
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 960, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_4);
    if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 960, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_Phin = __pyx_t_25;
    __pyx_t_25.memview = NULL;
    __pyx_t_25.data = NULL;

    /* "tofu/geom/_GG03.pyx":961
 *         dRPhir, dPhir = np.empty((Ln,)), np.empty((Ln,))
 *         Phin = np.zeros((Ln,),dtype=int)
 *         NRPhi = np.empty((Ln,))             # <<<<<<<<<<<<<<
 *         NRPhi0 = np.zeros((Ln,),dtype=int)
 *         nRPhi0, indR0ii = 0, 0
 */
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_empty); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 961, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 961, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_26 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_4);
    if (unlikely(!__pyx_t_26.memview)) __PYX_ERR(0, 961, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_NRPhi = __pyx_t_26;
    __pyx_t_26.memview = NULL;
    __pyx_t_26.data = NULL;

    /* "tofu/geom/_GG03.pyx":962
 *         Phin = np.zeros((Ln,),dtype=int)
 *         NRPhi = np.empty((Ln,))
 *         NRPhi0 = np.zeros((Ln,),dtype=int)             # <<<<<<<<<<<<<<
 *         nRPhi0, indR0ii = 0, 0
 *         NP, NPhimax = 0, 0
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 962, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_11);
    if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 962, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_NRPhi0 = __pyx_t_25;
    __pyx_t_25.memview = NULL;
    __pyx_t_25.data = NULL;

    /* "tofu/geom/_GG03.pyx":963
 *         NRPhi = np.empty((Ln,))
 *         NRPhi0 = np.zeros((Ln,),dtype=int)
 *         nRPhi0, indR0ii = 0, 0             # <<<<<<<<<<<<<<
 *         NP, NPhimax = 0, 0
 *         Rratio = int(Cceil(np.max(Rref)/np.min(Rref)))
 */
    __pyx_t_14 = 0;
    __pyx_t_27 = 0;
    __pyx_v_nRPhi0 = __pyx_t_14;
    __pyx_v_indR0ii = __pyx_t_27;

    /* "tofu/geom/_GG03.pyx":964
 *         NRPhi0 = np.zeros((Ln,),dtype=int)
 *         nRPhi0, indR0ii = 0, 0
 *         NP, NPhimax = 0, 0             # <<<<<<<<<<<<<<
 *         Rratio = int(Cceil(np.max(Rref)/np.min(Rref)))
 *         indBounds = np.empty((2,nBounds),dtype=int)
 */
    __pyx_t_27 = 0;
    __pyx_t_28 = 0;
    __pyx_v_NP = __pyx_t_27;
    __pyx_v_NPhimax = __pyx_t_28;

    /* "tofu/geom/_GG03.pyx":965
 *         nRPhi0, indR0ii = 0, 0
 *         NP, NPhimax = 0, 0
 *         Rratio = int(Cceil(np.max(Rref)/np.min(Rref)))             # <<<<<<<<<<<<<<
 *         indBounds = np.empty((2,nBounds),dtype=int)
 *         for ii in range(0,Ln):
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_max); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_Rref)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_Rref)};
        __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_Rref)};
        __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, ((PyObject *)__pyx_v_Rref));
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_min); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_12) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, ((PyObject *)__pyx_v_Rref)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, ((PyObject *)__pyx_v_Rref)};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, ((PyObject *)__pyx_v_Rref)};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); __pyx_t_12 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, ((PyObject *)__pyx_v_Rref));
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 965, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 965, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_Rratio = ((int)ceil(__pyx_t_7));

    /* "tofu/geom/_GG03.pyx":966
 *         NP, NPhimax = 0, 0
 *         Rratio = int(Cceil(np.max(Rref)/np.min(Rref)))
 *         indBounds = np.empty((2,nBounds),dtype=int)             # <<<<<<<<<<<<<<
 *         for ii in range(0,Ln):
 *             # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_nBounds); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_2);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 966, __pyx_L1_error)
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_v_indBounds = __pyx_t_10;
    __pyx_t_10 = 0;

    /* "tofu/geom/_GG03.pyx":967
 *         Rratio = int(Cceil(np.max(Rref)/np.min(Rref)))
 *         indBounds = np.empty((2,nBounds),dtype=int)
 *         for ii in range(0,Ln):             # <<<<<<<<<<<<<<
 *             # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 *             NRPhi[ii] = Cceil(DPhiMinMax*Rref[ii]/dRPhi)
 */
    __pyx_t_27 = __pyx_v_Ln;
    for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_27; __pyx_t_14+=1) {
      __pyx_v_ii = __pyx_t_14;

      /* "tofu/geom/_GG03.pyx":969
 *         for ii in range(0,Ln):
 *             # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 *             NRPhi[ii] = Cceil(DPhiMinMax*Rref[ii]/dRPhi)             # <<<<<<<<<<<<<<
 *             NRPhi_int = int(NRPhi[ii])
 *             dPhir[ii] = DPhiMinMax/NRPhi[ii]
 */
      __pyx_t_29 = __pyx_v_ii;
      __pyx_t_30 = __pyx_v_ii;
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_30)) )) = ceil(((__pyx_v_DPhiMinMax * (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_Rref.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_Rref.diminfo[0].strides))) / __pyx_v_dRPhi));

      /* "tofu/geom/_GG03.pyx":970
 *             # Get the actual RPhi resolution and Phi mesh elements (! depends on R !)
 *             NRPhi[ii] = Cceil(DPhiMinMax*Rref[ii]/dRPhi)
 *             NRPhi_int = int(NRPhi[ii])             # <<<<<<<<<<<<<<
 *             dPhir[ii] = DPhiMinMax/NRPhi[ii]
 *             dRPhir[ii] = dPhir[ii]*Rref[ii]
 */
      __pyx_t_31 = __pyx_v_ii;
      __pyx_v_NRPhi_int = ((int)(*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_31)) ))));

      /* "tofu/geom/_GG03.pyx":971
 *             NRPhi[ii] = Cceil(DPhiMinMax*Rref[ii]/dRPhi)
 *             NRPhi_int = int(NRPhi[ii])
 *             dPhir[ii] = DPhiMinMax/NRPhi[ii]             # <<<<<<<<<<<<<<
 *             dRPhir[ii] = dPhir[ii]*Rref[ii]
 *             # Get index and cumulated indices from background
 */
      __pyx_t_32 = __pyx_v_ii;
      __pyx_t_33 = __pyx_v_ii;
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_33)) )) = (__pyx_v_DPhiMinMax / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_NRPhi.data) + __pyx_t_32)) ))));

      /* "tofu/geom/_GG03.pyx":972
 *             NRPhi_int = int(NRPhi[ii])
 *             dPhir[ii] = DPhiMinMax/NRPhi[ii]
 *             dRPhir[ii] = dPhir[ii]*Rref[ii]             # <<<<<<<<<<<<<<
 *             # Get index and cumulated indices from background
 *             for jj0 in range(indR0ii,NR0):
 */
      __pyx_t_34 = __pyx_v_ii;
      __pyx_t_35 = __pyx_v_ii;
      __pyx_t_36 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_dRPhir.diminfo[0].strides) = ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_34)) ))) * (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_Rref.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_Rref.diminfo[0].strides)));

      /* "tofu/geom/_GG03.pyx":974
 *             dRPhir[ii] = dPhir[ii]*Rref[ii]
 *             # Get index and cumulated indices from background
 *             for jj0 in range(indR0ii,NR0):             # <<<<<<<<<<<<<<
 *                 if jj0==Indin[ii]:
 *                     indR0ii = jj0
 */
      __pyx_t_37 = __pyx_v_NR0;
      for (__pyx_t_38 = __pyx_v_indR0ii; __pyx_t_38 < __pyx_t_37; __pyx_t_38+=1) {
        __pyx_v_jj0 = __pyx_t_38;

        /* "tofu/geom/_GG03.pyx":975
 *             # Get index and cumulated indices from background
 *             for jj0 in range(indR0ii,NR0):
 *                 if jj0==Indin[ii]:             # <<<<<<<<<<<<<<
 *                     indR0ii = jj0
 *                     break
 */
        __pyx_t_39 = __pyx_v_ii;
        __pyx_t_1 = ((__pyx_v_jj0 == (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Indin.data) + __pyx_t_39)) )))) != 0);
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":976
 *             for jj0 in range(indR0ii,NR0):
 *                 if jj0==Indin[ii]:
 *                     indR0ii = jj0             # <<<<<<<<<<<<<<
 *                     break
 *                 else:
 */
          __pyx_v_indR0ii = __pyx_v_jj0;

          /* "tofu/geom/_GG03.pyx":977
 *                 if jj0==Indin[ii]:
 *                     indR0ii = jj0
 *                     break             # <<<<<<<<<<<<<<
 *                 else:
 *                     nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)
 */
          goto __pyx_L19_break;

          /* "tofu/geom/_GG03.pyx":975
 *             # Get index and cumulated indices from background
 *             for jj0 in range(indR0ii,NR0):
 *                 if jj0==Indin[ii]:             # <<<<<<<<<<<<<<
 *                     indR0ii = jj0
 *                     break
 */
        }

        /* "tofu/geom/_GG03.pyx":979
 *                     break
 *                 else:
 *                     nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)             # <<<<<<<<<<<<<<
 *                     NRPhi0[ii] = nRPhi0
 *             # Get indices of phi
 */
        /*else*/ {
          __pyx_t_40 = __pyx_v_jj0;
          __pyx_v_nRPhi0 = (__pyx_v_nRPhi0 + ((long)ceil(((__pyx_v_DPhiMinMax * (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_R0.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_R0.diminfo[0].strides))) / __pyx_v_dRPhi))));

          /* "tofu/geom/_GG03.pyx":980
 *                 else:
 *                     nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)
 *                     NRPhi0[ii] = nRPhi0             # <<<<<<<<<<<<<<
 *             # Get indices of phi
 *             # Get the extreme indices of the mesh elements that really need to be created within those limits
 */
          __pyx_t_41 = __pyx_v_ii;
          *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_41)) )) = __pyx_v_nRPhi0;
        }
      }
      __pyx_L19_break:;

      /* "tofu/geom/_GG03.pyx":983
 *             # Get indices of phi
 *             # Get the extreme indices of the mesh elements that really need to be created within those limits
 *             for kk in range(0,nBounds):             # <<<<<<<<<<<<<<
 *                 abs0 = BC[kk][0]-PhiMinMax[0]
 *                 if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:
 */
      __pyx_t_17 = __pyx_v_nBounds;
      for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
        __pyx_v_kk = __pyx_t_18;

        /* "tofu/geom/_GG03.pyx":984
 *             # Get the extreme indices of the mesh elements that really need to be created within those limits
 *             for kk in range(0,nBounds):
 *                 abs0 = BC[kk][0]-PhiMinMax[0]             # <<<<<<<<<<<<<<
 *                 if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:
 *                     nPhi0 = int(Cround(abs0/dPhir[ii]))
 */
        __pyx_t_10 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_kk), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = PyNumber_Subtract(__pyx_t_10, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 984, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 984, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_v_abs0 = __pyx_t_7;

        /* "tofu/geom/_GG03.pyx":985
 *             for kk in range(0,nBounds):
 *                 abs0 = BC[kk][0]-PhiMinMax[0]
 *                 if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *                     nPhi0 = int(Cround(abs0/dPhir[ii]))
 *                 else:
 */
        __pyx_t_42 = __pyx_v_ii;
        __pyx_t_43 = __pyx_v_ii;
        __pyx_t_44 = __pyx_v_ii;
        __pyx_t_1 = (((__pyx_v_abs0 - ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_42)) ))) * floor((__pyx_v_abs0 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_43)) ))))))) < (__pyx_v_margin * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_44)) ))))) != 0);
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":986
 *                 abs0 = BC[kk][0]-PhiMinMax[0]
 *                 if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:
 *                     nPhi0 = int(Cround(abs0/dPhir[ii]))             # <<<<<<<<<<<<<<
 *                 else:
 *                     nPhi0 = int(Cfloor(abs0/dPhir[ii]))
 */
          __pyx_t_45 = __pyx_v_ii;
          __pyx_v_nPhi0 = ((int)round((__pyx_v_abs0 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_45)) ))))));

          /* "tofu/geom/_GG03.pyx":985
 *             for kk in range(0,nBounds):
 *                 abs0 = BC[kk][0]-PhiMinMax[0]
 *                 if abs0-dPhir[ii]*Cfloor(abs0/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *                     nPhi0 = int(Cround(abs0/dPhir[ii]))
 *                 else:
 */
          goto __pyx_L23;
        }

        /* "tofu/geom/_GG03.pyx":988
 *                     nPhi0 = int(Cround(abs0/dPhir[ii]))
 *                 else:
 *                     nPhi0 = int(Cfloor(abs0/dPhir[ii]))             # <<<<<<<<<<<<<<
 *                 abs1 = BC[kk][1]-PhiMinMax[0]
 *                 if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:
 */
        /*else*/ {
          __pyx_t_46 = __pyx_v_ii;
          __pyx_v_nPhi0 = ((int)floor((__pyx_v_abs0 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_46)) ))))));
        }
        __pyx_L23:;

        /* "tofu/geom/_GG03.pyx":989
 *                 else:
 *                     nPhi0 = int(Cfloor(abs0/dPhir[ii]))
 *                 abs1 = BC[kk][1]-PhiMinMax[0]             # <<<<<<<<<<<<<<
 *                 if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:
 *                     nPhi1 = int(Cround(abs1/dPhir[ii])-1)
 */
        __pyx_t_9 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_kk), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_10 = PyNumber_Subtract(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 989, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 989, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_v_abs1 = __pyx_t_7;

        /* "tofu/geom/_GG03.pyx":990
 *                     nPhi0 = int(Cfloor(abs0/dPhir[ii]))
 *                 abs1 = BC[kk][1]-PhiMinMax[0]
 *                 if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *                     nPhi1 = int(Cround(abs1/dPhir[ii])-1)
 *                 else:
 */
        __pyx_t_47 = __pyx_v_ii;
        __pyx_t_48 = __pyx_v_ii;
        __pyx_t_49 = __pyx_v_ii;
        __pyx_t_1 = (((__pyx_v_abs1 - ((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_47)) ))) * floor((__pyx_v_abs1 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_48)) ))))))) < (__pyx_v_margin * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_49)) ))))) != 0);
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":991
 *                 abs1 = BC[kk][1]-PhiMinMax[0]
 *                 if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:
 *                     nPhi1 = int(Cround(abs1/dPhir[ii])-1)             # <<<<<<<<<<<<<<
 *                 else:
 *                     nPhi1 = int(Cfloor(abs1/dPhir[ii]))
 */
          __pyx_t_50 = __pyx_v_ii;
          __pyx_v_nPhi1 = ((int)(round((__pyx_v_abs1 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_50)) ))))) - 1.0));

          /* "tofu/geom/_GG03.pyx":990
 *                     nPhi0 = int(Cfloor(abs0/dPhir[ii]))
 *                 abs1 = BC[kk][1]-PhiMinMax[0]
 *                 if abs1-dPhir[ii]*Cfloor(abs1/dPhir[ii])<margin*dPhir[ii]:             # <<<<<<<<<<<<<<
 *                     nPhi1 = int(Cround(abs1/dPhir[ii])-1)
 *                 else:
 */
          goto __pyx_L24;
        }

        /* "tofu/geom/_GG03.pyx":993
 *                     nPhi1 = int(Cround(abs1/dPhir[ii])-1)
 *                 else:
 *                     nPhi1 = int(Cfloor(abs1/dPhir[ii]))             # <<<<<<<<<<<<<<
 *                 indBounds[0,kk] = nPhi0
 *                 indBounds[1,kk] = nPhi1
 */
        /*else*/ {
          __pyx_t_51 = __pyx_v_ii;
          __pyx_v_nPhi1 = ((int)floor((__pyx_v_abs1 / (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_51)) ))))));
        }
        __pyx_L24:;

        /* "tofu/geom/_GG03.pyx":994
 *                 else:
 *                     nPhi1 = int(Cfloor(abs1/dPhir[ii]))
 *                 indBounds[0,kk] = nPhi0             # <<<<<<<<<<<<<<
 *                 indBounds[1,kk] = nPhi1
 *                 Phin[ii] += nPhi1+1-nPhi0
 */
        __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nPhi0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = PyInt_FromSsize_t(__pyx_v_kk); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
        __pyx_t_11 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_indBounds, __pyx_t_9, __pyx_t_10) < 0)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "tofu/geom/_GG03.pyx":995
 *                     nPhi1 = int(Cfloor(abs1/dPhir[ii]))
 *                 indBounds[0,kk] = nPhi0
 *                 indBounds[1,kk] = nPhi1             # <<<<<<<<<<<<<<
 *                 Phin[ii] += nPhi1+1-nPhi0
 * 
 */
        __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nPhi1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_kk); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_1);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
        __pyx_t_9 = 0;
        if (unlikely(PyObject_SetItem(__pyx_v_indBounds, __pyx_t_11, __pyx_t_10) < 0)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

        /* "tofu/geom/_GG03.pyx":996
 *                 indBounds[0,kk] = nPhi0
 *                 indBounds[1,kk] = nPhi1
 *                 Phin[ii] += nPhi1+1-nPhi0             # <<<<<<<<<<<<<<
 * 
 *             if ii==0:
 */
        __pyx_t_52 = __pyx_v_ii;
        *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_52)) )) += ((__pyx_v_nPhi1 + 1) - __pyx_v_nPhi0);
      }

      /* "tofu/geom/_GG03.pyx":998
 *                 Phin[ii] += nPhi1+1-nPhi0
 * 
 *             if ii==0:             # <<<<<<<<<<<<<<
 *                 indI = np.nan*np.ones((Ln,Phin[ii]*Rratio+1))
 *             jj = 0
 */
      __pyx_t_1 = ((__pyx_v_ii == 0) != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":999
 * 
 *             if ii==0:
 *                 indI = np.nan*np.ones((Ln,Phin[ii]*Rratio+1))             # <<<<<<<<<<<<<<
 *             jj = 0
 *             for kk in range(0,nBounds):
 */
        __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_nan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_53 = __pyx_v_ii;
        __pyx_t_12 = __Pyx_PyInt_From_long((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_53)) ))) * __pyx_v_Rratio) + 1)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_12);
        __pyx_t_9 = 0;
        __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (!__pyx_t_12) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 999, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_10);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_3};
            __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 999, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_3};
            __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 999, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 999, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12); __pyx_t_12 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 999, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Multiply(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 999, __pyx_L1_error)
        __pyx_t_19 = ((PyArrayObject *)__pyx_t_4);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
          __pyx_t_37 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indI.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_37 < 0)) {
            PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indI.rcbuffer->pybuffer, (PyObject*)__pyx_v_indI, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
            }
            __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
          }
          __pyx_pybuffernd_indI.diminfo[0].strides = __pyx_pybuffernd_indI.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indI.diminfo[0].shape = __pyx_pybuffernd_indI.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_indI.diminfo[1].strides = __pyx_pybuffernd_indI.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_indI.diminfo[1].shape = __pyx_pybuffernd_indI.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_37 < 0)) __PYX_ERR(0, 999, __pyx_L1_error)
        }
        __pyx_t_19 = 0;
        __Pyx_XDECREF_SET(__pyx_v_indI, ((PyArrayObject *)__pyx_t_4));
        __pyx_t_4 = 0;

        /* "tofu/geom/_GG03.pyx":998
 *                 Phin[ii] += nPhi1+1-nPhi0
 * 
 *             if ii==0:             # <<<<<<<<<<<<<<
 *                 indI = np.nan*np.ones((Ln,Phin[ii]*Rratio+1))
 *             jj = 0
 */
      }

      /* "tofu/geom/_GG03.pyx":1000
 *             if ii==0:
 *                 indI = np.nan*np.ones((Ln,Phin[ii]*Rratio+1))
 *             jj = 0             # <<<<<<<<<<<<<<
 *             for kk in range(0,nBounds):
 *                 for kkb in range(indBounds[0,kk],indBounds[1,kk]+1):
 */
      __pyx_v_jj = 0;

      /* "tofu/geom/_GG03.pyx":1001
 *                 indI = np.nan*np.ones((Ln,Phin[ii]*Rratio+1))
 *             jj = 0
 *             for kk in range(0,nBounds):             # <<<<<<<<<<<<<<
 *                 for kkb in range(indBounds[0,kk],indBounds[1,kk]+1):
 *                     indI[ii,jj] = <double>( kkb )
 */
      __pyx_t_17 = __pyx_v_nBounds;
      for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) {
        __pyx_v_kk = __pyx_t_18;

        /* "tofu/geom/_GG03.pyx":1002
 *             jj = 0
 *             for kk in range(0,nBounds):
 *                 for kkb in range(indBounds[0,kk],indBounds[1,kk]+1):             # <<<<<<<<<<<<<<
 *                     indI[ii,jj] = <double>( kkb )
 *                     jj += 1
 */
        __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_kk); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_GetItem(__pyx_v_indBounds, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyInt_FromSsize_t(__pyx_v_kk); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_int_1);
        __Pyx_GIVEREF(__pyx_int_1);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_1);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_GetItem(__pyx_v_indBounds, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyInt_AddObjC(__pyx_t_10, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
        __pyx_t_4 = 0;
        __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_10, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
          __pyx_t_10 = __pyx_t_11; __Pyx_INCREF(__pyx_t_10); __pyx_t_54 = 0;
          __pyx_t_55 = NULL;
        } else {
          __pyx_t_54 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_55 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_55)) __PYX_ERR(0, 1002, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        for (;;) {
          if (likely(!__pyx_t_55)) {
            if (likely(PyList_CheckExact(__pyx_t_10))) {
              if (__pyx_t_54 >= PyList_GET_SIZE(__pyx_t_10)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_54); __Pyx_INCREF(__pyx_t_11); __pyx_t_54++; if (unlikely(0 < 0)) __PYX_ERR(0, 1002, __pyx_L1_error)
              #else
              __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_54); __pyx_t_54++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1002, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            } else {
              if (__pyx_t_54 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_54); __Pyx_INCREF(__pyx_t_11); __pyx_t_54++; if (unlikely(0 < 0)) __PYX_ERR(0, 1002, __pyx_L1_error)
              #else
              __pyx_t_11 = PySequence_ITEM(__pyx_t_10, __pyx_t_54); __pyx_t_54++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1002, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            }
          } else {
            __pyx_t_11 = __pyx_t_55(__pyx_t_10);
            if (unlikely(!__pyx_t_11)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1002, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_11);
          }
          __Pyx_XDECREF_SET(__pyx_v_kkb, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "tofu/geom/_GG03.pyx":1003
 *             for kk in range(0,nBounds):
 *                 for kkb in range(indBounds[0,kk],indBounds[1,kk]+1):
 *                     indI[ii,jj] = <double>( kkb )             # <<<<<<<<<<<<<<
 *                     jj += 1
 *             NP += Phin[ii]
 */
          __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_kkb); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1003, __pyx_L1_error)
          __pyx_t_56 = __pyx_v_ii;
          __pyx_t_57 = __pyx_v_jj;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_indI.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_indI.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_indI.diminfo[1].strides) = ((double)__pyx_t_7);

          /* "tofu/geom/_GG03.pyx":1004
 *                 for kkb in range(indBounds[0,kk],indBounds[1,kk]+1):
 *                     indI[ii,jj] = <double>( kkb )
 *                     jj += 1             # <<<<<<<<<<<<<<
 *             NP += Phin[ii]
 * 
 */
          __pyx_v_jj = (__pyx_v_jj + 1);

          /* "tofu/geom/_GG03.pyx":1002
 *             jj = 0
 *             for kk in range(0,nBounds):
 *                 for kkb in range(indBounds[0,kk],indBounds[1,kk]+1):             # <<<<<<<<<<<<<<
 *                     indI[ii,jj] = <double>( kkb )
 *                     jj += 1
 */
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }

      /* "tofu/geom/_GG03.pyx":1005
 *                     indI[ii,jj] = <double>( kkb )
 *                     jj += 1
 *             NP += Phin[ii]             # <<<<<<<<<<<<<<
 * 
 *         # Finish counting to get total number of points
 */
      __pyx_t_58 = __pyx_v_ii;
      __pyx_v_NP = (__pyx_v_NP + (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_Phin.data) + __pyx_t_58)) ))));
    }

    /* "tofu/geom/_GG03.pyx":1008
 * 
 *         # Finish counting to get total number of points
 *         if jj0<=NR0-1:             # <<<<<<<<<<<<<<
 *             for jj0 in range(indR0ii,NR0):
 *                 nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)
 */
    __pyx_t_1 = ((__pyx_v_jj0 <= (__pyx_v_NR0 - 1)) != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":1009
 *         # Finish counting to get total number of points
 *         if jj0<=NR0-1:
 *             for jj0 in range(indR0ii,NR0):             # <<<<<<<<<<<<<<
 *                 nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)
 * 
 */
      __pyx_t_27 = __pyx_v_NR0;
      for (__pyx_t_14 = __pyx_v_indR0ii; __pyx_t_14 < __pyx_t_27; __pyx_t_14+=1) {
        __pyx_v_jj0 = __pyx_t_14;

        /* "tofu/geom/_GG03.pyx":1010
 *         if jj0<=NR0-1:
 *             for jj0 in range(indR0ii,NR0):
 *                 nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)             # <<<<<<<<<<<<<<
 * 
 *         # Compute Pts, dV and ind
 */
        __pyx_t_59 = __pyx_v_jj0;
        __pyx_v_nRPhi0 = (__pyx_v_nRPhi0 + ((long)ceil(((__pyx_v_DPhiMinMax * (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_R0.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_R0.diminfo[0].strides))) / __pyx_v_dRPhi))));
      }

      /* "tofu/geom/_GG03.pyx":1008
 * 
 *         # Finish counting to get total number of points
 *         if jj0<=NR0-1:             # <<<<<<<<<<<<<<
 *             for jj0 in range(indR0ii,NR0):
 *                 nRPhi0 += <long>Cceil(DPhiMinMax*R0[jj0]/dRPhi)
 */
    }

    /* "tofu/geom/_GG03.pyx":1013
 * 
 *         # Compute Pts, dV and ind
 *         Pts = np.nan*np.ones((3,NP))             # <<<<<<<<<<<<<<
 *         ind = np.nan*np.ones((NP,))
 *         dS = np.nan*np.ones((NP,))
 */
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_nan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_int_3);
    __Pyx_GIVEREF(__pyx_int_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1013, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_10);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
        __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1013, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3};
        __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1013, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1013, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1013, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_11, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1013, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1013, __pyx_L1_error)
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_27 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1013, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":1014
 *         # Compute Pts, dV and ind
 *         Pts = np.nan*np.ones((3,NP))
 *         ind = np.nan*np.ones((NP,))             # <<<<<<<<<<<<<<
 *         dS = np.nan*np.ones((NP,))
 *         # This triple loop is the longest part, it takes ~90% of the CPU time
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_nan); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_ones); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_11 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (!__pyx_t_11) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1014, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_3};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_3};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11); __pyx_t_11 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Multiply(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1014, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1014, __pyx_L1_error)
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_12);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_27 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1014, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_ind = ((PyArrayObject *)__pyx_t_12);
    __pyx_t_12 = 0;

    /* "tofu/geom/_GG03.pyx":1015
 *         Pts = np.nan*np.ones((3,NP))
 *         ind = np.nan*np.ones((NP,))
 *         dS = np.nan*np.ones((NP,))             # <<<<<<<<<<<<<<
 *         # This triple loop is the longest part, it takes ~90% of the CPU time
 *         NP = 0
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_nan); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_NP); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1015, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_3};
        __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1015, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_3};
        __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1015, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1015, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1015, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1015, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1015, __pyx_L1_error)
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_27 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1015, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":1017
 *         dS = np.nan*np.ones((NP,))
 *         # This triple loop is the longest part, it takes ~90% of the CPU time
 *         NP = 0             # <<<<<<<<<<<<<<
 *         if Out.lower()=='(x,y,z)':
 *             for ii in range(0,Ln):
 */
    __pyx_v_NP = 0;

    /* "tofu/geom/_GG03.pyx":1018
 *         # This triple loop is the longest part, it takes ~90% of the CPU time
 *         NP = 0
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1018, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (__pyx_t_9) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1018, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1018, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_4, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1018, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":1019
 *         NP = 0
 *         if Out.lower()=='(x,y,z)':
 *             for ii in range(0,Ln):             # <<<<<<<<<<<<<<
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated
 *                 for jj in range(0,len(iii)):
 */
      __pyx_t_27 = __pyx_v_Ln;
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_27; __pyx_t_14+=1) {
        __pyx_v_ii = __pyx_t_14;

        /* "tofu/geom/_GG03.pyx":1020
 *         if Out.lower()=='(x,y,z)':
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated             # <<<<<<<<<<<<<<
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]
 */
        __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_unique); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3);
        __Pyx_INCREF(__pyx_slice__135);
        __Pyx_GIVEREF(__pyx_slice__135);
        PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_slice__135);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_15)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        if (!__pyx_t_15) {
          __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1020, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_11);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_3};
            __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_3};
            __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_15); __pyx_t_15 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyNumber_Invert(__pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
        __pyx_t_12 = 0;
        __pyx_t_10 = 0;
        __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1020, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        if (!__pyx_t_11) {
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
            __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
            __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          } else
          #endif
          {
            __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
            __Pyx_GIVEREF(__pyx_t_10);
            PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_10);
            __pyx_t_10 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1020, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1020, __pyx_L1_error)
        __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
          __pyx_t_37 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_37 < 0)) {
            PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_v_iii, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
            }
            __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
          }
          __pyx_pybuffernd_iii.diminfo[0].strides = __pyx_pybuffernd_iii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iii.diminfo[0].shape = __pyx_pybuffernd_iii.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_37 < 0)) __PYX_ERR(0, 1020, __pyx_L1_error)
        }
        __pyx_t_23 = 0;
        __Pyx_XDECREF_SET(__pyx_v_iii, ((PyArrayObject *)__pyx_t_4));
        __pyx_t_4 = 0;

        /* "tofu/geom/_GG03.pyx":1021
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated
 *                 for jj in range(0,len(iii)):             # <<<<<<<<<<<<<<
 *                     indiijj = iii[jj]
 *                     phi = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 */
        __pyx_t_17 = PyObject_Length(((PyObject *)__pyx_v_iii)); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1021, __pyx_L1_error)
        for (__pyx_t_37 = 0; __pyx_t_37 < __pyx_t_17; __pyx_t_37+=1) {
          __pyx_v_jj = __pyx_t_37;

          /* "tofu/geom/_GG03.pyx":1022
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]             # <<<<<<<<<<<<<<
 *                     phi = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 *                     Pts[0,NP] = PtsCross[0,ii]*Ccos(phi)
 */
          __pyx_t_60 = __pyx_v_jj;
          __pyx_v_indiijj = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_iii.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_iii.diminfo[0].strides));

          /* "tofu/geom/_GG03.pyx":1023
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]
 *                     phi = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]             # <<<<<<<<<<<<<<
 *                     Pts[0,NP] = PtsCross[0,ii]*Ccos(phi)
 *                     Pts[1,NP] = PtsCross[0,ii]*Csin(phi)
 */
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1023, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_61 = __pyx_v_ii;
          __pyx_t_9 = PyFloat_FromDouble(((0.5 + __pyx_v_indiijj) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_61)) ))))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1023, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_12 = PyNumber_Add(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1023, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_12); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1023, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_v_phi = __pyx_t_7;

          /* "tofu/geom/_GG03.pyx":1024
 *                     indiijj = iii[jj]
 *                     phi = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 *                     Pts[0,NP] = PtsCross[0,ii]*Ccos(phi)             # <<<<<<<<<<<<<<
 *                     Pts[1,NP] = PtsCross[0,ii]*Csin(phi)
 *                     Pts[2,NP] = PtsCross[1,ii]
 */
          __pyx_t_62 = 0;
          __pyx_t_63 = __pyx_v_ii;
          __pyx_t_64 = 0;
          __pyx_t_65 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_PtsCross.diminfo[1].strides)) * cos(__pyx_v_phi));

          /* "tofu/geom/_GG03.pyx":1025
 *                     phi = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 *                     Pts[0,NP] = PtsCross[0,ii]*Ccos(phi)
 *                     Pts[1,NP] = PtsCross[0,ii]*Csin(phi)             # <<<<<<<<<<<<<<
 *                     Pts[2,NP] = PtsCross[1,ii]
 *                     ind[NP] = NRPhi0[ii] + indiijj
 */
          __pyx_t_66 = 0;
          __pyx_t_67 = __pyx_v_ii;
          __pyx_t_68 = 1;
          __pyx_t_69 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_PtsCross.diminfo[1].strides)) * sin(__pyx_v_phi));

          /* "tofu/geom/_GG03.pyx":1026
 *                     Pts[0,NP] = PtsCross[0,ii]*Ccos(phi)
 *                     Pts[1,NP] = PtsCross[0,ii]*Csin(phi)
 *                     Pts[2,NP] = PtsCross[1,ii]             # <<<<<<<<<<<<<<
 *                     ind[NP] = NRPhi0[ii] + indiijj
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 */
          __pyx_t_70 = 1;
          __pyx_t_71 = __pyx_v_ii;
          __pyx_t_72 = 2;
          __pyx_t_73 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_73, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_71, __pyx_pybuffernd_PtsCross.diminfo[1].strides));

          /* "tofu/geom/_GG03.pyx":1027
 *                     Pts[1,NP] = PtsCross[0,ii]*Csin(phi)
 *                     Pts[2,NP] = PtsCross[1,ii]
 *                     ind[NP] = NRPhi0[ii] + indiijj             # <<<<<<<<<<<<<<
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 *                     NP += 1
 */
          __pyx_t_74 = __pyx_v_ii;
          __pyx_t_75 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_ind.diminfo[0].strides) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_74)) ))) + __pyx_v_indiijj);

          /* "tofu/geom/_GG03.pyx":1028
 *                     Pts[2,NP] = PtsCross[1,ii]
 *                     ind[NP] = NRPhi0[ii] + indiijj
 *                     dS[NP] = dLr[ii]*dRPhir[ii]             # <<<<<<<<<<<<<<
 *                     NP += 1
 *         else:
 */
          __pyx_t_76 = __pyx_v_ii;
          __pyx_t_77 = __pyx_v_ii;
          __pyx_t_78 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_dS.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_dLr.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_77, __pyx_pybuffernd_dRPhir.diminfo[0].strides)));

          /* "tofu/geom/_GG03.pyx":1029
 *                     ind[NP] = NRPhi0[ii] + indiijj
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 *                     NP += 1             # <<<<<<<<<<<<<<
 *         else:
 *             for ii in range(0,Ln):
 */
          __pyx_v_NP = (__pyx_v_NP + 1);
        }
      }

      /* "tofu/geom/_GG03.pyx":1018
 *         # This triple loop is the longest part, it takes ~90% of the CPU time
 *         NP = 0
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated
 */
      goto __pyx_L33;
    }

    /* "tofu/geom/_GG03.pyx":1031
 *                     NP += 1
 *         else:
 *             for ii in range(0,Ln):             # <<<<<<<<<<<<<<
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])])
 *                 for jj in range(0,len(iii)):
 */
    /*else*/ {
      __pyx_t_27 = __pyx_v_Ln;
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_27; __pyx_t_14+=1) {
        __pyx_v_ii = __pyx_t_14;

        /* "tofu/geom/_GG03.pyx":1032
 *         else:
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])])             # <<<<<<<<<<<<<<
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_unique); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ii); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11);
        __Pyx_INCREF(__pyx_slice__136);
        __Pyx_GIVEREF(__pyx_slice__136);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_slice__136);
        __pyx_t_11 = 0;
        __pyx_t_11 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (!__pyx_t_3) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1032, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_GOTREF(__pyx_t_10);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_11};
            __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
            PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_11};
            __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          } else
          #endif
          {
            __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL;
            __Pyx_GIVEREF(__pyx_t_11);
            PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_11);
            __pyx_t_11 = 0;
            __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Invert(__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
        __pyx_t_9 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_indI), __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1032, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (!__pyx_t_10) {
          __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1032, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_12);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_5};
            __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_5};
            __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL;
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1032, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1032, __pyx_L1_error)
        __pyx_t_23 = ((PyArrayObject *)__pyx_t_12);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
          __pyx_t_37 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_37 < 0)) {
            PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iii.rcbuffer->pybuffer, (PyObject*)__pyx_v_iii, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
            }
            __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
          }
          __pyx_pybuffernd_iii.diminfo[0].strides = __pyx_pybuffernd_iii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iii.diminfo[0].shape = __pyx_pybuffernd_iii.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_37 < 0)) __PYX_ERR(0, 1032, __pyx_L1_error)
        }
        __pyx_t_23 = 0;
        __Pyx_XDECREF_SET(__pyx_v_iii, ((PyArrayObject *)__pyx_t_12));
        __pyx_t_12 = 0;

        /* "tofu/geom/_GG03.pyx":1033
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])])
 *                 for jj in range(0,len(iii)):             # <<<<<<<<<<<<<<
 *                     indiijj = iii[jj]
 *                     Pts[0,NP] = PtsCross[0,ii]
 */
        __pyx_t_17 = PyObject_Length(((PyObject *)__pyx_v_iii)); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1033, __pyx_L1_error)
        for (__pyx_t_37 = 0; __pyx_t_37 < __pyx_t_17; __pyx_t_37+=1) {
          __pyx_v_jj = __pyx_t_37;

          /* "tofu/geom/_GG03.pyx":1034
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])])
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]             # <<<<<<<<<<<<<<
 *                     Pts[0,NP] = PtsCross[0,ii]
 *                     Pts[1,NP] = PtsCross[1,ii]
 */
          __pyx_t_79 = __pyx_v_jj;
          __pyx_v_indiijj = (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_iii.rcbuffer->pybuffer.buf, __pyx_t_79, __pyx_pybuffernd_iii.diminfo[0].strides));

          /* "tofu/geom/_GG03.pyx":1035
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]
 *                     Pts[0,NP] = PtsCross[0,ii]             # <<<<<<<<<<<<<<
 *                     Pts[1,NP] = PtsCross[1,ii]
 *                     Pts[2,NP] = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 */
          __pyx_t_80 = 0;
          __pyx_t_81 = __pyx_v_ii;
          __pyx_t_82 = 0;
          __pyx_t_83 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_81, __pyx_pybuffernd_PtsCross.diminfo[1].strides));

          /* "tofu/geom/_GG03.pyx":1036
 *                     indiijj = iii[jj]
 *                     Pts[0,NP] = PtsCross[0,ii]
 *                     Pts[1,NP] = PtsCross[1,ii]             # <<<<<<<<<<<<<<
 *                     Pts[2,NP] = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 *                     ind[NP] = NRPhi0[ii] + indiijj
 */
          __pyx_t_84 = 1;
          __pyx_t_85 = __pyx_v_ii;
          __pyx_t_86 = 1;
          __pyx_t_87 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_87, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_85, __pyx_pybuffernd_PtsCross.diminfo[1].strides));

          /* "tofu/geom/_GG03.pyx":1037
 *                     Pts[0,NP] = PtsCross[0,ii]
 *                     Pts[1,NP] = PtsCross[1,ii]
 *                     Pts[2,NP] = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]             # <<<<<<<<<<<<<<
 *                     ind[NP] = NRPhi0[ii] + indiijj
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 */
          __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1037, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_88 = __pyx_v_ii;
          __pyx_t_4 = PyFloat_FromDouble(((0.5 + __pyx_v_indiijj) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_88)) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1037, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyNumber_Add(__pyx_t_12, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1037, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1037, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_89 = 2;
          __pyx_t_90 = __pyx_v_NP;
          *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_Pts.diminfo[1].strides) = __pyx_t_7;

          /* "tofu/geom/_GG03.pyx":1038
 *                     Pts[1,NP] = PtsCross[1,ii]
 *                     Pts[2,NP] = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 *                     ind[NP] = NRPhi0[ii] + indiijj             # <<<<<<<<<<<<<<
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 *                     NP += 1
 */
          __pyx_t_91 = __pyx_v_ii;
          __pyx_t_92 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ind.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_ind.diminfo[0].strides) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_91)) ))) + __pyx_v_indiijj);

          /* "tofu/geom/_GG03.pyx":1039
 *                     Pts[2,NP] = PhiMinMax[0] + (0.5+indiijj)*dPhir[ii]
 *                     ind[NP] = NRPhi0[ii] + indiijj
 *                     dS[NP] = dLr[ii]*dRPhir[ii]             # <<<<<<<<<<<<<<
 *                     NP += 1
 *         indok = (~np.isnan(ind)).nonzero()[0]
 */
          __pyx_t_93 = __pyx_v_ii;
          __pyx_t_94 = __pyx_v_ii;
          __pyx_t_95 = __pyx_v_NP;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_dS.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_93, __pyx_pybuffernd_dLr.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_94, __pyx_pybuffernd_dRPhir.diminfo[0].strides)));

          /* "tofu/geom/_GG03.pyx":1040
 *                     ind[NP] = NRPhi0[ii] + indiijj
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 *                     NP += 1             # <<<<<<<<<<<<<<
 *         indok = (~np.isnan(ind)).nonzero()[0]
 *         ind = ind[indok]
 */
          __pyx_v_NP = (__pyx_v_NP + 1);
        }
      }
    }
    __pyx_L33:;

    /* "tofu/geom/_GG03.pyx":1041
 *                     dS[NP] = dLr[ii]*dRPhir[ii]
 *                     NP += 1
 *         indok = (~np.isnan(ind)).nonzero()[0]             # <<<<<<<<<<<<<<
 *         ind = ind[indok]
 *         dS = dS[indok]
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_isnan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_12) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_ind)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, ((PyObject *)__pyx_v_ind)};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, ((PyObject *)__pyx_v_ind)};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1041, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); __pyx_t_12 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_ind));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, ((PyObject *)__pyx_v_ind));
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Invert(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1041, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1041, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1041, __pyx_L1_error)
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indok.rcbuffer->pybuffer);
      __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indok.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_27 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indok.rcbuffer->pybuffer, (PyObject*)__pyx_v_indok, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_indok.diminfo[0].strides = __pyx_pybuffernd_indok.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indok.diminfo[0].shape = __pyx_pybuffernd_indok.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __pyx_v_indok = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":1042
 *                     NP += 1
 *         indok = (~np.isnan(ind)).nonzero()[0]
 *         ind = ind[indok]             # <<<<<<<<<<<<<<
 *         dS = dS[indok]
 *         if len(indok)==1:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_indok)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1042, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1042, __pyx_L1_error)
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_27 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1042, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":1043
 *         indok = (~np.isnan(ind)).nonzero()[0]
 *         ind = ind[indok]
 *         dS = dS[indok]             # <<<<<<<<<<<<<<
 *         if len(indok)==1:
 *             Pts = Pts[:,indok].reshape((3,1))
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_dS), ((PyObject *)__pyx_v_indok)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1043, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1043, __pyx_L1_error)
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_27 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1043, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __Pyx_DECREF_SET(__pyx_v_dS, ((PyArrayObject *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":1044
 *         ind = ind[indok]
 *         dS = dS[indok]
 *         if len(indok)==1:             # <<<<<<<<<<<<<<
 *             Pts = Pts[:,indok].reshape((3,1))
 *         else:
 */
    __pyx_t_17 = PyObject_Length(((PyObject *)__pyx_v_indok)); if (unlikely(__pyx_t_17 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1044, __pyx_L1_error)
    __pyx_t_1 = ((__pyx_t_17 == 1) != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":1045
 *         dS = dS[indok]
 *         if len(indok)==1:
 *             Pts = Pts[:,indok].reshape((3,1))             # <<<<<<<<<<<<<<
 *         else:
 *             Pts = Pts[:,indok]
 */
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_slice__137);
      __Pyx_GIVEREF(__pyx_slice__137);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_slice__137);
      __Pyx_INCREF(((PyObject *)__pyx_v_indok));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indok));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_indok));
      __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__139, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1045, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1045, __pyx_L1_error)
      __pyx_t_19 = ((PyArrayObject *)__pyx_t_9);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_27 < 0)) {
          PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
          }
          __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1045, __pyx_L1_error)
      }
      __pyx_t_19 = 0;
      __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_9));
      __pyx_t_9 = 0;

      /* "tofu/geom/_GG03.pyx":1044
 *         ind = ind[indok]
 *         dS = dS[indok]
 *         if len(indok)==1:             # <<<<<<<<<<<<<<
 *             Pts = Pts[:,indok].reshape((3,1))
 *         else:
 */
      goto __pyx_L42;
    }

    /* "tofu/geom/_GG03.pyx":1047
 *             Pts = Pts[:,indok].reshape((3,1))
 *         else:
 *             Pts = Pts[:,indok]             # <<<<<<<<<<<<<<
 *     else:
 *         Pts, dS, ind, NL, Rref, dRPhir, nRPhi0 = np.ones((3,0)), np.ones((0,)), np.ones((0,)), np.nan*np.ones((VPoly.shape[1]-1,)), np.ones((0,)), np.ones((0,)), 0
 */
    /*else*/ {
      __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_slice__140);
      __Pyx_GIVEREF(__pyx_slice__140);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__140);
      __Pyx_INCREF(((PyObject *)__pyx_v_indok));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indok));
      PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_indok));
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_Pts), __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1047, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1047, __pyx_L1_error)
      __pyx_t_19 = ((PyArrayObject *)__pyx_t_4);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_27 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_27 < 0)) {
          PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
          }
          __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_27 < 0)) __PYX_ERR(0, 1047, __pyx_L1_error)
      }
      __pyx_t_19 = 0;
      __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_4));
      __pyx_t_4 = 0;
    }
    __pyx_L42:;

    /* "tofu/geom/_GG03.pyx":936
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)
 * 
 *     if Inter:             # <<<<<<<<<<<<<<
 * 
 *         BC = list(Bounds)
 */
    goto __pyx_L7;
  }

  /* "tofu/geom/_GG03.pyx":1049
 *             Pts = Pts[:,indok]
 *     else:
 *         Pts, dS, ind, NL, Rref, dRPhir, nRPhi0 = np.ones((3,0)), np.ones((0,)), np.ones((0,)), np.nan*np.ones((VPoly.shape[1]-1,)), np.ones((0,)), np.ones((0,)), 0             # <<<<<<<<<<<<<<
 *     return Pts, dS, ind.astype(int), NL, dLr, Rref, dRPhir, nRPhi0, VPbis
 * 
 */
  /*else*/ {
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__142, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error)
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ones); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__144, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error)
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__146, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error)
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_nan); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_ones); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyInt_FromSsize_t(((__pyx_v_VPoly.shape[1]) - 1)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15);
    __pyx_t_15 = 0;
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    if (!__pyx_t_15) {
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_10);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_3};
        __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_t_3};
        __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_11 = PyNumber_Multiply(__pyx_t_12, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error)
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ones); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__148, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error)
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_ones); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_tuple__150, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1049, __pyx_L1_error)
    __pyx_t_27 = 0;
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_ind = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_11);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __pyx_v_NL = ((PyArrayObject *)__pyx_t_11);
    __pyx_t_11 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_22, &__pyx_t_21, &__pyx_t_20);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_22, __pyx_t_21, __pyx_t_20);
        }
        __pyx_t_22 = __pyx_t_21 = __pyx_t_20 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_Rref = ((PyArrayObject *)__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_23 = ((PyArrayObject *)__pyx_t_12);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
      __pyx_t_14 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_14 < 0)) {
        PyErr_Fetch(&__pyx_t_20, &__pyx_t_21, &__pyx_t_22);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_v_dRPhir, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_20, __pyx_t_21, __pyx_t_22);
        }
        __pyx_t_20 = __pyx_t_21 = __pyx_t_22 = 0;
      }
      __pyx_pybuffernd_dRPhir.diminfo[0].strides = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dRPhir.diminfo[0].shape = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 1049, __pyx_L1_error)
    }
    __pyx_t_23 = 0;
    __pyx_v_dRPhir = ((PyArrayObject *)__pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_v_nRPhi0 = __pyx_t_27;
  }
  __pyx_L7:;

  /* "tofu/geom/_GG03.pyx":1050
 *     else:
 *         Pts, dS, ind, NL, Rref, dRPhir, nRPhi0 = np.ones((3,0)), np.ones((0,)), np.ones((0,)), np.nan*np.ones((VPoly.shape[1]-1,)), np.ones((0,)), np.ones((0,)), 0
 *     return Pts, dS, ind.astype(int), NL, dLr, Rref, dRPhir, nRPhi0, VPbis             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ind), __pyx_n_s_astype); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_10);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_10, function);
    }
  }
  if (!__pyx_t_11) {
    __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_10, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1050, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, ((PyObject *)(&PyInt_Type))};
      __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1050, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, ((PyObject *)(&PyInt_Type))};
      __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1050, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_12);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_11); __pyx_t_11 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, ((PyObject *)(&PyInt_Type)));
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1050, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_nRPhi0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = PyTuple_New(9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1050, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_12);
  __Pyx_INCREF(((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_NL));
  PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_v_NL));
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_dLr));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
  PyTuple_SET_ITEM(__pyx_t_5, 5, ((PyObject *)__pyx_v_Rref));
  __Pyx_INCREF(((PyObject *)__pyx_v_dRPhir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dRPhir));
  PyTuple_SET_ITEM(__pyx_t_5, 6, ((PyObject *)__pyx_v_dRPhir));
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_t_10);
  __Pyx_INCREF(((PyObject *)__pyx_v_VPbis));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_VPbis));
  PyTuple_SET_ITEM(__pyx_t_5, 8, ((PyObject *)__pyx_v_VPbis));
  __pyx_t_12 = 0;
  __pyx_t_10 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":901
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_26, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indok.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Tor_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iii.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indI.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indok.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_dPhir, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Phin, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Indin, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_indI);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsCross);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPbis);
  __Pyx_XDECREF((PyObject *)__pyx_v_R0);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_dRPhir);
  __Pyx_XDECREF((PyObject *)__pyx_v_iii);
  __Pyx_XDECREF((PyObject *)__pyx_v_indL);
  __Pyx_XDECREF((PyObject *)__pyx_v_NL);
  __Pyx_XDECREF((PyObject *)__pyx_v_indok);
  __Pyx_XDECREF(__pyx_v_Inter);
  __Pyx_XDECREF(__pyx_v_Bounds);
  __Pyx_XDECREF(__pyx_v_Faces);
  __Pyx_XDECREF(__pyx_v_BC);
  __Pyx_XDECREF(__pyx_v_indin);
  __Pyx_XDECREF(__pyx_v_indBounds);
  __Pyx_XDECREF(__pyx_v_kkb);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __Pyx_XDECREF(__pyx_v_PhiMinMax);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1057
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, long[::1] ind,
 *                                      double DIn=0., VIn=None, PhiMinMax=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_35_Ves_Smesh_Tor_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_34_Ves_Smesh_Tor_SubFromInd_cython[] = " Return the desired submesh indicated by the (numerical) indices, for the desired resolution (dR,dZ,dRphi) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_35_Ves_Smesh_Tor_SubFromInd_cython = {"_Ves_Smesh_Tor_SubFromInd_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_35_Ves_Smesh_Tor_SubFromInd_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_34_Ves_Smesh_Tor_SubFromInd_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_35_Ves_Smesh_Tor_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_dL;
  double __pyx_v_dRPhi;
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_ind = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  PyObject *__pyx_v_PhiMinMax = 0;
  PyObject *__pyx_v_Out = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_Tor_SubFromInd_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dL,&__pyx_n_s_dRPhi,&__pyx_n_s_VPoly,&__pyx_n_s_ind,&__pyx_n_s_DIn,&__pyx_n_s_VIn,&__pyx_n_s_PhiMinMax,&__pyx_n_s_Out,&__pyx_n_s_margin,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":1059
 * def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi,
 *                                      double[:,::1] VPoly, long[::1] ind,
 *                                      double DIn=0., VIn=None, PhiMinMax=None,             # <<<<<<<<<<<<<<
 *                                      str Out='(X,Y,Z)', double margin=1.e-9):
 *     """ Return the desired submesh indicated by the (numerical) indices, for the desired resolution (dR,dZ,dRphi) """
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject*)__pyx_kp_s_X_Y_Z);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dRPhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromInd_cython", 0, 4, 9, 1); __PYX_ERR(0, 1057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromInd_cython", 0, 4, 9, 2); __PYX_ERR(0, 1057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromInd_cython", 0, 4, 9, 3); __PYX_ERR(0, 1057, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_PhiMinMax);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_Tor_SubFromInd_cython") < 0)) __PYX_ERR(0, 1057, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1057, __pyx_L3_error)
    __pyx_v_dRPhi = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dRPhi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1057, __pyx_L3_error)
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[2]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 1058, __pyx_L3_error)
    __pyx_v_ind = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[3]); if (unlikely(!__pyx_v_ind.memview)) __PYX_ERR(0, 1058, __pyx_L3_error)
    if (values[4]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1059, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[5];
    __pyx_v_PhiMinMax = values[6];
    __pyx_v_Out = ((PyObject*)values[7]);
    if (values[8]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1060, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Tor_SubFromInd_cython", 0, 4, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1057, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Tor_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Out), (&PyString_Type), 1, "Out", 1))) __PYX_ERR(0, 1060, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_34_Ves_Smesh_Tor_SubFromInd_cython(__pyx_self, __pyx_v_dL, __pyx_v_dRPhi, __pyx_v_VPoly, __pyx_v_ind, __pyx_v_DIn, __pyx_v_VIn, __pyx_v_PhiMinMax, __pyx_v_Out, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":1057
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, long[::1] ind,
 *                                      double DIn=0., VIn=None, PhiMinMax=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_34_Ves_Smesh_Tor_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, __Pyx_memviewslice __pyx_v_ind, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_PhiMinMax, PyObject *__pyx_v_Out, double __pyx_v_margin) {
  __Pyx_memviewslice __pyx_v_dRPhirRef = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_dPhir = { 0, 0, { 0 }, { 0 }, { 0 } };
  CYTHON_UNUSED __Pyx_memviewslice __pyx_v_indL = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi0 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_NRPhi = { 0, 0, { 0 }, { 0 }, { 0 } };
  long __pyx_v_NP;
  long __pyx_v_Rratio;
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_iiL;
  int __pyx_v_iiphi;
  int __pyx_v_Ln;
  CYTHON_UNUSED int __pyx_v_nn;
  CYTHON_UNUSED int __pyx_v_kk;
  int __pyx_v_nRPhi0;
  __Pyx_memviewslice __pyx_v_Phi = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_PtsCross = 0;
  PyArrayObject *__pyx_v_VPbis = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_dRPhir = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_NL = 0;
  PyObject *__pyx_v_DPhiMinMax = NULL;
  PyObject *__pyx_v_dLrRef = NULL;
  PyObject *__pyx_v_RrefRef = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_NL;
  __Pyx_Buffer __pyx_pybuffer_NL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsCross;
  __Pyx_Buffer __pyx_pybuffer_PtsCross;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPbis;
  __Pyx_Buffer __pyx_pybuffer_VPbis;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dRPhir;
  __Pyx_Buffer __pyx_pybuffer_dRPhir;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  double __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyArrayObject *__pyx_t_22 = NULL;
  __Pyx_memviewslice __pyx_t_23 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_24 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_25 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  __Pyx_memviewslice __pyx_t_34 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  long __pyx_t_39;
  int __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  long __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  __Pyx_RefNannySetupContext("_Ves_Smesh_Tor_SubFromInd_cython", 0);
  __Pyx_INCREF(__pyx_v_PhiMinMax);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_PtsCross.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsCross.refcount = 0;
  __pyx_pybuffernd_PtsCross.data = NULL;
  __pyx_pybuffernd_PtsCross.rcbuffer = &__pyx_pybuffer_PtsCross;
  __pyx_pybuffer_VPbis.pybuffer.buf = NULL;
  __pyx_pybuffer_VPbis.refcount = 0;
  __pyx_pybuffernd_VPbis.data = NULL;
  __pyx_pybuffernd_VPbis.rcbuffer = &__pyx_pybuffer_VPbis;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_dRPhir.pybuffer.buf = NULL;
  __pyx_pybuffer_dRPhir.refcount = 0;
  __pyx_pybuffernd_dRPhir.data = NULL;
  __pyx_pybuffernd_dRPhir.rcbuffer = &__pyx_pybuffer_dRPhir;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_NL.pybuffer.buf = NULL;
  __pyx_pybuffer_NL.refcount = 0;
  __pyx_pybuffernd_NL.data = NULL;
  __pyx_pybuffernd_NL.rcbuffer = &__pyx_pybuffer_NL;

  /* "tofu/geom/_GG03.pyx":1064
 *     cdef double[::1] dRPhirRef, dPhir
 *     cdef long[::1] indL, NRPhi0, NRPhi
 *     cdef long NR, NZ, Rn, Zn, NP=len(ind), Rratio             # <<<<<<<<<<<<<<
 *     cdef int ii=0, jj=0, iiL, iiphi, Ln, nn=0, kk=0, nRPhi0
 *     cdef double[:,::1] Phi
 */
  __pyx_t_1 = __Pyx_MemoryView_Len(__pyx_v_ind); 
  __pyx_v_NP = __pyx_t_1;

  /* "tofu/geom/_GG03.pyx":1065
 *     cdef long[::1] indL, NRPhi0, NRPhi
 *     cdef long NR, NZ, Rn, Zn, NP=len(ind), Rratio
 *     cdef int ii=0, jj=0, iiL, iiphi, Ln, nn=0, kk=0, nRPhi0             # <<<<<<<<<<<<<<
 *     cdef double[:,::1] Phi
 *     cdef cnp.ndarray[double,ndim=2] Pts=np.empty((3,NP)), indI, PtsCross, VPbis
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;
  __pyx_v_nn = 0;
  __pyx_v_kk = 0;

  /* "tofu/geom/_GG03.pyx":1067
 *     cdef int ii=0, jj=0, iiL, iiphi, Ln, nn=0, kk=0, nRPhi0
 *     cdef double[:,::1] Phi
 *     cdef cnp.ndarray[double,ndim=2] Pts=np.empty((3,NP)), indI, PtsCross, VPbis             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] R0, dS=np.empty((NP,)), dLr, dRPhir, Rref
 *     cdef cnp.ndarray[long,ndim=1] NL
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_NP); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1067, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1067, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1067, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1067, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_Pts = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1067, __pyx_L1_error)
    } else {__pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_Pts = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":1068
 *     cdef double[:,::1] Phi
 *     cdef cnp.ndarray[double,ndim=2] Pts=np.empty((3,NP)), indI, PtsCross, VPbis
 *     cdef cnp.ndarray[double,ndim=1] R0, dS=np.empty((NP,)), dLr, dRPhir, Rref             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[long,ndim=1] NL
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_NP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1068, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1068, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dS = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1068, __pyx_L1_error)
    } else {__pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_dS = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":1072
 * 
 *     # Pre-format input
 *     if PhiMinMax is None:             # <<<<<<<<<<<<<<
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi
 */
  __pyx_t_9 = (__pyx_v_PhiMinMax == Py_None);
  __pyx_t_10 = (__pyx_t_9 != 0);
  if (__pyx_t_10) {

    /* "tofu/geom/_GG03.pyx":1073
 *     # Pre-format input
 *     if PhiMinMax is None:
 *         PhiMinMax = [-Cpi,Cpi]             # <<<<<<<<<<<<<<
 *         DPhiMinMax = 2.*Cpi
 *     else:
 */
    __pyx_t_2 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_PhiMinMax, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1074
 *     if PhiMinMax is None:
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi             # <<<<<<<<<<<<<<
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 */
    __pyx_t_3 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_DPhiMinMax = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1072
 * 
 *     # Pre-format input
 *     if PhiMinMax is None:             # <<<<<<<<<<<<<<
 *         PhiMinMax = [-Cpi,Cpi]
 *         DPhiMinMax = 2.*Cpi
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":1076
 *         DPhiMinMax = 2.*Cpi
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]             # <<<<<<<<<<<<<<
 *         if PhiMinMax[1]>=PhiMinMax[0]:
 *             DPhiMinMax = PhiMinMax[1]-PhiMinMax[0]
 */
  /*else*/ {
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(atan2(sin(__pyx_t_11), cos(__pyx_t_12))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyFloat_FromDouble(atan2(sin(__pyx_t_12), cos(__pyx_t_11))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1076, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
    __pyx_t_3 = 0;
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_PhiMinMax, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1077
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 *         if PhiMinMax[1]>=PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *             DPhiMinMax = PhiMinMax[1]-PhiMinMax[0]
 *         else:
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_10) {

      /* "tofu/geom/_GG03.pyx":1078
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 *         if PhiMinMax[1]>=PhiMinMax[0]:
 *             DPhiMinMax = PhiMinMax[1]-PhiMinMax[0]             # <<<<<<<<<<<<<<
 *         else:
 *             DPhiMinMax = 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]
 */
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1078, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_DPhiMinMax = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1077
 *     else:
 *         PhiMinMax = [Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))]
 *         if PhiMinMax[1]>=PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *             DPhiMinMax = PhiMinMax[1]-PhiMinMax[0]
 *         else:
 */
      goto __pyx_L4;
    }

    /* "tofu/geom/_GG03.pyx":1080
 *             DPhiMinMax = PhiMinMax[1]-PhiMinMax[0]
 *         else:
 *             DPhiMinMax = 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __pyx_t_2 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1080, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_v_DPhiMinMax = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_L4:;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":1084
 * 
 *     # Get the actual R and Z resolutions and mesh elements
 *     PtsCross, dLrRef, indL, NL, RrefRef, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)             # <<<<<<<<<<<<<<
 *     Ln = dLrRef.size
 *     # Number of Phi per R
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_Smesh_Cross); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_6 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_D1, Py_None) < 0) __PYX_ERR(0, 1084, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_D2, Py_None) < 0) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_6) < 0) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DIn, __pyx_t_6) < 0) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_VIn, __pyx_v_VIn) < 0) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
    PyObject* sequence = __pyx_t_6;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1084, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_13 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_13 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_14 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_INCREF(__pyx_t_14);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_2,&__pyx_t_4,&__pyx_t_13,&__pyx_t_14};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1084, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_3,&__pyx_t_5,&__pyx_t_2,&__pyx_t_4,&__pyx_t_13,&__pyx_t_14};
    __pyx_t_15 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1084, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_16(__pyx_t_15); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 6) < 0) __PYX_ERR(0, 1084, __pyx_L1_error)
    __pyx_t_16 = NULL;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_16 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1084, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_2);
  if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1084, __pyx_L1_error)
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1084, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
      }
      __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1084, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_PtsCross = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_dLrRef = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_indL = __pyx_t_17;
  __pyx_t_17.memview = NULL;
  __pyx_t_17.data = NULL;
  __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
      }
      __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
    }
    __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1084, __pyx_L1_error)
  }
  __pyx_t_22 = 0;
  __pyx_v_NL = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_v_RrefRef = __pyx_t_13;
  __pyx_t_13 = 0;
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
      }
      __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1084, __pyx_L1_error)
  }
  __pyx_t_7 = 0;
  __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "tofu/geom/_GG03.pyx":1085
 *     # Get the actual R and Z resolutions and mesh elements
 *     PtsCross, dLrRef, indL, NL, RrefRef, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *     Ln = dLrRef.size             # <<<<<<<<<<<<<<
 *     # Number of Phi per R
 *     dRPhirRef, dPhir, dRPhir = np.empty((Ln,)), np.empty((Ln,)), -np.ones((Ln,))
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_dLrRef, __pyx_n_s_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_6); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1085, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_Ln = __pyx_t_18;

  /* "tofu/geom/_GG03.pyx":1087
 *     Ln = dLrRef.size
 *     # Number of Phi per R
 *     dRPhirRef, dPhir, dRPhir = np.empty((Ln,)), np.empty((Ln,)), -np.ones((Ln,))             # <<<<<<<<<<<<<<
 *     dLr, Rref = -np.ones((Ln,)), -np.ones((Ln,))
 *     NRPhi, NRPhi0 = np.empty((Ln,),dtype=int), np.empty((Ln,),dtype=int)
 */
  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_empty); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
    }
  }
  if (!__pyx_t_14) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); __pyx_t_14 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_23 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_6);
  if (unlikely(!__pyx_t_23.memview)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_13 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_13) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_13, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_24 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_6);
  if (unlikely(!__pyx_t_24.memview)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1087, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyNumber_Negative(__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1087, __pyx_L1_error)
  __pyx_v_dRPhirRef = __pyx_t_23;
  __pyx_t_23.memview = NULL;
  __pyx_t_23.data = NULL;
  __pyx_v_dPhir = __pyx_t_24;
  __pyx_t_24.memview = NULL;
  __pyx_t_24.data = NULL;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_v_dRPhir, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
      }
      __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
    }
    __pyx_pybuffernd_dRPhir.diminfo[0].strides = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dRPhir.diminfo[0].shape = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1087, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_dRPhir = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;

  /* "tofu/geom/_GG03.pyx":1088
 *     # Number of Phi per R
 *     dRPhirRef, dPhir, dRPhir = np.empty((Ln,)), np.empty((Ln,)), -np.ones((Ln,))
 *     dLr, Rref = -np.ones((Ln,)), -np.ones((Ln,))             # <<<<<<<<<<<<<<
 *     NRPhi, NRPhi0 = np.empty((Ln,),dtype=int), np.empty((Ln,),dtype=int)
 *     Rratio = int(Cceil(np.max(RrefRef)/np.min(RrefRef)))
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ones); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_14);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
      __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
      __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_2, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = PyNumber_Negative(__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1088, __pyx_L1_error)
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_14);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1088, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Negative(__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1088, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1088, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_13);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
      }
      __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1088, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_dLr = ((PyArrayObject *)__pyx_t_13);
  __pyx_t_13 = 0;
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
      }
      __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
    }
    __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1088, __pyx_L1_error)
  }
  __pyx_t_8 = 0;
  __pyx_v_Rref = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":1089
 *     dRPhirRef, dPhir, dRPhir = np.empty((Ln,)), np.empty((Ln,)), -np.ones((Ln,))
 *     dLr, Rref = -np.ones((Ln,)), -np.ones((Ln,))
 *     NRPhi, NRPhi0 = np.empty((Ln,),dtype=int), np.empty((Ln,),dtype=int)             # <<<<<<<<<<<<<<
 *     Rratio = int(Cceil(np.max(RrefRef)/np.min(RrefRef)))
 *     for ii in range(0,Ln):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1089, __pyx_L1_error)
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_5);
  if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1089, __pyx_L1_error)
  __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_25 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_13);
  if (unlikely(!__pyx_t_25.memview)) __PYX_ERR(0, 1089, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_v_NRPhi = __pyx_t_17;
  __pyx_t_17.memview = NULL;
  __pyx_t_17.data = NULL;
  __pyx_v_NRPhi0 = __pyx_t_25;
  __pyx_t_25.memview = NULL;
  __pyx_t_25.data = NULL;

  /* "tofu/geom/_GG03.pyx":1090
 *     dLr, Rref = -np.ones((Ln,)), -np.ones((Ln,))
 *     NRPhi, NRPhi0 = np.empty((Ln,),dtype=int), np.empty((Ln,),dtype=int)
 *     Rratio = int(Cceil(np.max(RrefRef)/np.min(RrefRef)))             # <<<<<<<<<<<<<<
 *     for ii in range(0,Ln):
 *         NRPhi[ii] = <long>(Cceil(DPhiMinMax*RrefRef[ii]/dRPhi))
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_RrefRef); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_RrefRef};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_RrefRef};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_RrefRef);
      __Pyx_GIVEREF(__pyx_v_RrefRef);
      PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_v_RrefRef);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_14, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_min); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_14) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_RrefRef); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_RrefRef};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_v_RrefRef};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_14); __pyx_t_14 = NULL;
      __Pyx_INCREF(__pyx_v_RrefRef);
      __Pyx_GIVEREF(__pyx_v_RrefRef);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_RrefRef);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1090, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_13, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_Rratio = ((long)ceil(__pyx_t_11));

  /* "tofu/geom/_GG03.pyx":1091
 *     NRPhi, NRPhi0 = np.empty((Ln,),dtype=int), np.empty((Ln,),dtype=int)
 *     Rratio = int(Cceil(np.max(RrefRef)/np.min(RrefRef)))
 *     for ii in range(0,Ln):             # <<<<<<<<<<<<<<
 *         NRPhi[ii] = <long>(Cceil(DPhiMinMax*RrefRef[ii]/dRPhi))
 *         dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/<double>(NRPhi[ii])
 */
  __pyx_t_18 = __pyx_v_Ln;
  for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_18; __pyx_t_26+=1) {
    __pyx_v_ii = __pyx_t_26;

    /* "tofu/geom/_GG03.pyx":1092
 *     Rratio = int(Cceil(np.max(RrefRef)/np.min(RrefRef)))
 *     for ii in range(0,Ln):
 *         NRPhi[ii] = <long>(Cceil(DPhiMinMax*RrefRef[ii]/dRPhi))             # <<<<<<<<<<<<<<
 *         dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = DPhiMinMax/<double>(NRPhi[ii])
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_RrefRef, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_DPhiMinMax, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dRPhi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1092, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_27 = __pyx_v_ii;
    *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_27)) )) = ((long)ceil(__pyx_t_11));

    /* "tofu/geom/_GG03.pyx":1093
 *     for ii in range(0,Ln):
 *         NRPhi[ii] = <long>(Cceil(DPhiMinMax*RrefRef[ii]/dRPhi))
 *         dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/<double>(NRPhi[ii])             # <<<<<<<<<<<<<<
 *         dPhir[ii] = DPhiMinMax/<double>(NRPhi[ii])
 *         if ii==0:
 */
    __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_RrefRef, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_4 = PyNumber_Multiply(__pyx_v_DPhiMinMax, __pyx_t_13); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_28 = __pyx_v_ii;
    __pyx_t_13 = PyFloat_FromDouble(((double)(*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_28)) ))))); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1093, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_29 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_29)) )) = __pyx_t_11;

    /* "tofu/geom/_GG03.pyx":1094
 *         NRPhi[ii] = <long>(Cceil(DPhiMinMax*RrefRef[ii]/dRPhi))
 *         dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = DPhiMinMax/<double>(NRPhi[ii])             # <<<<<<<<<<<<<<
 *         if ii==0:
 *             NRPhi0[ii] = 0
 */
    __pyx_t_30 = __pyx_v_ii;
    __pyx_t_5 = PyFloat_FromDouble(((double)(*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_30)) ))))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1094, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __Pyx_PyNumber_Divide(__pyx_v_DPhiMinMax, __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1094, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1094, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_31 = __pyx_v_ii;
    *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_31)) )) = __pyx_t_11;

    /* "tofu/geom/_GG03.pyx":1095
 *         dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = DPhiMinMax/<double>(NRPhi[ii])
 *         if ii==0:             # <<<<<<<<<<<<<<
 *             NRPhi0[ii] = 0
 *             Phi = np.empty((Ln,NRPhi[ii]*Rratio+1))
 */
    __pyx_t_10 = ((__pyx_v_ii == 0) != 0);
    if (__pyx_t_10) {

      /* "tofu/geom/_GG03.pyx":1096
 *         dPhir[ii] = DPhiMinMax/<double>(NRPhi[ii])
 *         if ii==0:
 *             NRPhi0[ii] = 0             # <<<<<<<<<<<<<<
 *             Phi = np.empty((Ln,NRPhi[ii]*Rratio+1))
 *         else:
 */
      __pyx_t_32 = __pyx_v_ii;
      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_32)) )) = 0;

      /* "tofu/geom/_GG03.pyx":1097
 *         if ii==0:
 *             NRPhi0[ii] = 0
 *             Phi = np.empty((Ln,NRPhi[ii]*Rratio+1))             # <<<<<<<<<<<<<<
 *         else:
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_33 = __pyx_v_ii;
      __pyx_t_6 = __Pyx_PyInt_From_long((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_33)) ))) * __pyx_v_Rratio) + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_6);
      __pyx_t_5 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1097, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_14};
          __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1097, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_14};
          __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1097, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1097, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_14);
          __pyx_t_14 = 0;
          __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1097, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_34 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_13);
      if (unlikely(!__pyx_t_34.memview)) __PYX_ERR(0, 1097, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __PYX_XDEC_MEMVIEW(&__pyx_v_Phi, 1);
      __pyx_v_Phi = __pyx_t_34;
      __pyx_t_34.memview = NULL;
      __pyx_t_34.data = NULL;

      /* "tofu/geom/_GG03.pyx":1095
 *         dRPhirRef[ii] = DPhiMinMax*RrefRef[ii]/<double>(NRPhi[ii])
 *         dPhir[ii] = DPhiMinMax/<double>(NRPhi[ii])
 *         if ii==0:             # <<<<<<<<<<<<<<
 *             NRPhi0[ii] = 0
 *             Phi = np.empty((Ln,NRPhi[ii]*Rratio+1))
 */
      goto __pyx_L9;
    }

    /* "tofu/geom/_GG03.pyx":1099
 *             Phi = np.empty((Ln,NRPhi[ii]*Rratio+1))
 *         else:
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]             # <<<<<<<<<<<<<<
 *         for jj in range(0,NRPhi[ii]):
 *             Phi[ii,jj] = PhiMinMax[0] + (0.5+<double>jj)*dPhir[ii]
 */
    /*else*/ {
      __pyx_t_35 = (__pyx_v_ii - 1);
      __pyx_t_36 = (__pyx_v_ii - 1);
      __pyx_t_37 = __pyx_v_ii;
      *((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_37)) )) = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_35)) ))) + (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_36)) ))));
    }
    __pyx_L9:;

    /* "tofu/geom/_GG03.pyx":1100
 *         else:
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]
 *         for jj in range(0,NRPhi[ii]):             # <<<<<<<<<<<<<<
 *             Phi[ii,jj] = PhiMinMax[0] + (0.5+<double>jj)*dPhir[ii]
 *     nRPhi0 = NRPhi0[Ln-1]+NRPhi[Ln-1]
 */
    __pyx_t_38 = __pyx_v_ii;
    __pyx_t_39 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_38)) )));
    for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) {
      __pyx_v_jj = __pyx_t_40;

      /* "tofu/geom/_GG03.pyx":1101
 *             NRPhi0[ii] = NRPhi0[ii-1] + NRPhi[ii-1]
 *         for jj in range(0,NRPhi[ii]):
 *             Phi[ii,jj] = PhiMinMax[0] + (0.5+<double>jj)*dPhir[ii]             # <<<<<<<<<<<<<<
 *     nRPhi0 = NRPhi0[Ln-1]+NRPhi[Ln-1]
 * 
 */
      __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_PhiMinMax, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_41 = __pyx_v_ii;
      __pyx_t_4 = PyFloat_FromDouble(((0.5 + ((double)__pyx_v_jj)) * (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dPhir.data) + __pyx_t_41)) ))))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Add(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1101, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 1101, __pyx_L1_error) }
      __pyx_t_42 = __pyx_v_ii;
      __pyx_t_43 = __pyx_v_jj;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_42 * __pyx_v_Phi.strides[0]) )) + __pyx_t_43)) )) = __pyx_t_11;
    }
  }

  /* "tofu/geom/_GG03.pyx":1102
 *         for jj in range(0,NRPhi[ii]):
 *             Phi[ii,jj] = PhiMinMax[0] + (0.5+<double>jj)*dPhir[ii]
 *     nRPhi0 = NRPhi0[Ln-1]+NRPhi[Ln-1]             # <<<<<<<<<<<<<<
 * 
 *     if Out.lower()=='(x,y,z)':
 */
  __pyx_t_44 = (__pyx_v_Ln - 1);
  __pyx_t_45 = (__pyx_v_Ln - 1);
  __pyx_v_nRPhi0 = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_44)) ))) + (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi.data) + __pyx_t_45)) ))));

  /* "tofu/geom/_GG03.pyx":1104
 *     nRPhi0 = NRPhi0[Ln-1]+NRPhi[Ln-1]
 * 
 *     if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_13 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_13) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_13); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1104, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else {
    __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1104, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_t_5, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 1104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_10) {

    /* "tofu/geom/_GG03.pyx":1105
 * 
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,NP):             # <<<<<<<<<<<<<<
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 */
    __pyx_t_39 = __pyx_v_NP;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_39; __pyx_t_18+=1) {
      __pyx_v_ii = __pyx_t_18;

      /* "tofu/geom/_GG03.pyx":1106
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):             # <<<<<<<<<<<<<<
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 */
      __pyx_t_46 = (__pyx_v_Ln + 1);
      for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_46; __pyx_t_26+=1) {
        __pyx_v_jj = __pyx_t_26;

        /* "tofu/geom/_GG03.pyx":1107
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiL = jj-1
 */
        __pyx_t_47 = __pyx_v_ii;
        __pyx_t_48 = __pyx_v_jj;
        __pyx_t_10 = ((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_47)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_48)) )))) < 0.) != 0);
        if (__pyx_t_10) {

          /* "tofu/geom/_GG03.pyx":1108
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break             # <<<<<<<<<<<<<<
 *             iiL = jj-1
 *             iiphi = ind[ii] - NRPhi0[iiL]
 */
          goto __pyx_L16_break;

          /* "tofu/geom/_GG03.pyx":1107
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiL = jj-1
 */
        }
      }
      __pyx_L16_break:;

      /* "tofu/geom/_GG03.pyx":1109
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 *             iiL = jj-1             # <<<<<<<<<<<<<<
 *             iiphi = ind[ii] - NRPhi0[iiL]
 *             Pts[0,ii] = PtsCross[0,iiL]*Ccos(Phi[iiL,iiphi])
 */
      __pyx_v_iiL = (__pyx_v_jj - 1);

      /* "tofu/geom/_GG03.pyx":1110
 *                     break
 *             iiL = jj-1
 *             iiphi = ind[ii] - NRPhi0[iiL]             # <<<<<<<<<<<<<<
 *             Pts[0,ii] = PtsCross[0,iiL]*Ccos(Phi[iiL,iiphi])
 *             Pts[1,ii] = PtsCross[0,iiL]*Csin(Phi[iiL,iiphi])
 */
      __pyx_t_49 = __pyx_v_ii;
      __pyx_t_50 = __pyx_v_iiL;
      __pyx_v_iiphi = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_49)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_50)) ))));

      /* "tofu/geom/_GG03.pyx":1111
 *             iiL = jj-1
 *             iiphi = ind[ii] - NRPhi0[iiL]
 *             Pts[0,ii] = PtsCross[0,iiL]*Ccos(Phi[iiL,iiphi])             # <<<<<<<<<<<<<<
 *             Pts[1,ii] = PtsCross[0,iiL]*Csin(Phi[iiL,iiphi])
 *             Pts[2,ii] = PtsCross[1,iiL]
 */
      __pyx_t_51 = 0;
      __pyx_t_52 = __pyx_v_iiL;
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 1111, __pyx_L1_error) }
      __pyx_t_53 = __pyx_v_iiL;
      __pyx_t_54 = __pyx_v_iiphi;
      __pyx_t_55 = 0;
      __pyx_t_56 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_PtsCross.diminfo[1].strides)) * cos((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_53 * __pyx_v_Phi.strides[0]) )) + __pyx_t_54)) )))));

      /* "tofu/geom/_GG03.pyx":1112
 *             iiphi = ind[ii] - NRPhi0[iiL]
 *             Pts[0,ii] = PtsCross[0,iiL]*Ccos(Phi[iiL,iiphi])
 *             Pts[1,ii] = PtsCross[0,iiL]*Csin(Phi[iiL,iiphi])             # <<<<<<<<<<<<<<
 *             Pts[2,ii] = PtsCross[1,iiL]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 */
      __pyx_t_57 = 0;
      __pyx_t_58 = __pyx_v_iiL;
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 1112, __pyx_L1_error) }
      __pyx_t_59 = __pyx_v_iiL;
      __pyx_t_60 = __pyx_v_iiphi;
      __pyx_t_61 = 1;
      __pyx_t_62 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_Pts.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_58, __pyx_pybuffernd_PtsCross.diminfo[1].strides)) * sin((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_59 * __pyx_v_Phi.strides[0]) )) + __pyx_t_60)) )))));

      /* "tofu/geom/_GG03.pyx":1113
 *             Pts[0,ii] = PtsCross[0,iiL]*Ccos(Phi[iiL,iiphi])
 *             Pts[1,ii] = PtsCross[0,iiL]*Csin(Phi[iiL,iiphi])
 *             Pts[2,ii] = PtsCross[1,iiL]             # <<<<<<<<<<<<<<
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:
 */
      __pyx_t_63 = 1;
      __pyx_t_64 = __pyx_v_iiL;
      __pyx_t_65 = 2;
      __pyx_t_66 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_PtsCross.diminfo[1].strides));

      /* "tofu/geom/_GG03.pyx":1114
 *             Pts[1,ii] = PtsCross[0,iiL]*Csin(Phi[iiL,iiphi])
 *             Pts[2,ii] = PtsCross[1,iiL]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]             # <<<<<<<<<<<<<<
 *             if dRPhir[iiL]==-1.:
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 */
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_dLrRef, __pyx_v_iiL, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_67 = __pyx_v_iiL;
      __pyx_t_4 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_67)) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = PyNumber_Multiply(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_68 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_dS.diminfo[0].strides) = __pyx_t_11;

      /* "tofu/geom/_GG03.pyx":1115
 *             Pts[2,ii] = PtsCross[1,iiL]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]
 */
      __pyx_t_69 = __pyx_v_iiL;
      __pyx_t_10 = (((*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_dRPhir.diminfo[0].strides)) == -1.) != 0);
      if (__pyx_t_10) {

        /* "tofu/geom/_GG03.pyx":1116
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:
 *                 dRPhir[iiL] = dRPhirRef[iiL]             # <<<<<<<<<<<<<<
 *                 dLr[iiL] = dLrRef[iiL]
 *                 Rref[iiL] = RrefRef[iiL]
 */
        __pyx_t_70 = __pyx_v_iiL;
        __pyx_t_71 = __pyx_v_iiL;
        *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_dRPhir.diminfo[0].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_70)) )));

        /* "tofu/geom/_GG03.pyx":1117
 *             if dRPhir[iiL]==-1.:
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]             # <<<<<<<<<<<<<<
 *                 Rref[iiL] = RrefRef[iiL]
 * 
 */
        __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_dLrRef, __pyx_v_iiL, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1117, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1117, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_72 = __pyx_v_iiL;
        *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_72, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_t_11;

        /* "tofu/geom/_GG03.pyx":1118
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]
 *                 Rref[iiL] = RrefRef[iiL]             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
        __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_RrefRef, __pyx_v_iiL, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_13); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1118, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_73 = __pyx_v_iiL;
        *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_Rref.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_Rref.diminfo[0].strides) = __pyx_t_11;

        /* "tofu/geom/_GG03.pyx":1115
 *             Pts[2,ii] = PtsCross[1,iiL]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]
 */
      }
    }

    /* "tofu/geom/_GG03.pyx":1104
 *     nRPhi0 = NRPhi0[Ln-1]+NRPhi[Ln-1]
 * 
 *     if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):
 */
    goto __pyx_L12;
  }

  /* "tofu/geom/_GG03.pyx":1121
 * 
 *     else:
 *         for ii in range(0,NP):             # <<<<<<<<<<<<<<
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 */
  /*else*/ {
    __pyx_t_39 = __pyx_v_NP;
    for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_39; __pyx_t_18+=1) {
      __pyx_v_ii = __pyx_t_18;

      /* "tofu/geom/_GG03.pyx":1122
 *     else:
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):             # <<<<<<<<<<<<<<
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 */
      __pyx_t_46 = (__pyx_v_Ln + 1);
      for (__pyx_t_26 = 0; __pyx_t_26 < __pyx_t_46; __pyx_t_26+=1) {
        __pyx_v_jj = __pyx_t_26;

        /* "tofu/geom/_GG03.pyx":1123
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiL = jj-1
 */
        __pyx_t_74 = __pyx_v_ii;
        __pyx_t_75 = __pyx_v_jj;
        __pyx_t_10 = ((((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_74)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_75)) )))) < 0.) != 0);
        if (__pyx_t_10) {

          /* "tofu/geom/_GG03.pyx":1124
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break             # <<<<<<<<<<<<<<
 *             iiL = jj-1
 *             iiphi = ind[ii] - NRPhi0[iiL]
 */
          goto __pyx_L22_break;

          /* "tofu/geom/_GG03.pyx":1123
 *         for ii in range(0,NP):
 *             for jj in range(0,Ln+1):
 *                 if ind[ii]-NRPhi0[jj]<0.:             # <<<<<<<<<<<<<<
 *                     break
 *             iiL = jj-1
 */
        }
      }
      __pyx_L22_break:;

      /* "tofu/geom/_GG03.pyx":1125
 *                 if ind[ii]-NRPhi0[jj]<0.:
 *                     break
 *             iiL = jj-1             # <<<<<<<<<<<<<<
 *             iiphi = ind[ii] - NRPhi0[iiL]
 *             Pts[0,ii] = PtsCross[0,iiL]
 */
      __pyx_v_iiL = (__pyx_v_jj - 1);

      /* "tofu/geom/_GG03.pyx":1126
 *                     break
 *             iiL = jj-1
 *             iiphi = ind[ii] - NRPhi0[iiL]             # <<<<<<<<<<<<<<
 *             Pts[0,ii] = PtsCross[0,iiL]
 *             Pts[1,ii] = PtsCross[1,iiL]
 */
      __pyx_t_76 = __pyx_v_ii;
      __pyx_t_77 = __pyx_v_iiL;
      __pyx_v_iiphi = ((*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_ind.data) + __pyx_t_76)) ))) - (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_NRPhi0.data) + __pyx_t_77)) ))));

      /* "tofu/geom/_GG03.pyx":1127
 *             iiL = jj-1
 *             iiphi = ind[ii] - NRPhi0[iiL]
 *             Pts[0,ii] = PtsCross[0,iiL]             # <<<<<<<<<<<<<<
 *             Pts[1,ii] = PtsCross[1,iiL]
 *             Pts[2,ii] = Phi[iiL,iiphi]
 */
      __pyx_t_78 = 0;
      __pyx_t_79 = __pyx_v_iiL;
      __pyx_t_80 = 0;
      __pyx_t_81 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_81, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_PtsCross.diminfo[1].strides));

      /* "tofu/geom/_GG03.pyx":1128
 *             iiphi = ind[ii] - NRPhi0[iiL]
 *             Pts[0,ii] = PtsCross[0,iiL]
 *             Pts[1,ii] = PtsCross[1,iiL]             # <<<<<<<<<<<<<<
 *             Pts[2,ii] = Phi[iiL,iiphi]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 */
      __pyx_t_82 = 1;
      __pyx_t_83 = __pyx_v_iiL;
      __pyx_t_84 = 1;
      __pyx_t_85 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_85, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_PtsCross.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_PtsCross.diminfo[1].strides));

      /* "tofu/geom/_GG03.pyx":1129
 *             Pts[0,ii] = PtsCross[0,iiL]
 *             Pts[1,ii] = PtsCross[1,iiL]
 *             Pts[2,ii] = Phi[iiL,iiphi]             # <<<<<<<<<<<<<<
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:
 */
      if (unlikely(!__pyx_v_Phi.memview)) { __Pyx_RaiseUnboundLocalError("Phi"); __PYX_ERR(0, 1129, __pyx_L1_error) }
      __pyx_t_86 = __pyx_v_iiL;
      __pyx_t_87 = __pyx_v_iiphi;
      __pyx_t_88 = 2;
      __pyx_t_89 = __pyx_v_ii;
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_Pts.rcbuffer->pybuffer.buf, __pyx_t_88, __pyx_pybuffernd_Pts.diminfo[0].strides, __pyx_t_89, __pyx_pybuffernd_Pts.diminfo[1].strides) = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Phi.data + __pyx_t_86 * __pyx_v_Phi.strides[0]) )) + __pyx_t_87)) )));

      /* "tofu/geom/_GG03.pyx":1130
 *             Pts[1,ii] = PtsCross[1,iiL]
 *             Pts[2,ii] = Phi[iiL,iiphi]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]             # <<<<<<<<<<<<<<
 *             if dRPhir[iiL]==-1.:
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 */
      __pyx_t_13 = __Pyx_GetItemInt(__pyx_v_dLrRef, __pyx_v_iiL, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_90 = __pyx_v_iiL;
      __pyx_t_4 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_90)) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyNumber_Multiply(__pyx_t_13, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1130, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_91 = __pyx_v_ii;
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dS.rcbuffer->pybuffer.buf, __pyx_t_91, __pyx_pybuffernd_dS.diminfo[0].strides) = __pyx_t_11;

      /* "tofu/geom/_GG03.pyx":1131
 *             Pts[2,ii] = Phi[iiL,iiphi]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]
 */
      __pyx_t_92 = __pyx_v_iiL;
      __pyx_t_10 = (((*__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_92, __pyx_pybuffernd_dRPhir.diminfo[0].strides)) == -1.) != 0);
      if (__pyx_t_10) {

        /* "tofu/geom/_GG03.pyx":1132
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:
 *                 dRPhir[iiL] = dRPhirRef[iiL]             # <<<<<<<<<<<<<<
 *                 dLr[iiL] = dLrRef[iiL]
 *                 Rref[iiL] = RrefRef[iiL]
 */
        __pyx_t_93 = __pyx_v_iiL;
        __pyx_t_94 = __pyx_v_iiL;
        *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.buf, __pyx_t_94, __pyx_pybuffernd_dRPhir.diminfo[0].strides) = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_dRPhirRef.data) + __pyx_t_93)) )));

        /* "tofu/geom/_GG03.pyx":1133
 *             if dRPhir[iiL]==-1.:
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]             # <<<<<<<<<<<<<<
 *                 Rref[iiL] = RrefRef[iiL]
 *     return Pts, dS, NL, dLr[dLr>-0.5], Rref[Rref>-0.5], dRPhir[dRPhir>-0.5], <long>nRPhi0, VPbis
 */
        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_dLrRef, __pyx_v_iiL, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1133, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1133, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_95 = __pyx_v_iiL;
        *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_t_11;

        /* "tofu/geom/_GG03.pyx":1134
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]
 *                 Rref[iiL] = RrefRef[iiL]             # <<<<<<<<<<<<<<
 *     return Pts, dS, NL, dLr[dLr>-0.5], Rref[Rref>-0.5], dRPhir[dRPhir>-0.5], <long>nRPhi0, VPbis
 * 
 */
        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_RrefRef, __pyx_v_iiL, int, 1, __Pyx_PyInt_From_int, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1134, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_96 = __pyx_v_iiL;
        *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_Rref.rcbuffer->pybuffer.buf, __pyx_t_96, __pyx_pybuffernd_Rref.diminfo[0].strides) = __pyx_t_11;

        /* "tofu/geom/_GG03.pyx":1131
 *             Pts[2,ii] = Phi[iiL,iiphi]
 *             dS[ii] = dLrRef[iiL]*dRPhirRef[iiL]
 *             if dRPhir[iiL]==-1.:             # <<<<<<<<<<<<<<
 *                 dRPhir[iiL] = dRPhirRef[iiL]
 *                 dLr[iiL] = dLrRef[iiL]
 */
      }
    }
  }
  __pyx_L12:;

  /* "tofu/geom/_GG03.pyx":1135
 *                 dLr[iiL] = dLrRef[iiL]
 *                 Rref[iiL] = RrefRef[iiL]
 *     return Pts, dS, NL, dLr[dLr>-0.5], Rref[Rref>-0.5], dRPhir[dRPhir>-0.5], <long>nRPhi0, VPbis             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyObject_RichCompare(((PyObject *)__pyx_v_dLr), __pyx_float_neg_0_5, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(((PyObject *)__pyx_v_Rref), __pyx_float_neg_0_5, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_Rref), __pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_RichCompare(((PyObject *)__pyx_v_dRPhir), __pyx_float_neg_0_5, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_dRPhir), __pyx_t_5); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_long(((long)__pyx_v_nRPhi0)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_NL));
  PyTuple_SET_ITEM(__pyx_t_6, 2, ((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_VPbis));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_VPbis));
  PyTuple_SET_ITEM(__pyx_t_6, 7, ((PyObject *)__pyx_v_VPbis));
  __pyx_t_4 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_t_5 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1057
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, long[::1] ind,
 *                                      double DIn=0., VIn=None, PhiMinMax=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_23, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_24, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_25, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_34, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Tor_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_dRPhirRef, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_dPhir, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indL, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi0, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_NRPhi, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Phi, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsCross);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPbis);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_dRPhir);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_NL);
  __Pyx_XDECREF(__pyx_v_DPhiMinMax);
  __Pyx_XDECREF(__pyx_v_dLrRef);
  __Pyx_XDECREF(__pyx_v_RrefRef);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_ind, 1);
  __Pyx_XDECREF(__pyx_v_PhiMinMax);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1149
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_37_Ves_Smesh_TorStruct_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_36_Ves_Smesh_TorStruct_SubFromD_cython[] = " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_37_Ves_Smesh_TorStruct_SubFromD_cython = {"_Ves_Smesh_TorStruct_SubFromD_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_37_Ves_Smesh_TorStruct_SubFromD_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_36_Ves_Smesh_TorStruct_SubFromD_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_37_Ves_Smesh_TorStruct_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_PhiMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dL;
  double __pyx_v_dRPhi;
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_DR = 0;
  PyObject *__pyx_v_DZ = 0;
  PyObject *__pyx_v_DPhi = 0;
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  PyObject *__pyx_v_Out = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_TorStruct_SubFromD_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_PhiMinMax,&__pyx_n_s_dL,&__pyx_n_s_dRPhi,&__pyx_n_s_VPoly,&__pyx_n_s_DR,&__pyx_n_s_DZ,&__pyx_n_s_DPhi,&__pyx_n_s_DIn,&__pyx_n_s_VIn,&__pyx_n_s_Out,&__pyx_n_s_margin,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":1151
 * def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, double dRPhi,
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,             # <<<<<<<<<<<<<<
 *                                          double DIn=0., VIn=None,
 *                                          str Out='(X,Y,Z)', double margin=1.e-9):
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "tofu/geom/_GG03.pyx":1152
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,
 *                                          double DIn=0., VIn=None,             # <<<<<<<<<<<<<<
 *                                          str Out='(X,Y,Z)', double margin=1.e-9):
 *     " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) "
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject*)__pyx_kp_s_X_Y_Z);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_PhiMinMax)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromD_cython", 0, 4, 11, 1); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dRPhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromD_cython", 0, 4, 11, 2); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromD_cython", 0, 4, 11, 3); __PYX_ERR(0, 1149, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DR);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DZ);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DPhi);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_TorStruct_SubFromD_cython") < 0)) __PYX_ERR(0, 1149, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_PhiMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_PhiMinMax.memview)) __PYX_ERR(0, 1149, __pyx_L3_error)
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1149, __pyx_L3_error)
    __pyx_v_dRPhi = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dRPhi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1149, __pyx_L3_error)
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 1150, __pyx_L3_error)
    __pyx_v_DR = values[4];
    __pyx_v_DZ = values[5];
    __pyx_v_DPhi = values[6];
    if (values[7]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1152, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[8];
    __pyx_v_Out = ((PyObject*)values[9]);
    if (values[10]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1153, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromD_cython", 0, 4, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1149, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_TorStruct_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Out), (&PyString_Type), 1, "Out", 1))) __PYX_ERR(0, 1153, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_36_Ves_Smesh_TorStruct_SubFromD_cython(__pyx_self, __pyx_v_PhiMinMax, __pyx_v_dL, __pyx_v_dRPhi, __pyx_v_VPoly, __pyx_v_DR, __pyx_v_DZ, __pyx_v_DPhi, __pyx_v_DIn, __pyx_v_VIn, __pyx_v_Out, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":1149
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_36_Ves_Smesh_TorStruct_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_PhiMinMax, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, PyObject *__pyx_v_DR, PyObject *__pyx_v_DZ, PyObject *__pyx_v_DPhi, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_Out, double __pyx_v_margin) {
  double __pyx_v_Dphi;
  double __pyx_v_dR0r;
  double __pyx_v_dZ0r;
  int __pyx_v_NR0;
  int __pyx_v_NZ0;
  int __pyx_v_R0n;
  int __pyx_v_Z0n;
  __Pyx_memviewslice __pyx_v_phiMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_R0 = 0;
  PyArrayObject *__pyx_v_Z0 = 0;
  PyArrayObject *__pyx_v_dsF = 0;
  PyArrayObject *__pyx_v_dSM = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_dRPhir = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyArrayObject *__pyx_v_indR0 = 0;
  PyArrayObject *__pyx_v_indZ0 = 0;
  PyArrayObject *__pyx_v_iind = 0;
  PyArrayObject *__pyx_v_iindF = 0;
  PyArrayObject *__pyx_v_indM = 0;
  PyArrayObject *__pyx_v_NL = 0;
  PyArrayObject *__pyx_v_ind = 0;
  PyArrayObject *__pyx_v_ptsrz = 0;
  PyArrayObject *__pyx_v_pts = 0;
  PyArrayObject *__pyx_v_PtsM = 0;
  PyArrayObject *__pyx_v_VPbis = 0;
  PyArrayObject *__pyx_v_Pts = 0;
  PyObject *__pyx_v_LPts = 0;
  PyObject *__pyx_v_LdS = 0;
  PyObject *__pyx_v_Lind = 0;
  CYTHON_UNUSED PyObject *__pyx_v_DPhiMinMax = NULL;
  int __pyx_v_Full;
  PyObject *__pyx_v_DPhi0 = NULL;
  PyObject *__pyx_v_DPhi1 = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_DDPhi = NULL;
  PyObject *__pyx_v_Inter = NULL;
  PyObject *__pyx_v_Bounds = NULL;
  PyObject *__pyx_v_Faces = NULL;
  PyObject *__pyx_v_BC = NULL;
  Py_ssize_t __pyx_v_nBounds;
  Py_ssize_t __pyx_v_ii;
  PyObject *__pyx_v_indin = NULL;
  PyObject *__pyx_v_nRPhi0 = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_NL;
  __Pyx_Buffer __pyx_pybuffer_NL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsM;
  __Pyx_Buffer __pyx_pybuffer_PtsM;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_R0;
  __Pyx_Buffer __pyx_pybuffer_R0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPbis;
  __Pyx_Buffer __pyx_pybuffer_VPbis;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Z0;
  __Pyx_Buffer __pyx_pybuffer_Z0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dRPhir;
  __Pyx_Buffer __pyx_pybuffer_dRPhir;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dSM;
  __Pyx_Buffer __pyx_pybuffer_dSM;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dsF;
  __Pyx_Buffer __pyx_pybuffer_dsF;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_iind;
  __Pyx_Buffer __pyx_pybuffer_iind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_iindF;
  __Pyx_Buffer __pyx_pybuffer_iindF;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indM;
  __Pyx_Buffer __pyx_pybuffer_indM;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indR0;
  __Pyx_Buffer __pyx_pybuffer_indR0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indZ0;
  __Pyx_Buffer __pyx_pybuffer_indZ0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pts;
  __Pyx_Buffer __pyx_pybuffer_pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ptsrz;
  __Pyx_Buffer __pyx_pybuffer_ptsrz;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  double __pyx_t_26;
  double __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  PyObject *__pyx_t_31 = NULL;
  int __pyx_t_32;
  PyObject *__pyx_t_33 = NULL;
  PyObject *(*__pyx_t_34)(PyObject *);
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  PyObject *__pyx_t_40 = NULL;
  PyObject *__pyx_t_41 = NULL;
  PyArrayObject *__pyx_t_42 = NULL;
  int __pyx_t_43;
  PyObject *__pyx_t_44 = NULL;
  PyObject *__pyx_t_45 = NULL;
  PyObject *__pyx_t_46 = NULL;
  PyArrayObject *__pyx_t_47 = NULL;
  PyArrayObject *__pyx_t_48 = NULL;
  __Pyx_memviewslice __pyx_t_49 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  PyObject *__pyx_t_53 = NULL;
  int __pyx_t_54;
  PyObject *__pyx_t_55 = NULL;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  __Pyx_RefNannySetupContext("_Ves_Smesh_TorStruct_SubFromD_cython", 0);
  __pyx_pybuffer_R0.pybuffer.buf = NULL;
  __pyx_pybuffer_R0.refcount = 0;
  __pyx_pybuffernd_R0.data = NULL;
  __pyx_pybuffernd_R0.rcbuffer = &__pyx_pybuffer_R0;
  __pyx_pybuffer_Z0.pybuffer.buf = NULL;
  __pyx_pybuffer_Z0.refcount = 0;
  __pyx_pybuffernd_Z0.data = NULL;
  __pyx_pybuffernd_Z0.rcbuffer = &__pyx_pybuffer_Z0;
  __pyx_pybuffer_dsF.pybuffer.buf = NULL;
  __pyx_pybuffer_dsF.refcount = 0;
  __pyx_pybuffernd_dsF.data = NULL;
  __pyx_pybuffernd_dsF.rcbuffer = &__pyx_pybuffer_dsF;
  __pyx_pybuffer_dSM.pybuffer.buf = NULL;
  __pyx_pybuffer_dSM.refcount = 0;
  __pyx_pybuffernd_dSM.data = NULL;
  __pyx_pybuffernd_dSM.rcbuffer = &__pyx_pybuffer_dSM;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_dRPhir.pybuffer.buf = NULL;
  __pyx_pybuffer_dRPhir.refcount = 0;
  __pyx_pybuffernd_dRPhir.data = NULL;
  __pyx_pybuffernd_dRPhir.rcbuffer = &__pyx_pybuffer_dRPhir;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_indR0.pybuffer.buf = NULL;
  __pyx_pybuffer_indR0.refcount = 0;
  __pyx_pybuffernd_indR0.data = NULL;
  __pyx_pybuffernd_indR0.rcbuffer = &__pyx_pybuffer_indR0;
  __pyx_pybuffer_indZ0.pybuffer.buf = NULL;
  __pyx_pybuffer_indZ0.refcount = 0;
  __pyx_pybuffernd_indZ0.data = NULL;
  __pyx_pybuffernd_indZ0.rcbuffer = &__pyx_pybuffer_indZ0;
  __pyx_pybuffer_iind.pybuffer.buf = NULL;
  __pyx_pybuffer_iind.refcount = 0;
  __pyx_pybuffernd_iind.data = NULL;
  __pyx_pybuffernd_iind.rcbuffer = &__pyx_pybuffer_iind;
  __pyx_pybuffer_iindF.pybuffer.buf = NULL;
  __pyx_pybuffer_iindF.refcount = 0;
  __pyx_pybuffernd_iindF.data = NULL;
  __pyx_pybuffernd_iindF.rcbuffer = &__pyx_pybuffer_iindF;
  __pyx_pybuffer_indM.pybuffer.buf = NULL;
  __pyx_pybuffer_indM.refcount = 0;
  __pyx_pybuffernd_indM.data = NULL;
  __pyx_pybuffernd_indM.rcbuffer = &__pyx_pybuffer_indM;
  __pyx_pybuffer_NL.pybuffer.buf = NULL;
  __pyx_pybuffer_NL.refcount = 0;
  __pyx_pybuffernd_NL.data = NULL;
  __pyx_pybuffernd_NL.rcbuffer = &__pyx_pybuffer_NL;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
  __pyx_pybuffer_ptsrz.pybuffer.buf = NULL;
  __pyx_pybuffer_ptsrz.refcount = 0;
  __pyx_pybuffernd_ptsrz.data = NULL;
  __pyx_pybuffernd_ptsrz.rcbuffer = &__pyx_pybuffer_ptsrz;
  __pyx_pybuffer_pts.pybuffer.buf = NULL;
  __pyx_pybuffer_pts.refcount = 0;
  __pyx_pybuffernd_pts.data = NULL;
  __pyx_pybuffernd_pts.rcbuffer = &__pyx_pybuffer_pts;
  __pyx_pybuffer_PtsM.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsM.refcount = 0;
  __pyx_pybuffernd_PtsM.data = NULL;
  __pyx_pybuffernd_PtsM.rcbuffer = &__pyx_pybuffer_PtsM;
  __pyx_pybuffer_VPbis.pybuffer.buf = NULL;
  __pyx_pybuffer_VPbis.refcount = 0;
  __pyx_pybuffernd_VPbis.data = NULL;
  __pyx_pybuffernd_VPbis.rcbuffer = &__pyx_pybuffer_VPbis;
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;

  /* "tofu/geom/_GG03.pyx":1155
 *                                          str Out='(X,Y,Z)', double margin=1.e-9):
 *     " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) "
 *     cdef double Dphi, dR0r=0., dZ0r=0.             # <<<<<<<<<<<<<<
 *     cdef int NR0=0, NZ0=0, R0n, Z0n, NRPhi0
 *     cdef double[::1] phiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])
 */
  __pyx_v_dR0r = 0.;
  __pyx_v_dZ0r = 0.;

  /* "tofu/geom/_GG03.pyx":1156
 *     " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) "
 *     cdef double Dphi, dR0r=0., dZ0r=0.
 *     cdef int NR0=0, NZ0=0, R0n, Z0n, NRPhi0             # <<<<<<<<<<<<<<
 *     cdef double[::1] phiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])
 *     cdef cnp.ndarray[double, ndim=1] R0, Z0, dsF, dSM, dLr, Rref, dRPhir, dS
 */
  __pyx_v_NR0 = 0;
  __pyx_v_NZ0 = 0;

  /* "tofu/geom/_GG03.pyx":1157
 *     cdef double Dphi, dR0r=0., dZ0r=0.
 *     cdef int NR0=0, NZ0=0, R0n, Z0n, NRPhi0
 *     cdef double[::1] phiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double, ndim=1] R0, Z0, dsF, dSM, dLr, Rref, dRPhir, dS
 *     cdef cnp.ndarray[long,ndim=1] indR0, indZ0, iind, iindF, indM, NL, ind
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_2 = PyFloat_FromDouble(atan2(sin((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_4)) )))), cos((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_5)) )))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = 1;
  __pyx_t_7 = 1;
  __pyx_t_8 = PyFloat_FromDouble(atan2(sin((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_6)) )))), cos((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_7)) )))))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1157, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1157, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_phiMinMax = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "tofu/geom/_GG03.pyx":1161
 *     cdef cnp.ndarray[long,ndim=1] indR0, indZ0, iind, iindF, indM, NL, ind
 *     cdef cnp.ndarray[double,ndim=2] ptsrz, pts, PtsM, VPbis, Pts
 *     cdef list LPts=[], LdS=[], Lind=[]             # <<<<<<<<<<<<<<
 * 
 *     # Pre-format input
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LPts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LdS = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Lind = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1164
 * 
 *     # Pre-format input
 *     if PhiMinMax is None:             # <<<<<<<<<<<<<<
 *         PhiMinMax = np.array([-Cpi,Cpi])
 *         DPhiMinMax = 2.*Cpi
 */
  __pyx_t_11 = ((((PyObject *) __pyx_v_PhiMinMax.memview) == Py_None) != 0);
  if (__pyx_t_11) {

    /* "tofu/geom/_GG03.pyx":1165
 *     # Pre-format input
 *     if PhiMinMax is None:
 *         PhiMinMax = np.array([-Cpi,Cpi])             # <<<<<<<<<<<<<<
 *         DPhiMinMax = 2.*Cpi
 *         Full = True
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble((-M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyFloat_FromDouble(M_PI); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_9);
    __pyx_t_3 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1165, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
    if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1165, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_PhiMinMax, 1);
    __pyx_v_PhiMinMax = __pyx_t_10;
    __pyx_t_10.memview = NULL;
    __pyx_t_10.data = NULL;

    /* "tofu/geom/_GG03.pyx":1166
 *     if PhiMinMax is None:
 *         PhiMinMax = np.array([-Cpi,Cpi])
 *         DPhiMinMax = 2.*Cpi             # <<<<<<<<<<<<<<
 *         Full = True
 *     else:
 */
    __pyx_t_1 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1166, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_DPhiMinMax = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":1167
 *         PhiMinMax = np.array([-Cpi,Cpi])
 *         DPhiMinMax = 2.*Cpi
 *         Full = True             # <<<<<<<<<<<<<<
 *     else:
 *         PhiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])
 */
    __pyx_v_Full = 1;

    /* "tofu/geom/_GG03.pyx":1164
 * 
 *     # Pre-format input
 *     if PhiMinMax is None:             # <<<<<<<<<<<<<<
 *         PhiMinMax = np.array([-Cpi,Cpi])
 *         DPhiMinMax = 2.*Cpi
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":1169
 *         Full = True
 *     else:
 *         PhiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])             # <<<<<<<<<<<<<<
 *         DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]
 *         Full = False
 */
  /*else*/ {
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = 0;
    __pyx_t_13 = 0;
    __pyx_t_2 = PyFloat_FromDouble(atan2(sin((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_12)) )))), cos((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_13)) )))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_14 = 1;
    __pyx_t_15 = 1;
    __pyx_t_8 = PyFloat_FromDouble(atan2(sin((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_14)) )))), cos((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_15)) )))))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_2);
    PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_8);
    PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
    __pyx_t_2 = 0;
    __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1169, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1169, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1169, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1169, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
    if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1169, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_XDEC_MEMVIEW(&__pyx_v_PhiMinMax, 1);
    __pyx_v_PhiMinMax = __pyx_t_10;
    __pyx_t_10.memview = NULL;
    __pyx_t_10.data = NULL;

    /* "tofu/geom/_GG03.pyx":1170
 *     else:
 *         PhiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])
 *         DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]             # <<<<<<<<<<<<<<
 *         Full = False
 * 
 */
    __pyx_t_16 = 1;
    __pyx_t_17 = 0;
    if ((((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_16)) ))) >= (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_17)) )))) != 0)) {
      __pyx_t_18 = 1;
      __pyx_t_19 = 0;
      __pyx_t_3 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_18)) ))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_19)) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
      __pyx_t_3 = 0;
    } else {
      __pyx_t_20 = 1;
      __pyx_t_21 = 0;
      __pyx_t_3 = PyFloat_FromDouble((((2. * M_PI) + (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_20)) )))) - (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_21)) ))))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1170, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __pyx_v_DPhiMinMax = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":1171
 *         PhiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])
 *         DPhiMinMax = PhiMinMax[1]-PhiMinMax[0] if PhiMinMax[1]>=PhiMinMax[0] else 2.*Cpi + PhiMinMax[1] - PhiMinMax[0]
 *         Full = False             # <<<<<<<<<<<<<<
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 */
    __pyx_v_Full = 0;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":1174
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:             # <<<<<<<<<<<<<<
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]
 *     else:
 */
  __pyx_t_11 = (__pyx_v_DPhi == Py_None);
  __pyx_t_22 = (__pyx_t_11 != 0);
  if (__pyx_t_22) {

    /* "tofu/geom/_GG03.pyx":1175
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]             # <<<<<<<<<<<<<<
 *     else:
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))
 */
    __pyx_t_23 = 0;
    __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_23)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_24 = 1;
    __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_24)) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1175, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_DPhi0 = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_DPhi1 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1174
 * 
 *     # Get the limits if any (and make sure to replace them in the proper quadrants)
 *     if DPhi is None:             # <<<<<<<<<<<<<<
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]
 *     else:
 */
    goto __pyx_L4;
  }

  /* "tofu/geom/_GG03.pyx":1177
 *         DPhi0, DPhi1 = PhiMinMax[0], PhiMinMax[1]
 *     else:
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))             # <<<<<<<<<<<<<<
 *         DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_22 = (__pyx_t_1 == Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if ((__pyx_t_22 != 0)) {
      __pyx_t_25 = 0;
      __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_25)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;
    } else {
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_DPhi, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyFloat_FromDouble(atan2(sin(__pyx_t_26), cos(__pyx_t_27))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_v_DPhi0 = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1178
 *     else:
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))
 *         DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))             # <<<<<<<<<<<<<<
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0
 * 
 */
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_22 = (__pyx_t_1 == Py_None);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if ((__pyx_t_22 != 0)) {
      __pyx_t_28 = 1;
      __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_28)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;
    } else {
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_DPhi, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyFloat_FromDouble(atan2(sin(__pyx_t_27), cos(__pyx_t_26))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __pyx_v_DPhi1 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "tofu/geom/_GG03.pyx":1179
 *         DPhi0 = PhiMinMax[0] if DPhi[0] is None else Catan2(Csin(DPhi[0]),Ccos(DPhi[0]))
 *         DPhi1 = PhiMinMax[1] if DPhi[1] is None else Catan2(Csin(DPhi[1]),Ccos(DPhi[1]))
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0             # <<<<<<<<<<<<<<
 * 
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_DPhi1, __pyx_v_DPhi0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1179, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_22) {
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_DPhi1, __pyx_v_DPhi0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_1 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_DPhi1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_v_DPhi0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_3 = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_v_DDPhi = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":1181
 *     DDPhi = DPhi1-DPhi0 if DPhi1>DPhi0 else 2.*Cpi+DPhi1-DPhi0
 * 
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)             # <<<<<<<<<<<<<<
 * 
 *     if Inter:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_getBoundsInter2AngSeg); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_Full); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_29 = 0;
  __pyx_t_9 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_29)) )))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_30 = 1;
  __pyx_t_8 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_30)) )))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1181, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_31 = NULL;
  __pyx_t_32 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_31)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_31);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_32 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[6] = {__pyx_t_31, __pyx_t_2, __pyx_t_9, __pyx_t_8, __pyx_v_DPhi0, __pyx_v_DPhi1};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_32, 5+__pyx_t_32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[6] = {__pyx_t_31, __pyx_t_2, __pyx_t_9, __pyx_t_8, __pyx_v_DPhi0, __pyx_v_DPhi1};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_32, 5+__pyx_t_32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else
  #endif
  {
    __pyx_t_33 = PyTuple_New(5+__pyx_t_32); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_33);
    if (__pyx_t_31) {
      __Pyx_GIVEREF(__pyx_t_31); PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_31); __pyx_t_31 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_33, 0+__pyx_t_32, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_33, 1+__pyx_t_32, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_33, 2+__pyx_t_32, __pyx_t_8);
    __Pyx_INCREF(__pyx_v_DPhi0);
    __Pyx_GIVEREF(__pyx_v_DPhi0);
    PyTuple_SET_ITEM(__pyx_t_33, 3+__pyx_t_32, __pyx_v_DPhi0);
    __Pyx_INCREF(__pyx_v_DPhi1);
    __Pyx_GIVEREF(__pyx_v_DPhi1);
    PyTuple_SET_ITEM(__pyx_t_33, 4+__pyx_t_32, __pyx_v_DPhi1);
    __pyx_t_2 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_33, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 3)) {
      if (size > 3) __Pyx_RaiseTooManyValuesError(3);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1181, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_33 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_33 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_33);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_33 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_33);
    __pyx_t_8 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1181, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_34 = Py_TYPE(__pyx_t_9)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_34(__pyx_t_9); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_33 = __pyx_t_34(__pyx_t_9); if (unlikely(!__pyx_t_33)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_33);
    index = 2; __pyx_t_8 = __pyx_t_34(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_34(__pyx_t_9), 3) < 0) __PYX_ERR(0, 1181, __pyx_L1_error)
    __pyx_t_34 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_34 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1181, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_Inter = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_Bounds = __pyx_t_33;
  __pyx_t_33 = 0;
  __pyx_v_Faces = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "tofu/geom/_GG03.pyx":1183
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)
 * 
 *     if Inter:             # <<<<<<<<<<<<<<
 *         BC = list(Bounds)
 *         nBounds = len(Bounds)
 */
  __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_v_Inter); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1183, __pyx_L1_error)
  if (__pyx_t_22) {

    /* "tofu/geom/_GG03.pyx":1184
 * 
 *     if Inter:
 *         BC = list(Bounds)             # <<<<<<<<<<<<<<
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):
 */
    __pyx_t_3 = PySequence_List(__pyx_v_Bounds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1184, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_BC = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1185
 *     if Inter:
 *         BC = list(Bounds)
 *         nBounds = len(Bounds)             # <<<<<<<<<<<<<<
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:
 */
    __pyx_t_35 = PyObject_Length(__pyx_v_Bounds); if (unlikely(__pyx_t_35 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1185, __pyx_L1_error)
    __pyx_v_nBounds = __pyx_t_35;

    /* "tofu/geom/_GG03.pyx":1186
 *         BC = list(Bounds)
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):             # <<<<<<<<<<<<<<
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi
 */
    __pyx_t_35 = __pyx_v_nBounds;
    for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_35; __pyx_t_36+=1) {
      __pyx_v_ii = __pyx_t_36;

      /* "tofu/geom/_GG03.pyx":1187
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:
 */
      __pyx_t_3 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_37 = 0;
      __pyx_t_8 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_37)) )))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_33 = PyObject_RichCompare(__pyx_t_3, __pyx_t_8, Py_LT); __Pyx_XGOTREF(__pyx_t_33); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1187, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_33); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1187, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      if (__pyx_t_22) {

        /* "tofu/geom/_GG03.pyx":1188
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi             # <<<<<<<<<<<<<<
 *             if BC[ii][1]<=PhiMinMax[0]:
 *                 BC[ii][1] += 2.*Cpi
 */
        __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii));
        __pyx_t_33 = PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii);
        __pyx_t_38 = 0;
        __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_33, __pyx_t_38, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1188, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_3 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1188, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1188, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(__Pyx_SetItemInt(__pyx_t_33, __pyx_t_38, __pyx_t_1, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 1188, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;

        /* "tofu/geom/_GG03.pyx":1187
 *         nBounds = len(Bounds)
 *         for ii in range(0,nBounds):
 *             if BC[ii][0]<PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:
 */
      }

      /* "tofu/geom/_GG03.pyx":1189
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][1] += 2.*Cpi
 * 
 */
      __pyx_t_33 = __Pyx_GetItemInt(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii), 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_39 = 0;
      __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_39)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_33, __pyx_t_1, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_22) {

        /* "tofu/geom/_GG03.pyx":1190
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:
 *                 BC[ii][1] += 2.*Cpi             # <<<<<<<<<<<<<<
 * 
 *         Dphi = DIn/np.max(VPoly[0,:]) if DIn!=0. else 0. # Required distance effective at max R
 */
        __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii));
        __pyx_t_3 = PyList_GET_ITEM(__pyx_v_BC, __pyx_v_ii);
        __pyx_t_38 = 1;
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_t_38, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_33 = PyFloat_FromDouble((2. * M_PI)); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __pyx_t_8 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_33); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1190, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        if (unlikely(__Pyx_SetItemInt(__pyx_t_3, __pyx_t_38, __pyx_t_8, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 0, 0) < 0)) __PYX_ERR(0, 1190, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":1189
 *             if BC[ii][0]<PhiMinMax[0]:
 *                 BC[ii][0] += 2.*Cpi
 *             if BC[ii][1]<=PhiMinMax[0]:             # <<<<<<<<<<<<<<
 *                 BC[ii][1] += 2.*Cpi
 * 
 */
      }
    }

    /* "tofu/geom/_GG03.pyx":1192
 *                 BC[ii][1] += 2.*Cpi
 * 
 *         Dphi = DIn/np.max(VPoly[0,:]) if DIn!=0. else 0. # Required distance effective at max R             # <<<<<<<<<<<<<<
 * 
 *         # Get the mesh for the faces
 */
    if (((__pyx_v_DIn != 0.) != 0)) {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_33 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_max); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_10.data = __pyx_v_VPoly.data;
      __pyx_t_10.memview = __pyx_v_VPoly.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
      {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1192, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_33 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_33); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1192, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_33};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1192, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_33};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1192, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1192, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_33);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_33);
          __pyx_t_33 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1192, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_27 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_26 = __pyx_t_27;
    } else {
      __pyx_t_26 = 0.;
    }
    __pyx_v_Dphi = __pyx_t_26;

    /* "tofu/geom/_GG03.pyx":1195
 * 
 *         # Get the mesh for the faces
 *         if any(Faces) :             # <<<<<<<<<<<<<<
 *             R0, dR0r, indR0, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DR, Lim=True, margin=margin)
 *             Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v_Faces);
    __Pyx_GIVEREF(__pyx_v_Faces);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_Faces);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_any, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1195, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1196
 *         # Get the mesh for the faces
 *         if any(Faces) :
 *             R0, dR0r, indR0, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DR, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *             Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 *             R0n, Z0n = len(R0), len(Z0)
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_33 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_min); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_10.data = __pyx_v_VPoly.data;
      __pyx_t_10.memview = __pyx_v_VPoly.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
      {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1196, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_33 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;
      __pyx_t_31 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_31)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_31);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_31) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_33); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_33};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_33};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        } else
        #endif
        {
          __pyx_t_40 = PyTuple_New(1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_40);
          __Pyx_GIVEREF(__pyx_t_31); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_31); __pyx_t_31 = NULL;
          __Pyx_GIVEREF(__pyx_t_33);
          PyTuple_SET_ITEM(__pyx_t_40, 0+1, __pyx_t_33);
          __pyx_t_33 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_max); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_10.data = __pyx_v_VPoly.data;
      __pyx_t_10.memview = __pyx_v_VPoly.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
      {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1196, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_40 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;
      __pyx_t_31 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_33))) {
        __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_33);
        if (likely(__pyx_t_31)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_33);
          __Pyx_INCREF(__pyx_t_31);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_33, function);
        }
      }
      if (!__pyx_t_31) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_33, __pyx_t_40); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_33)) {
          PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_40};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_33, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_33)) {
          PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_40};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_33, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(1+1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __Pyx_GIVEREF(__pyx_t_31); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_31); __pyx_t_31 = NULL;
          __Pyx_GIVEREF(__pyx_t_40);
          PyTuple_SET_ITEM(__pyx_t_41, 0+1, __pyx_t_40);
          __pyx_t_40 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_41, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_33 = PyList_New(2); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_33, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_9);
      PyList_SET_ITEM(__pyx_t_33, 1, __pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_33); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_33};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_33};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_33);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_33);
          __pyx_t_33 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __pyx_t_1 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_DL, __pyx_v_DR) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_1) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1196, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_33 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_33 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_33);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_8,&__pyx_t_33};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1196, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_8,&__pyx_t_33};
        __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1196, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_34 = Py_TYPE(__pyx_t_9)->tp_iternext;
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_34(__pyx_t_9); if (unlikely(!item)) goto __pyx_L13_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_34(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1196, __pyx_L1_error)
        __pyx_t_34 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_34 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1196, __pyx_L1_error)
        __pyx_L14_unpacking_done:;
      }
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1196, __pyx_L1_error)
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1196, __pyx_L1_error)
      __pyx_t_32 = __Pyx_PyInt_As_int(__pyx_t_33); if (unlikely((__pyx_t_32 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1196, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_42 = ((PyArrayObject *)__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
        __pyx_t_43 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_R0.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_43 < 0)) {
          PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_R0.rcbuffer->pybuffer, (PyObject*)__pyx_v_R0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
          }
          __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
        }
        __pyx_pybuffernd_R0.diminfo[0].strides = __pyx_pybuffernd_R0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R0.diminfo[0].shape = __pyx_pybuffernd_R0.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_43 < 0)) __PYX_ERR(0, 1196, __pyx_L1_error)
      }
      __pyx_t_42 = 0;
      __pyx_v_R0 = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_v_dR0r = __pyx_t_26;
      __pyx_t_47 = ((PyArrayObject *)__pyx_t_8);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
        __pyx_t_43 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_43 < 0)) {
          PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indR0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
          }
          __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
        }
        __pyx_pybuffernd_indR0.diminfo[0].strides = __pyx_pybuffernd_indR0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indR0.diminfo[0].shape = __pyx_pybuffernd_indR0.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_43 < 0)) __PYX_ERR(0, 1196, __pyx_L1_error)
      }
      __pyx_t_47 = 0;
      __pyx_v_indR0 = ((PyArrayObject *)__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_v_NR0 = __pyx_t_32;

      /* "tofu/geom/_GG03.pyx":1197
 *         if any(Faces) :
 *             R0, dR0r, indR0, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DR, Lim=True, margin=margin)
 *             Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *             R0n, Z0n = len(R0), len(Z0)
 *             ptsrz = np.array([np.tile(R0,Z0n),np.repeat(Z0,R0n)])
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_min); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_10.data = __pyx_v_VPoly.data;
      __pyx_t_10.memview = __pyx_v_VPoly.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
      {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1197, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;
      __pyx_t_41 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_41)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_41);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_41) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_41, __pyx_t_2};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_41, __pyx_t_2};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_40 = PyTuple_New(1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_40);
          __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_41); __pyx_t_41 = NULL;
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_40, 0+1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_40, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_10.data = __pyx_v_VPoly.data;
      __pyx_t_10.memview = __pyx_v_VPoly.memview;
      __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
      {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1197, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_40 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
      __pyx_t_10.memview = NULL;
      __pyx_t_10.data = NULL;
      __pyx_t_41 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_41)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_41);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_41) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_40); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1197, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_41, __pyx_t_40};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_41, __pyx_t_40};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        } else
        #endif
        {
          __pyx_t_31 = PyTuple_New(1+1); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_31);
          __Pyx_GIVEREF(__pyx_t_41); PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_41); __pyx_t_41 = NULL;
          __Pyx_GIVEREF(__pyx_t_40);
          PyTuple_SET_ITEM(__pyx_t_31, 0+1, __pyx_t_40);
          __pyx_t_40 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_31, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
      __pyx_t_8 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_33 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1197, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_33);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_2};
          __pyx_t_33 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_2};
          __pyx_t_33 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1197, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_33);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
      __pyx_t_33 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DL, __pyx_v_DZ) < 0) __PYX_ERR(0, 1197, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1197, __pyx_L1_error)
      __pyx_t_33 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_33) < 0) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_33))) || (PyList_CheckExact(__pyx_t_33))) {
        PyObject* sequence = __pyx_t_33;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1197, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_8,&__pyx_t_1,&__pyx_t_2};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1197, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_8,&__pyx_t_1,&__pyx_t_2};
        __pyx_t_9 = PyObject_GetIter(__pyx_t_33); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1197, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __pyx_t_34 = Py_TYPE(__pyx_t_9)->tp_iternext;
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_34(__pyx_t_9); if (unlikely(!item)) goto __pyx_L15_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_34(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1197, __pyx_L1_error)
        __pyx_t_34 = NULL;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L16_unpacking_done;
        __pyx_L15_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_34 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1197, __pyx_L1_error)
        __pyx_L16_unpacking_done:;
      }
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1197, __pyx_L1_error)
      __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_26 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1197, __pyx_L1_error)
      __pyx_t_32 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_32 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_42 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
        __pyx_t_43 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_43 < 0)) {
          PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_v_Z0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
          }
          __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
        }
        __pyx_pybuffernd_Z0.diminfo[0].strides = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Z0.diminfo[0].shape = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_43 < 0)) __PYX_ERR(0, 1197, __pyx_L1_error)
      }
      __pyx_t_42 = 0;
      __pyx_v_Z0 = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_v_dZ0r = __pyx_t_26;
      __pyx_t_47 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
        __pyx_t_43 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_43 < 0)) {
          PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
          }
          __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
        }
        __pyx_pybuffernd_indZ0.diminfo[0].strides = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ0.diminfo[0].shape = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_43 < 0)) __PYX_ERR(0, 1197, __pyx_L1_error)
      }
      __pyx_t_47 = 0;
      __pyx_v_indZ0 = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_v_NZ0 = __pyx_t_32;

      /* "tofu/geom/_GG03.pyx":1198
 *             R0, dR0r, indR0, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DR, Lim=True, margin=margin)
 *             Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 *             R0n, Z0n = len(R0), len(Z0)             # <<<<<<<<<<<<<<
 *             ptsrz = np.array([np.tile(R0,Z0n),np.repeat(Z0,R0n)])
 *             iind = NR0*np.repeat(indZ0,R0n) + np.tile(indR0,Z0n)
 */
      __pyx_t_35 = PyObject_Length(((PyObject *)__pyx_v_R0)); if (unlikely(__pyx_t_35 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1198, __pyx_L1_error)
      __pyx_t_36 = PyObject_Length(((PyObject *)__pyx_v_Z0)); if (unlikely(__pyx_t_36 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1198, __pyx_L1_error)
      __pyx_v_R0n = __pyx_t_35;
      __pyx_v_Z0n = __pyx_t_36;

      /* "tofu/geom/_GG03.pyx":1199
 *             Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 *             R0n, Z0n = len(R0), len(Z0)
 *             ptsrz = np.array([np.tile(R0,Z0n),np.repeat(Z0,R0n)])             # <<<<<<<<<<<<<<
 *             iind = NR0*np.repeat(indZ0,R0n) + np.tile(indR0,Z0n)
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_tile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_Z0n); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      __pyx_t_32 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_32 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_R0), __pyx_t_8};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_R0), __pyx_t_8};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_31 = PyTuple_New(2+__pyx_t_32); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_31, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_R0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_R0));
        PyTuple_SET_ITEM(__pyx_t_31, 0+__pyx_t_32, ((PyObject *)__pyx_v_R0));
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_31, 1+__pyx_t_32, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_31 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_repeat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __pyx_t_31 = __Pyx_PyInt_From_int(__pyx_v_R0n); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __pyx_t_9 = NULL;
      __pyx_t_32 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_32 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_Z0), __pyx_t_31};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_Z0), __pyx_t_31};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      } else
      #endif
      {
        __pyx_t_40 = PyTuple_New(2+__pyx_t_32); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_Z0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Z0));
        PyTuple_SET_ITEM(__pyx_t_40, 0+__pyx_t_32, ((PyObject *)__pyx_v_Z0));
        __Pyx_GIVEREF(__pyx_t_31);
        PyTuple_SET_ITEM(__pyx_t_40, 1+__pyx_t_32, __pyx_t_31);
        __pyx_t_31 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_40, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyList_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_33 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1199, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_33);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8};
          __pyx_t_33 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1199, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8};
          __pyx_t_33 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1199, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_33 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_33) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_33, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1199, __pyx_L1_error)
      __pyx_t_48 = ((PyArrayObject *)__pyx_t_33);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer, (PyObject*)__pyx_v_ptsrz, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
          }
          __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
        }
        __pyx_pybuffernd_ptsrz.diminfo[0].strides = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ptsrz.diminfo[0].shape = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ptsrz.diminfo[1].strides = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ptsrz.diminfo[1].shape = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1199, __pyx_L1_error)
      }
      __pyx_t_48 = 0;
      __pyx_v_ptsrz = ((PyArrayObject *)__pyx_t_33);
      __pyx_t_33 = 0;

      /* "tofu/geom/_GG03.pyx":1200
 *             R0n, Z0n = len(R0), len(Z0)
 *             ptsrz = np.array([np.tile(R0,Z0n),np.repeat(Z0,R0n)])
 *             iind = NR0*np.repeat(indZ0,R0n) + np.tile(indR0,Z0n)             # <<<<<<<<<<<<<<
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)
 *             if np.any(indin):
 */
      __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_NR0); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_repeat); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_R0n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      __pyx_t_32 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_32 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_indZ0), __pyx_t_2};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_indZ0), __pyx_t_2};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_40 = PyTuple_New(2+__pyx_t_32); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_40, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_indZ0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_indZ0));
        PyTuple_SET_ITEM(__pyx_t_40, 0+__pyx_t_32, ((PyObject *)__pyx_v_indZ0));
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_40, 1+__pyx_t_32, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_40, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyNumber_Multiply(__pyx_t_33, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_33 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_tile); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_33 = __Pyx_PyInt_From_int(__pyx_v_Z0n); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __pyx_t_2 = NULL;
      __pyx_t_32 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_40))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_40);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_40);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_40, function);
          __pyx_t_32 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_40)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_indR0), __pyx_t_33};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_40, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_40)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_indR0), __pyx_t_33};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_40, __pyx_temp+1-__pyx_t_32, 2+__pyx_t_32); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(2+__pyx_t_32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_indR0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_indR0));
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_32, ((PyObject *)__pyx_v_indR0));
        __Pyx_GIVEREF(__pyx_t_33);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_32, __pyx_t_33);
        __pyx_t_33 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1200, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_40 = PyNumber_Add(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1200, __pyx_L1_error)
      __pyx_t_47 = ((PyArrayObject *)__pyx_t_40);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iind.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iind.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iind.rcbuffer->pybuffer, (PyObject*)__pyx_v_iind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
          }
          __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
        }
        __pyx_pybuffernd_iind.diminfo[0].strides = __pyx_pybuffernd_iind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iind.diminfo[0].shape = __pyx_pybuffernd_iind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1200, __pyx_L1_error)
      }
      __pyx_t_47 = 0;
      __pyx_v_iind = ((PyArrayObject *)__pyx_t_40);
      __pyx_t_40 = 0;

      /* "tofu/geom/_GG03.pyx":1201
 *             ptsrz = np.array([np.tile(R0,Z0n),np.repeat(Z0,R0n)])
 *             iind = NR0*np.repeat(indZ0,R0n) + np.tile(indR0,Z0n)
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if np.any(indin):
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_49 = __pyx_v_VPoly;
      __PYX_INC_MEMVIEW(&__pyx_t_49, 1);
      if (unlikely(__pyx_memslice_transpose(&__pyx_t_49) == 0)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_t_49, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __PYX_XDEC_MEMVIEW(&__pyx_t_49, 1);
      __pyx_t_49.memview = NULL;
      __pyx_t_49.data = NULL;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1201, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_40);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8};
          __pyx_t_40 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1201, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_40);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_8};
          __pyx_t_40 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1201, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_40);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_33 = PyTuple_New(1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1201, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_33, 0+1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_33, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1201, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_40);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_40 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ptsrz), __pyx_n_s_T); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __pyx_t_33 = PyTuple_New(1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_GIVEREF(__pyx_t_40);
      PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_40);
      __pyx_t_40 = 0;
      __pyx_t_40 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1201, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_40, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1201, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_33, __pyx_t_40); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1201, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_v_indin = __pyx_t_8;
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":1202
 *             iind = NR0*np.repeat(indZ0,R0n) + np.tile(indR0,Z0n)
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)
 *             if np.any(indin):             # <<<<<<<<<<<<<<
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))
 *                 iindF = iind[indin]
 */
      __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_40);
      __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_any); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_33);
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_40 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_33))) {
        __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_33);
        if (likely(__pyx_t_40)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_33);
          __Pyx_INCREF(__pyx_t_40);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_33, function);
        }
      }
      if (!__pyx_t_40) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_33, __pyx_v_indin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_33)) {
          PyObject *__pyx_temp[2] = {__pyx_t_40, __pyx_v_indin};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_33, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1202, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_33)) {
          PyObject *__pyx_temp[2] = {__pyx_t_40, __pyx_v_indin};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_33, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1202, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
          __Pyx_GOTREF(__pyx_t_8);
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1202, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_40); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_40); __pyx_t_40 = NULL;
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_indin);
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1202, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_22) {

        /* "tofu/geom/_GG03.pyx":1203
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)
 *             if np.any(indin):
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))             # <<<<<<<<<<<<<<
 *                 iindF = iind[indin]
 *                 dsF = dR0r*dZ0r*np.ones((indin.sum(),))
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_40 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_40)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_40);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (__pyx_t_40) {
          __pyx_t_33 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_40); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        } else {
          __pyx_t_33 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1203, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_RichCompare(__pyx_t_33, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1203, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_22) {
          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_slice__151);
          __Pyx_GIVEREF(__pyx_slice__151);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__151);
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_indin);
          __pyx_t_33 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_t_1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (!(likely(((__pyx_t_33) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_33, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1203, __pyx_L1_error)
          __pyx_t_8 = __pyx_t_33;
          __pyx_t_33 = 0;
        } else {
          __pyx_t_33 = PyTuple_New(2); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_INCREF(__pyx_slice__152);
          __Pyx_GIVEREF(__pyx_slice__152);
          PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_slice__152);
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_33, 1, __pyx_v_indin);
          __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_t_33); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
          __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_reshape); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_33);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_tuple__154, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
          if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1203, __pyx_L1_error)
          __pyx_t_8 = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer, (PyObject*)__pyx_v_ptsrz, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
            }
            __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
          }
          __pyx_pybuffernd_ptsrz.diminfo[0].strides = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ptsrz.diminfo[0].shape = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_ptsrz.diminfo[1].strides = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_ptsrz.diminfo[1].shape = __pyx_pybuffernd_ptsrz.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1203, __pyx_L1_error)
        }
        __Pyx_DECREF_SET(__pyx_v_ptsrz, ((PyArrayObject *)__pyx_t_8));
        __pyx_t_8 = 0;

        /* "tofu/geom/_GG03.pyx":1204
 *             if np.any(indin):
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))
 *                 iindF = iind[indin]             # <<<<<<<<<<<<<<
 *                 dsF = dR0r*dZ0r*np.ones((indin.sum(),))
 * 
 */
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_iind), __pyx_v_indin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1204, __pyx_L1_error)
        __pyx_t_47 = ((PyArrayObject *)__pyx_t_8);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iindF.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iindF.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iindF.rcbuffer->pybuffer, (PyObject*)__pyx_v_iindF, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
            }
            __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
          }
          __pyx_pybuffernd_iindF.diminfo[0].strides = __pyx_pybuffernd_iindF.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iindF.diminfo[0].shape = __pyx_pybuffernd_iindF.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1204, __pyx_L1_error)
        }
        __pyx_t_47 = 0;
        __pyx_v_iindF = ((PyArrayObject *)__pyx_t_8);
        __pyx_t_8 = 0;

        /* "tofu/geom/_GG03.pyx":1205
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))
 *                 iindF = iind[indin]
 *                 dsF = dR0r*dZ0r*np.ones((indin.sum(),))             # <<<<<<<<<<<<<<
 * 
 *         # First face
 */
        __pyx_t_8 = PyFloat_FromDouble((__pyx_v_dR0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_33 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_ones); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_2) {
          __pyx_t_33 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1205, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          __pyx_t_33 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1205, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_33);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_33);
        __pyx_t_33 = 0;
        __pyx_t_33 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_40))) {
          __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_40);
          if (likely(__pyx_t_33)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_40);
            __Pyx_INCREF(__pyx_t_33);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_40, function);
          }
        }
        if (!__pyx_t_33) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_40, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_40)) {
            PyObject *__pyx_temp[2] = {__pyx_t_33, __pyx_t_3};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_40, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_40)) {
            PyObject *__pyx_temp[2] = {__pyx_t_33, __pyx_t_3};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_40, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1205, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_33); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_33); __pyx_t_33 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1205, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        __pyx_t_40 = PyNumber_Multiply(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1205, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1205, __pyx_L1_error)
        __pyx_t_42 = ((PyArrayObject *)__pyx_t_40);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dsF.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dsF.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dsF.rcbuffer->pybuffer, (PyObject*)__pyx_v_dsF, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
            }
            __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
          }
          __pyx_pybuffernd_dsF.diminfo[0].strides = __pyx_pybuffernd_dsF.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dsF.diminfo[0].shape = __pyx_pybuffernd_dsF.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1205, __pyx_L1_error)
        }
        __pyx_t_42 = 0;
        __pyx_v_dsF = ((PyArrayObject *)__pyx_t_40);
        __pyx_t_40 = 0;

        /* "tofu/geom/_GG03.pyx":1202
 *             iind = NR0*np.repeat(indZ0,R0n) + np.tile(indR0,Z0n)
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)
 *             if np.any(indin):             # <<<<<<<<<<<<<<
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))
 *                 iindF = iind[indin]
 */
      }

      /* "tofu/geom/_GG03.pyx":1195
 * 
 *         # Get the mesh for the faces
 *         if any(Faces) :             # <<<<<<<<<<<<<<
 *             R0, dR0r, indR0, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DR, Lim=True, margin=margin)
 *             Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 */
    }

    /* "tofu/geom/_GG03.pyx":1208
 * 
 *         # First face
 *         if Faces[0]:             # <<<<<<<<<<<<<<
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])
 */
    __pyx_t_40 = __Pyx_GetItemInt(__pyx_v_Faces, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_40);
    __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_40); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1208, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1209
 *         # First face
 *         if Faces[0]:
 *             if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])
 *             else:
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1209, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_8) {
        __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1209, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_40 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1209, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_40);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_22 = (__Pyx_PyString_Equals(__pyx_t_40, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1209, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      if (__pyx_t_22) {

        /* "tofu/geom/_GG03.pyx":1210
 *         if Faces[0]:
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])             # <<<<<<<<<<<<<<
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[0]+Dphi)*np.ones((indin.sum(),))])
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__156); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_50 = 0;
        __pyx_t_2 = PyFloat_FromDouble(cos(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_50)) ))) + __pyx_v_Dphi))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__158); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_51 = 0;
        __pyx_t_1 = PyFloat_FromDouble(sin(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_51)) ))) + __pyx_v_Dphi))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_33 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__160); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_33);
        PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_33);
        __Pyx_GIVEREF(__pyx_t_1);
        PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_1);
        __pyx_t_3 = 0;
        __pyx_t_33 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_1) {
          __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1210, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_40);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_8)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_2};
            __pyx_t_40 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1210, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_40);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_2};
            __pyx_t_40 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1210, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_40);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          } else
          #endif
          {
            __pyx_t_33 = PyTuple_New(1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1210, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_33);
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_1); __pyx_t_1 = NULL;
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_33, 0+1, __pyx_t_2);
            __pyx_t_2 = 0;
            __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_33, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1210, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_40);
            __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1210, __pyx_L1_error)
        __pyx_t_48 = ((PyArrayObject *)__pyx_t_40);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
            }
            __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
          }
          __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1210, __pyx_L1_error)
        }
        __pyx_t_48 = 0;
        __pyx_v_pts = ((PyArrayObject *)__pyx_t_40);
        __pyx_t_40 = 0;

        /* "tofu/geom/_GG03.pyx":1209
 *         # First face
 *         if Faces[0]:
 *             if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])
 *             else:
 */
        goto __pyx_L19;
      }

      /* "tofu/geom/_GG03.pyx":1212
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[0]+Dphi)*np.ones((indin.sum(),))])             # <<<<<<<<<<<<<<
 *             LPts.append( pts )
 *             Lind.append( iindF )
 */
      /*else*/ {
        __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_33 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_array); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__162); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__164); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_52 = 0;
        __pyx_t_1 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_52)) ))) + __pyx_v_Dphi)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_31 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_ones); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        if (unlikely(!__pyx_v_indin)) { __Pyx_RaiseUnboundLocalError("indin"); __PYX_ERR(0, 1212, __pyx_L1_error) }
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_53 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_53 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_53)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_53);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
          }
        }
        if (__pyx_t_53) {
          __pyx_t_31 = __Pyx_PyObject_CallOneArg(__pyx_t_41, __pyx_t_53); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1212, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        } else {
          __pyx_t_31 = __Pyx_PyObject_CallNoArg(__pyx_t_41); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1212, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_31);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyTuple_New(1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_GIVEREF(__pyx_t_31);
        PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_31);
        __pyx_t_31 = 0;
        __pyx_t_31 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_31)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_31);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        if (!__pyx_t_31) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_41); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          __Pyx_GOTREF(__pyx_t_3);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_41};
            __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_41};
            __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
          } else
          #endif
          {
            __pyx_t_53 = PyTuple_New(1+1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_53);
            __Pyx_GIVEREF(__pyx_t_31); PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_31); __pyx_t_31 = NULL;
            __Pyx_GIVEREF(__pyx_t_41);
            PyTuple_SET_ITEM(__pyx_t_53, 0+1, __pyx_t_41);
            __pyx_t_41 = 0;
            __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_53, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyNumber_Multiply(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_8);
        PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_2);
        PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_9);
        PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_9);
        __pyx_t_8 = 0;
        __pyx_t_2 = 0;
        __pyx_t_9 = 0;
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_33))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_33);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_33);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_33, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_40 = __Pyx_PyObject_CallOneArg(__pyx_t_33, __pyx_t_3); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1212, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_40);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_33)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_3};
            __pyx_t_40 = __Pyx_PyFunction_FastCall(__pyx_t_33, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_40);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_33)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_3};
            __pyx_t_40 = __Pyx_PyCFunction_FastCall(__pyx_t_33, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_40);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9); __pyx_t_9 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_33, __pyx_t_2, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1212, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_40);
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1212, __pyx_L1_error)
        __pyx_t_48 = ((PyArrayObject *)__pyx_t_40);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
            }
            __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
          }
          __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1212, __pyx_L1_error)
        }
        __pyx_t_48 = 0;
        __pyx_v_pts = ((PyArrayObject *)__pyx_t_40);
        __pyx_t_40 = 0;
      }
      __pyx_L19:;

      /* "tofu/geom/_GG03.pyx":1213
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[0]+Dphi)*np.ones((indin.sum(),))])
 *             LPts.append( pts )             # <<<<<<<<<<<<<<
 *             Lind.append( iindF )
 *             LdS.append( dsF )
 */
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LPts, ((PyObject *)__pyx_v_pts)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1213, __pyx_L1_error)

      /* "tofu/geom/_GG03.pyx":1214
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[0]+Dphi)*np.ones((indin.sum(),))])
 *             LPts.append( pts )
 *             Lind.append( iindF )             # <<<<<<<<<<<<<<
 *             LdS.append( dsF )
 * 
 */
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_Lind, ((PyObject *)__pyx_v_iindF)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1214, __pyx_L1_error)

      /* "tofu/geom/_GG03.pyx":1215
 *             LPts.append( pts )
 *             Lind.append( iindF )
 *             LdS.append( dsF )             # <<<<<<<<<<<<<<
 * 
 *         # Main body
 */
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LdS, ((PyObject *)__pyx_v_dsF)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1215, __pyx_L1_error)

      /* "tofu/geom/_GG03.pyx":1208
 * 
 *         # First face
 *         if Faces[0]:             # <<<<<<<<<<<<<<
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])
 */
    }

    /* "tofu/geom/_GG03.pyx":1218
 * 
 *         # Main body
 *         PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,             # <<<<<<<<<<<<<<
 *                                                                                                DR=DR, DZ=DZ, DPhi=[DPhi0,DPhi1],
 *                                                                                                DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 */
    __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_Smesh_Tor_SubFromD_cython); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_40);
    __pyx_t_33 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_33);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dRPhi); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_33);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_33);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_3);
    __pyx_t_33 = 0;
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1219
 *         # Main body
 *         PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,
 *                                                                                                DR=DR, DZ=DZ, DPhi=[DPhi0,DPhi1],             # <<<<<<<<<<<<<<
 *                                                                                                DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 *                                                                                                Out=Out, margin=margin)
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DR, __pyx_v_DR) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DZ, __pyx_v_DZ) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1219, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_DPhi0);
    __Pyx_GIVEREF(__pyx_v_DPhi0);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_DPhi0);
    __Pyx_INCREF(__pyx_v_DPhi1);
    __Pyx_GIVEREF(__pyx_v_DPhi1);
    PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_DPhi1);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DPhi, __pyx_t_2) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1220
 *         PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,
 *                                                                                                DR=DR, DZ=DZ, DPhi=[DPhi0,DPhi1],
 *                                                                                                DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,             # <<<<<<<<<<<<<<
 *                                                                                                Out=Out, margin=margin)
 * 
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DIn, __pyx_t_2) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_VIn, __pyx_v_VIn) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_phiMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1220, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_PhiMinMax, __pyx_t_2) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1221
 *                                                                                                DR=DR, DZ=DZ, DPhi=[DPhi0,DPhi1],
 *                                                                                                DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 *                                                                                                Out=Out, margin=margin)             # <<<<<<<<<<<<<<
 * 
 *         if PtsM.shape[1]>=1:
 */
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Out, __pyx_v_Out) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1221, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 1219, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1218
 * 
 *         # Main body
 *         PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,             # <<<<<<<<<<<<<<
 *                                                                                                DR=DR, DZ=DZ, DPhi=[DPhi0,DPhi1],
 *                                                                                                DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 9)) {
        if (size > 9) __Pyx_RaiseTooManyValuesError(9);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1218, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_40 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_33 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 5); 
        __pyx_t_53 = PyTuple_GET_ITEM(sequence, 6); 
        __pyx_t_41 = PyTuple_GET_ITEM(sequence, 7); 
        __pyx_t_31 = PyTuple_GET_ITEM(sequence, 8); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_40 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_33 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 5); 
        __pyx_t_53 = PyList_GET_ITEM(sequence, 6); 
        __pyx_t_41 = PyList_GET_ITEM(sequence, 7); 
        __pyx_t_31 = PyList_GET_ITEM(sequence, 8); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_40);
      __Pyx_INCREF(__pyx_t_33);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_53);
      __Pyx_INCREF(__pyx_t_41);
      __Pyx_INCREF(__pyx_t_31);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[9] = {&__pyx_t_3,&__pyx_t_9,&__pyx_t_40,&__pyx_t_33,&__pyx_t_8,&__pyx_t_1,&__pyx_t_53,&__pyx_t_41,&__pyx_t_31};
        for (i=0; i < 9; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1218, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[9] = {&__pyx_t_3,&__pyx_t_9,&__pyx_t_40,&__pyx_t_33,&__pyx_t_8,&__pyx_t_1,&__pyx_t_53,&__pyx_t_41,&__pyx_t_31};
      __pyx_t_55 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_55)) __PYX_ERR(0, 1218, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_55);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_34 = Py_TYPE(__pyx_t_55)->tp_iternext;
      for (index=0; index < 9; index++) {
        PyObject* item = __pyx_t_34(__pyx_t_55); if (unlikely(!item)) goto __pyx_L20_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_34(__pyx_t_55), 9) < 0) __PYX_ERR(0, 1218, __pyx_L1_error)
      __pyx_t_34 = NULL;
      __Pyx_DECREF(__pyx_t_55); __pyx_t_55 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_55); __pyx_t_55 = 0;
      __pyx_t_34 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1218, __pyx_L1_error)
      __pyx_L21_unpacking_done:;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_33) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_33, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_53) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_53, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    if (!(likely(((__pyx_t_31) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_31, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1218, __pyx_L1_error)
    __pyx_t_48 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsM, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_PtsM.diminfo[0].strides = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsM.diminfo[0].shape = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsM.diminfo[1].strides = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsM.diminfo[1].shape = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_48 = 0;
    __pyx_v_PtsM = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer, (PyObject*)__pyx_v_dSM, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_dSM.diminfo[0].strides = __pyx_pybuffernd_dSM.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dSM.diminfo[0].shape = __pyx_pybuffernd_dSM.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_dSM = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_47 = ((PyArrayObject *)__pyx_t_40);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indM.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indM.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indM.rcbuffer->pybuffer, (PyObject*)__pyx_v_indM, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_indM.diminfo[0].strides = __pyx_pybuffernd_indM.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indM.diminfo[0].shape = __pyx_pybuffernd_indM.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_47 = 0;
    __pyx_v_indM = ((PyArrayObject *)__pyx_t_40);
    __pyx_t_40 = 0;
    __pyx_t_47 = ((PyArrayObject *)__pyx_t_33);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_47 = 0;
    __pyx_v_NL = ((PyArrayObject *)__pyx_t_33);
    __pyx_t_33 = 0;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_dLr = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_Rref = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_53);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_v_dRPhir, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_dRPhir.diminfo[0].strides = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dRPhir.diminfo[0].shape = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_dRPhir = ((PyArrayObject *)__pyx_t_53);
    __pyx_t_53 = 0;
    __pyx_v_nRPhi0 = __pyx_t_41;
    __pyx_t_41 = 0;
    __pyx_t_48 = ((PyArrayObject *)__pyx_t_31);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1218, __pyx_L1_error)
    }
    __pyx_t_48 = 0;
    __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_31);
    __pyx_t_31 = 0;

    /* "tofu/geom/_GG03.pyx":1223
 *                                                                                                Out=Out, margin=margin)
 * 
 *         if PtsM.shape[1]>=1:             # <<<<<<<<<<<<<<
 *             if PtsM.shape[1]==1:
 *                 LPts.append(PtsM.reshape((3,1)))
 */
    __pyx_t_22 = (((__pyx_v_PtsM->dimensions[1]) >= 1) != 0);
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1224
 * 
 *         if PtsM.shape[1]>=1:
 *             if PtsM.shape[1]==1:             # <<<<<<<<<<<<<<
 *                 LPts.append(PtsM.reshape((3,1)))
 *             else:
 */
      __pyx_t_22 = (((__pyx_v_PtsM->dimensions[1]) == 1) != 0);
      if (__pyx_t_22) {

        /* "tofu/geom/_GG03.pyx":1225
 *         if PtsM.shape[1]>=1:
 *             if PtsM.shape[1]==1:
 *                 LPts.append(PtsM.reshape((3,1)))             # <<<<<<<<<<<<<<
 *             else:
 *                 LPts.append(PtsM)
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_PtsM), __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1225, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_31 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__166, NULL); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1225, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_31); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1225, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;

        /* "tofu/geom/_GG03.pyx":1224
 * 
 *         if PtsM.shape[1]>=1:
 *             if PtsM.shape[1]==1:             # <<<<<<<<<<<<<<
 *                 LPts.append(PtsM.reshape((3,1)))
 *             else:
 */
        goto __pyx_L23;
      }

      /* "tofu/geom/_GG03.pyx":1227
 *                 LPts.append(PtsM.reshape((3,1)))
 *             else:
 *                 LPts.append(PtsM)             # <<<<<<<<<<<<<<
 *             Lind.append( indM + NR0*NZ0 )
 *             LdS.append( dSM )
 */
      /*else*/ {
        __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LPts, ((PyObject *)__pyx_v_PtsM)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1227, __pyx_L1_error)
      }
      __pyx_L23:;

      /* "tofu/geom/_GG03.pyx":1228
 *             else:
 *                 LPts.append(PtsM)
 *             Lind.append( indM + NR0*NZ0 )             # <<<<<<<<<<<<<<
 *             LdS.append( dSM )
 * 
 */
      __pyx_t_31 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_v_indM), __pyx_t_31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_Lind, __pyx_t_2); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1228, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1229
 *                 LPts.append(PtsM)
 *             Lind.append( indM + NR0*NZ0 )
 *             LdS.append( dSM )             # <<<<<<<<<<<<<<
 * 
 *         # Second face
 */
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LdS, ((PyObject *)__pyx_v_dSM)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1229, __pyx_L1_error)

      /* "tofu/geom/_GG03.pyx":1223
 *                                                                                                Out=Out, margin=margin)
 * 
 *         if PtsM.shape[1]>=1:             # <<<<<<<<<<<<<<
 *             if PtsM.shape[1]==1:
 *                 LPts.append(PtsM.reshape((3,1)))
 */
    }

    /* "tofu/geom/_GG03.pyx":1232
 * 
 *         # Second face
 *         if Faces[1]:             # <<<<<<<<<<<<<<
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])
 */
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_Faces, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1232, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_22 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1232, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1233
 *         # Second face
 *         if Faces[1]:
 *             if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])
 *             else:
 */
      __pyx_t_31 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1233, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      __pyx_t_41 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_31))) {
        __pyx_t_41 = PyMethod_GET_SELF(__pyx_t_31);
        if (likely(__pyx_t_41)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_31);
          __Pyx_INCREF(__pyx_t_41);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_31, function);
        }
      }
      if (__pyx_t_41) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_31, __pyx_t_41); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1233, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      __pyx_t_22 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_22 < 0)) __PYX_ERR(0, 1233, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_22) {

        /* "tofu/geom/_GG03.pyx":1234
 *         if Faces[1]:
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])             # <<<<<<<<<<<<<<
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[1]-Dphi)*np.ones((indin.sum(),))])
 */
        __pyx_t_31 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_array); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        __pyx_t_31 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__168); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __pyx_t_56 = 1;
        __pyx_t_53 = PyFloat_FromDouble(cos(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_56)) ))) - __pyx_v_Dphi))); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_53);
        __pyx_t_1 = PyNumber_Multiply(__pyx_t_31, __pyx_t_53); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        __pyx_t_53 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__170); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_53);
        __pyx_t_57 = 1;
        __pyx_t_31 = PyFloat_FromDouble(sin(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_57)) ))) - __pyx_v_Dphi))); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __pyx_t_8 = PyNumber_Multiply(__pyx_t_53, __pyx_t_31); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        __pyx_t_31 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__172); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __pyx_t_53 = PyList_New(3); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1234, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_53);
        __Pyx_GIVEREF(__pyx_t_1);
        PyList_SET_ITEM(__pyx_t_53, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_8);
        PyList_SET_ITEM(__pyx_t_53, 1, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_31);
        PyList_SET_ITEM(__pyx_t_53, 2, __pyx_t_31);
        __pyx_t_1 = 0;
        __pyx_t_8 = 0;
        __pyx_t_31 = 0;
        __pyx_t_31 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_41))) {
          __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_41);
          if (likely(__pyx_t_31)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
            __Pyx_INCREF(__pyx_t_31);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_41, function);
          }
        }
        if (!__pyx_t_31) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_41, __pyx_t_53); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_41)) {
            PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_53};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
            PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_53};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          } else
          #endif
          {
            __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1234, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_GIVEREF(__pyx_t_31); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_31); __pyx_t_31 = NULL;
            __Pyx_GIVEREF(__pyx_t_53);
            PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_53);
            __pyx_t_53 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1234, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1234, __pyx_L1_error)
        __pyx_t_48 = ((PyArrayObject *)__pyx_t_2);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
            }
            __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
          }
          __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1234, __pyx_L1_error)
        }
        __pyx_t_48 = 0;
        __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
        __pyx_t_2 = 0;

        /* "tofu/geom/_GG03.pyx":1233
 *         # Second face
 *         if Faces[1]:
 *             if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])
 *             else:
 */
        goto __pyx_L25;
      }

      /* "tofu/geom/_GG03.pyx":1236
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[1]-Dphi)*np.ones((indin.sum(),))])             # <<<<<<<<<<<<<<
 *             LPts.append( pts )
 *             Lind.append( iindF + NR0*NZ0 + nRPhi0 )
 */
      /*else*/ {
        __pyx_t_41 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_41 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__174); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __pyx_t_53 = PyObject_GetItem(((PyObject *)__pyx_v_ptsrz), __pyx_tuple__176); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_53);
        __pyx_t_58 = 1;
        __pyx_t_31 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_58)) ))) - __pyx_v_Dphi)); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_31);
        __pyx_t_33 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_33, __pyx_n_s_ones); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
        if (unlikely(!__pyx_v_indin)) { __Pyx_RaiseUnboundLocalError("indin"); __PYX_ERR(0, 1236, __pyx_L1_error) }
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_33 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_3); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1236, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_33 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1236, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_33);
        PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_33);
        __pyx_t_33 = 0;
        __pyx_t_33 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_40))) {
          __pyx_t_33 = PyMethod_GET_SELF(__pyx_t_40);
          if (likely(__pyx_t_33)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_40);
            __Pyx_INCREF(__pyx_t_33);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_40, function);
          }
        }
        if (!__pyx_t_33) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_40, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_40)) {
            PyObject *__pyx_temp[2] = {__pyx_t_33, __pyx_t_9};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_40, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_40)) {
            PyObject *__pyx_temp[2] = {__pyx_t_33, __pyx_t_9};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_40, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_33); __pyx_t_33 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          } else
          #endif
          {
            __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_33); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_33); __pyx_t_33 = NULL;
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_9);
            __pyx_t_9 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
        __pyx_t_40 = PyNumber_Multiply(__pyx_t_31, __pyx_t_1); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_41);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_41);
        __Pyx_GIVEREF(__pyx_t_53);
        PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_53);
        __Pyx_GIVEREF(__pyx_t_40);
        PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_40);
        __pyx_t_41 = 0;
        __pyx_t_53 = 0;
        __pyx_t_40 = 0;
        __pyx_t_40 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_40)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_40);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (!__pyx_t_40) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_8)) {
            PyObject *__pyx_temp[2] = {__pyx_t_40, __pyx_t_1};
            __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
            PyObject *__pyx_temp[2] = {__pyx_t_40, __pyx_t_1};
            __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_53 = PyTuple_New(1+1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_53);
            __Pyx_GIVEREF(__pyx_t_40); PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_40); __pyx_t_40 = NULL;
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_53, 0+1, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_53, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1236, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1236, __pyx_L1_error)
        __pyx_t_48 = ((PyArrayObject *)__pyx_t_2);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
          __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_32 < 0)) {
            PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
            }
            __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
          }
          __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1236, __pyx_L1_error)
        }
        __pyx_t_48 = 0;
        __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
        __pyx_t_2 = 0;
      }
      __pyx_L25:;

      /* "tofu/geom/_GG03.pyx":1237
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[1]-Dphi)*np.ones((indin.sum(),))])
 *             LPts.append( pts )             # <<<<<<<<<<<<<<
 *             Lind.append( iindF + NR0*NZ0 + nRPhi0 )
 *             LdS.append( dsF )
 */
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LPts, ((PyObject *)__pyx_v_pts)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1237, __pyx_L1_error)

      /* "tofu/geom/_GG03.pyx":1238
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[1]-Dphi)*np.ones((indin.sum(),))])
 *             LPts.append( pts )
 *             Lind.append( iindF + NR0*NZ0 + nRPhi0 )             # <<<<<<<<<<<<<<
 *             LdS.append( dsF )
 * 
 */
      __pyx_t_2 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyNumber_Add(((PyObject *)__pyx_v_iindF), __pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_v_nRPhi0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_Lind, __pyx_t_2); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1238, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1239
 *             LPts.append( pts )
 *             Lind.append( iindF + NR0*NZ0 + nRPhi0 )
 *             LdS.append( dsF )             # <<<<<<<<<<<<<<
 * 
 *         # Aggregate
 */
      __pyx_t_54 = __Pyx_PyList_Append(__pyx_v_LdS, ((PyObject *)__pyx_v_dsF)); if (unlikely(__pyx_t_54 == ((int)-1))) __PYX_ERR(0, 1239, __pyx_L1_error)

      /* "tofu/geom/_GG03.pyx":1232
 * 
 *         # Second face
 *         if Faces[1]:             # <<<<<<<<<<<<<<
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])
 */
    }

    /* "tofu/geom/_GG03.pyx":1242
 * 
 *         # Aggregate
 *         if len(LPts)==1:             # <<<<<<<<<<<<<<
 *             Pts = LPts[0]
 *             ind = Lind[0]
 */
    __pyx_t_36 = PyList_GET_SIZE(__pyx_v_LPts); if (unlikely(__pyx_t_36 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1242, __pyx_L1_error)
    __pyx_t_22 = ((__pyx_t_36 == 1) != 0);
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1243
 *         # Aggregate
 *         if len(LPts)==1:
 *             Pts = LPts[0]             # <<<<<<<<<<<<<<
 *             ind = Lind[0]
 *             dS = LdS[0]
 */
      if (!(likely(((PyList_GET_ITEM(__pyx_v_LPts, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_LPts, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1243, __pyx_L1_error)
      __pyx_t_2 = PyList_GET_ITEM(__pyx_v_LPts, 0);
      __Pyx_INCREF(__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
          }
          __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1243, __pyx_L1_error)
      }
      __pyx_v_Pts = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1244
 *         if len(LPts)==1:
 *             Pts = LPts[0]
 *             ind = Lind[0]             # <<<<<<<<<<<<<<
 *             dS = LdS[0]
 *         else:
 */
      if (!(likely(((PyList_GET_ITEM(__pyx_v_Lind, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_Lind, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1244, __pyx_L1_error)
      __pyx_t_2 = PyList_GET_ITEM(__pyx_v_Lind, 0);
      __Pyx_INCREF(__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
          }
          __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
        }
        __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1244, __pyx_L1_error)
      }
      __pyx_v_ind = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1245
 *             Pts = LPts[0]
 *             ind = Lind[0]
 *             dS = LdS[0]             # <<<<<<<<<<<<<<
 *         else:
 *             Pts = np.concatenate(tuple(LPts),axis=1)
 */
      if (!(likely(((PyList_GET_ITEM(__pyx_v_LdS, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_LdS, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1245, __pyx_L1_error)
      __pyx_t_2 = PyList_GET_ITEM(__pyx_v_LdS, 0);
      __Pyx_INCREF(__pyx_t_2);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
          }
          __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
        }
        __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1245, __pyx_L1_error)
      }
      __pyx_v_dS = ((PyArrayObject *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1242
 * 
 *         # Aggregate
 *         if len(LPts)==1:             # <<<<<<<<<<<<<<
 *             Pts = LPts[0]
 *             ind = Lind[0]
 */
      goto __pyx_L26;
    }

    /* "tofu/geom/_GG03.pyx":1247
 *             dS = LdS[0]
 *         else:
 *             Pts = np.concatenate(tuple(LPts),axis=1)             # <<<<<<<<<<<<<<
 *             ind = np.concatenate(tuple(Lind)).astype(int)
 *             dS = np.concatenate(tuple(LdS))
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyList_AsTuple(__pyx_v_LPts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_53 = PyTuple_New(1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_53);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 1247, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_53, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1247, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1247, __pyx_L1_error)
      __pyx_t_48 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
          }
          __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
        }
        __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1247, __pyx_L1_error)
      }
      __pyx_t_48 = 0;
      __pyx_v_Pts = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":1248
 *         else:
 *             Pts = np.concatenate(tuple(LPts),axis=1)
 *             ind = np.concatenate(tuple(Lind)).astype(int)             # <<<<<<<<<<<<<<
 *             dS = np.concatenate(tuple(LdS))
 * 
 */
      __pyx_t_53 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_53);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_53, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
      __pyx_t_53 = PyList_AsTuple(__pyx_v_Lind); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_53);
      __pyx_t_40 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_40 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_40)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_40);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_40) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_53); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_40, __pyx_t_53};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_40, __pyx_t_53};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(1+1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __Pyx_GIVEREF(__pyx_t_40); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_40); __pyx_t_40 = NULL;
          __Pyx_GIVEREF(__pyx_t_53);
          PyTuple_SET_ITEM(__pyx_t_41, 0+1, __pyx_t_53);
          __pyx_t_53 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_41, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_astype); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1248, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)(&PyInt_Type))};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_41 = PyTuple_New(1+1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_41);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_41, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_INCREF(((PyObject *)(&PyInt_Type)));
          __Pyx_GIVEREF(((PyObject *)(&PyInt_Type)));
          PyTuple_SET_ITEM(__pyx_t_41, 0+1, ((PyObject *)(&PyInt_Type)));
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_41, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1248, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1248, __pyx_L1_error)
      __pyx_t_47 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
          }
          __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
        }
        __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1248, __pyx_L1_error)
      }
      __pyx_t_47 = 0;
      __pyx_v_ind = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":1249
 *             Pts = np.concatenate(tuple(LPts),axis=1)
 *             ind = np.concatenate(tuple(Lind)).astype(int)
 *             dS = np.concatenate(tuple(LdS))             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_41);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyList_AsTuple(__pyx_v_LdS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1249, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_41))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_41);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_41);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_41, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_41, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_8};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_41, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_41)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_8};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_41, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_53 = PyTuple_New(1+1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1249, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_53);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_53, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_53, 0+1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_t_53, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1249, __pyx_L1_error)
      __pyx_t_42 = ((PyArrayObject *)__pyx_t_1);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
        __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
        if (unlikely(__pyx_t_32 < 0)) {
          PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
          }
          __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
        }
        __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
        if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1249, __pyx_L1_error)
      }
      __pyx_t_42 = 0;
      __pyx_v_dS = ((PyArrayObject *)__pyx_t_1);
      __pyx_t_1 = 0;
    }
    __pyx_L26:;

    /* "tofu/geom/_GG03.pyx":1183
 *     Inter, Bounds, Faces = _getBoundsInter2AngSeg(Full, PhiMinMax[0], PhiMinMax[1], DPhi0, DPhi1)
 * 
 *     if Inter:             # <<<<<<<<<<<<<<
 *         BC = list(Bounds)
 *         nBounds = len(Bounds)
 */
    goto __pyx_L7;
  }

  /* "tofu/geom/_GG03.pyx":1252
 * 
 *     else:
 *         Pts, dS, ind, NL, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.nan*np.ones((VPoly.shape[1]-1,))             # <<<<<<<<<<<<<<
 *         dLr, dR0r, dZ0r, dRPhir, VPbis = np.ones((0,)), 0., 0., np.ones((0,)), np.asarray(VPoly)
 * 
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_41 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_41, __pyx_tuple__178, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_41 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __pyx_t_53 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_ones); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_53);
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    __pyx_t_41 = __Pyx_PyObject_Call(__pyx_t_53, __pyx_tuple__180, NULL); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    if (!(likely(((__pyx_t_41) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_41, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_53 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_53);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_53, __pyx_n_s_ones); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    __pyx_t_53 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_53);
    if (PyDict_SetItem(__pyx_t_53, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__182, __pyx_t_53); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_53 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_53);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_53, __pyx_n_s_ones); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    __pyx_t_53 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_53);
    if (PyDict_SetItem(__pyx_t_53, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__184, __pyx_t_53); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_40);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_53 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_53);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_53, __pyx_n_s_nan); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    __pyx_t_31 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_31);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_31, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
    __pyx_t_31 = PyInt_FromSsize_t(((__pyx_v_VPoly.shape[1]) - 1)); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_31);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_31);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_31);
    __pyx_t_31 = 0;
    __pyx_t_31 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_31)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_31);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_31) {
      __pyx_t_53 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_53);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_9};
        __pyx_t_53 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
        __Pyx_GOTREF(__pyx_t_53);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_31, __pyx_t_9};
        __pyx_t_53 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_31); __pyx_t_31 = 0;
        __Pyx_GOTREF(__pyx_t_53);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_33 = PyTuple_New(1+1); if (unlikely(!__pyx_t_33)) __PYX_ERR(0, 1252, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_33);
        __Pyx_GIVEREF(__pyx_t_31); PyTuple_SET_ITEM(__pyx_t_33, 0, __pyx_t_31); __pyx_t_31 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_33, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_53 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_33, NULL); if (unlikely(!__pyx_t_53)) __PYX_ERR(0, 1252, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_53);
        __Pyx_DECREF(__pyx_t_33); __pyx_t_33 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Multiply(__pyx_t_8, __pyx_t_53); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1252, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_53); __pyx_t_53 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1252, __pyx_L1_error)
    __pyx_t_48 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
    }
    __pyx_t_48 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_41);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_41);
    __pyx_t_41 = 0;
    __pyx_t_47 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
    }
    __pyx_t_47 = 0;
    __pyx_v_ind = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_47 = ((PyArrayObject *)__pyx_t_40);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
    }
    __pyx_t_47 = 0;
    __pyx_v_NL = ((PyArrayObject *)__pyx_t_40);
    __pyx_t_40 = 0;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1252, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_Rref = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1253
 *     else:
 *         Pts, dS, ind, NL, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.nan*np.ones((VPoly.shape[1]-1,))
 *         dLr, dR0r, dZ0r, dRPhir, VPbis = np.ones((0,)), 0., 0., np.ones((0,)), np.asarray(VPoly)             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dS, ind, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_40 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_40);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_40, __pyx_tuple__186, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1253, __pyx_L1_error)
    __pyx_t_26 = 0.;
    __pyx_t_27 = 0.;
    __pyx_t_40 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_40);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_40, __pyx_n_s_ones); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
    __pyx_t_40 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__188, NULL); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_40);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_40) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_40, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1253, __pyx_L1_error)
    __pyx_t_41 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_41, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
    __pyx_t_41 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 1253, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_41);
    __pyx_t_53 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_53 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_53)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_53);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_53) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_41); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_53, __pyx_t_41};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_53, __pyx_t_41};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_53); __pyx_t_53 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_53); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_53); __pyx_t_53 = NULL;
        __Pyx_GIVEREF(__pyx_t_41);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_41);
        __pyx_t_41 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1253, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1253, __pyx_L1_error)
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1253, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_dLr = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_dR0r = __pyx_t_26;
    __pyx_v_dZ0r = __pyx_t_27;
    __pyx_t_42 = ((PyArrayObject *)__pyx_t_40);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_46, &__pyx_t_45, &__pyx_t_44);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_v_dRPhir, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_46); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_44);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_46, __pyx_t_45, __pyx_t_44);
        }
        __pyx_t_46 = __pyx_t_45 = __pyx_t_44 = 0;
      }
      __pyx_pybuffernd_dRPhir.diminfo[0].strides = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dRPhir.diminfo[0].shape = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1253, __pyx_L1_error)
    }
    __pyx_t_42 = 0;
    __pyx_v_dRPhir = ((PyArrayObject *)__pyx_t_40);
    __pyx_t_40 = 0;
    __pyx_t_48 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
      __pyx_t_32 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_48, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_32 < 0)) {
        PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46);
        }
        __pyx_t_44 = __pyx_t_45 = __pyx_t_46 = 0;
      }
      __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_32 < 0)) __PYX_ERR(0, 1253, __pyx_L1_error)
    }
    __pyx_t_48 = 0;
    __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L7:;

  /* "tofu/geom/_GG03.pyx":1255
 *         dLr, dR0r, dZ0r, dRPhir, VPbis = np.ones((0,)), 0., 0., np.ones((0,)), np.asarray(VPoly)
 * 
 *     return Pts, dS, ind, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dR0r); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_40 = PyFloat_FromDouble(__pyx_v_dZ0r); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_40);
  __pyx_t_3 = PyTuple_New(10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(((PyObject *)__pyx_v_ind));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
  PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_v_ind));
  __Pyx_INCREF(((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_NL));
  PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_v_NL));
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_3, 4, ((PyObject *)__pyx_v_dLr));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
  PyTuple_SET_ITEM(__pyx_t_3, 5, ((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_40);
  PyTuple_SET_ITEM(__pyx_t_3, 7, __pyx_t_40);
  __Pyx_INCREF(((PyObject *)__pyx_v_dRPhir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dRPhir));
  PyTuple_SET_ITEM(__pyx_t_3, 8, ((PyObject *)__pyx_v_dRPhir));
  __Pyx_INCREF(((PyObject *)__pyx_v_VPbis));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_VPbis));
  PyTuple_SET_ITEM(__pyx_t_3, 9, ((PyObject *)__pyx_v_VPbis));
  __pyx_t_2 = 0;
  __pyx_t_40 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1149
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_XDECREF(__pyx_t_31);
  __Pyx_XDECREF(__pyx_t_33);
  __Pyx_XDECREF(__pyx_t_40);
  __Pyx_XDECREF(__pyx_t_41);
  __PYX_XDEC_MEMVIEW(&__pyx_t_49, 1);
  __Pyx_XDECREF(__pyx_t_53);
  __Pyx_XDECREF(__pyx_t_55);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dsF.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iindF.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indM.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_TorStruct_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dsF.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iindF.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indM.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ptsrz.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_phiMinMax, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_R0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Z0);
  __Pyx_XDECREF((PyObject *)__pyx_v_dsF);
  __Pyx_XDECREF((PyObject *)__pyx_v_dSM);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_dRPhir);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_indR0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indZ0);
  __Pyx_XDECREF((PyObject *)__pyx_v_iind);
  __Pyx_XDECREF((PyObject *)__pyx_v_iindF);
  __Pyx_XDECREF((PyObject *)__pyx_v_indM);
  __Pyx_XDECREF((PyObject *)__pyx_v_NL);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF((PyObject *)__pyx_v_ptsrz);
  __Pyx_XDECREF((PyObject *)__pyx_v_pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsM);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPbis);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF(__pyx_v_LPts);
  __Pyx_XDECREF(__pyx_v_LdS);
  __Pyx_XDECREF(__pyx_v_Lind);
  __Pyx_XDECREF(__pyx_v_DPhiMinMax);
  __Pyx_XDECREF(__pyx_v_DPhi0);
  __Pyx_XDECREF(__pyx_v_DPhi1);
  __Pyx_XDECREF(__pyx_v_DDPhi);
  __Pyx_XDECREF(__pyx_v_Inter);
  __Pyx_XDECREF(__pyx_v_Bounds);
  __Pyx_XDECREF(__pyx_v_Faces);
  __Pyx_XDECREF(__pyx_v_BC);
  __Pyx_XDECREF(__pyx_v_indin);
  __Pyx_XDECREF(__pyx_v_nRPhi0);
  __PYX_XDEC_MEMVIEW(&__pyx_v_PhiMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1262
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                            double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                            double DIn=0., VIn=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_39_Ves_Smesh_TorStruct_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_38_Ves_Smesh_TorStruct_SubFromInd_cython[] = " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_39_Ves_Smesh_TorStruct_SubFromInd_cython = {"_Ves_Smesh_TorStruct_SubFromInd_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_39_Ves_Smesh_TorStruct_SubFromInd_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_38_Ves_Smesh_TorStruct_SubFromInd_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_39_Ves_Smesh_TorStruct_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_PhiMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dL;
  double __pyx_v_dRPhi;
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_ind = 0;
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  PyObject *__pyx_v_Out = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_TorStruct_SubFromInd_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_PhiMinMax,&__pyx_n_s_dL,&__pyx_n_s_dRPhi,&__pyx_n_s_VPoly,&__pyx_n_s_ind,&__pyx_n_s_DIn,&__pyx_n_s_VIn,&__pyx_n_s_Out,&__pyx_n_s_margin,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":1264
 * def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, double dRPhi,
 *                                            double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                            double DIn=0., VIn=None,             # <<<<<<<<<<<<<<
 *                                            str Out='(X,Y,Z)', double margin=1.e-9):
 *     " Return the desired surfacic submesh indicated by the limits (DR,DZ,DPhi), for the desired resolution (dR,dZ,dRphi) "
 */
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject*)__pyx_kp_s_X_Y_Z);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_PhiMinMax)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromInd_cython", 0, 5, 9, 1); __PYX_ERR(0, 1262, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dRPhi)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromInd_cython", 0, 5, 9, 2); __PYX_ERR(0, 1262, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromInd_cython", 0, 5, 9, 3); __PYX_ERR(0, 1262, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromInd_cython", 0, 5, 9, 4); __PYX_ERR(0, 1262, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Out);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_TorStruct_SubFromInd_cython") < 0)) __PYX_ERR(0, 1262, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_PhiMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_PhiMinMax.memview)) __PYX_ERR(0, 1262, __pyx_L3_error)
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1262, __pyx_L3_error)
    __pyx_v_dRPhi = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dRPhi == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1262, __pyx_L3_error)
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 1263, __pyx_L3_error)
    __pyx_v_ind = ((PyArrayObject *)values[4]);
    if (values[5]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1264, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[6];
    __pyx_v_Out = ((PyObject*)values[7]);
    if (values[8]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1265, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_TorStruct_SubFromInd_cython", 0, 5, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1262, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_TorStruct_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(0, 1263, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Out), (&PyString_Type), 1, "Out", 1))) __PYX_ERR(0, 1265, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_38_Ves_Smesh_TorStruct_SubFromInd_cython(__pyx_self, __pyx_v_PhiMinMax, __pyx_v_dL, __pyx_v_dRPhi, __pyx_v_VPoly, __pyx_v_ind, __pyx_v_DIn, __pyx_v_VIn, __pyx_v_Out, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":1262
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                            double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                            double DIn=0., VIn=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_38_Ves_Smesh_TorStruct_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_PhiMinMax, double __pyx_v_dL, double __pyx_v_dRPhi, __Pyx_memviewslice __pyx_v_VPoly, PyArrayObject *__pyx_v_ind, double __pyx_v_DIn, PyObject *__pyx_v_VIn, PyObject *__pyx_v_Out, double __pyx_v_margin) {
  double __pyx_v_Dphi;
  double __pyx_v_dR0r;
  double __pyx_v_dZ0r;
  int __pyx_v_NR0;
  int __pyx_v_NZ0;
  __Pyx_memviewslice __pyx_v_phiMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_R0 = 0;
  PyArrayObject *__pyx_v_Z0 = 0;
  PyArrayObject *__pyx_v_dSM = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_dRPhir = 0;
  PyArrayObject *__pyx_v_dS = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_bla = 0;
  PyArrayObject *__pyx_v_indR0 = 0;
  PyArrayObject *__pyx_v_indZ0 = 0;
  CYTHON_UNUSED PyArrayObject *__pyx_v_indM = 0;
  PyArrayObject *__pyx_v_NL = 0;
  PyArrayObject *__pyx_v_pts = 0;
  PyArrayObject *__pyx_v_PtsM = 0;
  PyArrayObject *__pyx_v_VPbis = 0;
  PyArrayObject *__pyx_v_Pts = 0;
  PyObject *__pyx_v_LPts = 0;
  PyObject *__pyx_v_LdS = 0;
  CYTHON_UNUSED PyObject *__pyx_v_Lind = 0;
  CYTHON_UNUSED PyObject *__pyx_v_nRPhi0 = NULL;
  PyObject *__pyx_v_ii = NULL;
  Py_ssize_t __pyx_v_nii;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_NL;
  __Pyx_Buffer __pyx_pybuffer_NL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsM;
  __Pyx_Buffer __pyx_pybuffer_PtsM;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_R0;
  __Pyx_Buffer __pyx_pybuffer_R0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPbis;
  __Pyx_Buffer __pyx_pybuffer_VPbis;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Z0;
  __Pyx_Buffer __pyx_pybuffer_Z0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_bla;
  __Pyx_Buffer __pyx_pybuffer_bla;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dRPhir;
  __Pyx_Buffer __pyx_pybuffer_dRPhir;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dSM;
  __Pyx_Buffer __pyx_pybuffer_dSM;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indM;
  __Pyx_Buffer __pyx_pybuffer_indM;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indR0;
  __Pyx_Buffer __pyx_pybuffer_indR0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indZ0;
  __Pyx_Buffer __pyx_pybuffer_indZ0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pts;
  __Pyx_Buffer __pyx_pybuffer_pts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  double __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *(*__pyx_t_17)(PyObject *);
  int __pyx_t_18;
  PyArrayObject *__pyx_t_19 = NULL;
  int __pyx_t_20;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyArrayObject *__pyx_t_24 = NULL;
  PyObject *__pyx_t_25 = NULL;
  PyObject *__pyx_t_26 = NULL;
  PyArrayObject *__pyx_t_27 = NULL;
  Py_ssize_t __pyx_t_28;
  int __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  int __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  __Pyx_RefNannySetupContext("_Ves_Smesh_TorStruct_SubFromInd_cython", 0);
  __pyx_pybuffer_R0.pybuffer.buf = NULL;
  __pyx_pybuffer_R0.refcount = 0;
  __pyx_pybuffernd_R0.data = NULL;
  __pyx_pybuffernd_R0.rcbuffer = &__pyx_pybuffer_R0;
  __pyx_pybuffer_Z0.pybuffer.buf = NULL;
  __pyx_pybuffer_Z0.refcount = 0;
  __pyx_pybuffernd_Z0.data = NULL;
  __pyx_pybuffernd_Z0.rcbuffer = &__pyx_pybuffer_Z0;
  __pyx_pybuffer_dSM.pybuffer.buf = NULL;
  __pyx_pybuffer_dSM.refcount = 0;
  __pyx_pybuffernd_dSM.data = NULL;
  __pyx_pybuffernd_dSM.rcbuffer = &__pyx_pybuffer_dSM;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_dRPhir.pybuffer.buf = NULL;
  __pyx_pybuffer_dRPhir.refcount = 0;
  __pyx_pybuffernd_dRPhir.data = NULL;
  __pyx_pybuffernd_dRPhir.rcbuffer = &__pyx_pybuffer_dRPhir;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_bla.pybuffer.buf = NULL;
  __pyx_pybuffer_bla.refcount = 0;
  __pyx_pybuffernd_bla.data = NULL;
  __pyx_pybuffernd_bla.rcbuffer = &__pyx_pybuffer_bla;
  __pyx_pybuffer_indR0.pybuffer.buf = NULL;
  __pyx_pybuffer_indR0.refcount = 0;
  __pyx_pybuffernd_indR0.data = NULL;
  __pyx_pybuffernd_indR0.rcbuffer = &__pyx_pybuffer_indR0;
  __pyx_pybuffer_indZ0.pybuffer.buf = NULL;
  __pyx_pybuffer_indZ0.refcount = 0;
  __pyx_pybuffernd_indZ0.data = NULL;
  __pyx_pybuffernd_indZ0.rcbuffer = &__pyx_pybuffer_indZ0;
  __pyx_pybuffer_indM.pybuffer.buf = NULL;
  __pyx_pybuffer_indM.refcount = 0;
  __pyx_pybuffernd_indM.data = NULL;
  __pyx_pybuffernd_indM.rcbuffer = &__pyx_pybuffer_indM;
  __pyx_pybuffer_NL.pybuffer.buf = NULL;
  __pyx_pybuffer_NL.refcount = 0;
  __pyx_pybuffernd_NL.data = NULL;
  __pyx_pybuffernd_NL.rcbuffer = &__pyx_pybuffer_NL;
  __pyx_pybuffer_pts.pybuffer.buf = NULL;
  __pyx_pybuffer_pts.refcount = 0;
  __pyx_pybuffernd_pts.data = NULL;
  __pyx_pybuffernd_pts.rcbuffer = &__pyx_pybuffer_pts;
  __pyx_pybuffer_PtsM.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsM.refcount = 0;
  __pyx_pybuffernd_PtsM.data = NULL;
  __pyx_pybuffernd_PtsM.rcbuffer = &__pyx_pybuffer_PtsM;
  __pyx_pybuffer_VPbis.pybuffer.buf = NULL;
  __pyx_pybuffer_VPbis.refcount = 0;
  __pyx_pybuffernd_VPbis.data = NULL;
  __pyx_pybuffernd_VPbis.rcbuffer = &__pyx_pybuffer_VPbis;
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1262, __pyx_L1_error)
  }
  __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];

  /* "tofu/geom/_GG03.pyx":1269
 *     cdef double Dphi, dR0r, dZ0r
 *     cdef int NR0, NZ0, R0n, Z0n, NRPhi0
 *     cdef double[::1] phiMinMax = np.array([Catan2(Csin(PhiMinMax[0]),Ccos(PhiMinMax[0])), Catan2(Csin(PhiMinMax[1]),Ccos(PhiMinMax[1]))])             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double, ndim=1] R0, Z0, dsF, dSM, dLr, Rref, dRPhir, dS
 *     cdef cnp.ndarray[long,ndim=1] bla, indR0, indZ0, iind, iindF, indM, NL
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_2 = PyFloat_FromDouble(atan2(sin((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_4)) )))), cos((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_5)) )))))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = 1;
  __pyx_t_7 = 1;
  __pyx_t_8 = PyFloat_FromDouble(atan2(sin((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_6)) )))), cos((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_PhiMinMax.data) + __pyx_t_7)) )))))); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
  __pyx_t_2 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1269, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1269, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_phiMinMax = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "tofu/geom/_GG03.pyx":1273
 *     cdef cnp.ndarray[long,ndim=1] bla, indR0, indZ0, iind, iindF, indM, NL
 *     cdef cnp.ndarray[double,ndim=2] ptsrz, pts, PtsM, VPbis, Pts
 *     cdef list LPts=[], LdS=[], Lind=[]             # <<<<<<<<<<<<<<
 * 
 *     # Pre-format input
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LPts = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_LdS = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_Lind = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1276
 * 
 *     # Pre-format input
 *     Dphi = DIn/np.max(VPoly[0,:]) if DIn!=0. else 0. # Required distance effective at max R             # <<<<<<<<<<<<<<
 * 
 *     # Get the basic meshes for the faces
 */
  if (((__pyx_v_DIn != 0.) != 0)) {
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_max); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10.data = __pyx_v_VPoly.data;
    __pyx_t_10.memview = __pyx_v_VPoly.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1276, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
    __pyx_t_10.memview = NULL;
    __pyx_t_10.data = NULL;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1276, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1276, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1276, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11 = __pyx_t_13;
  } else {
    __pyx_t_11 = 0.;
  }
  __pyx_v_Dphi = __pyx_t_11;

  /* "tofu/geom/_GG03.pyx":1279
 * 
 *     # Get the basic meshes for the faces
 *     R0, dR0r, bla, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Z0, dZ0r, bla, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin)
 * 
 */
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_min); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10.data = __pyx_v_VPoly.data;
  __pyx_t_10.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1279, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_14) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_max); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_10.data = __pyx_v_VPoly.data;
  __pyx_t_10.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1279, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_15 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_14) {
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_15};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_15};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL;
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_16, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
  __pyx_t_1 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_12);
  __pyx_t_3 = 0;
  __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 1279, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1279, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_2);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_1,&__pyx_t_9,&__pyx_t_2};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1279, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_12,&__pyx_t_1,&__pyx_t_9,&__pyx_t_2};
    __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1279, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_17 = Py_TYPE(__pyx_t_8)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_17(__pyx_t_8); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_8), 4) < 0) __PYX_ERR(0, 1279, __pyx_L1_error)
    __pyx_t_17 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_17 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1279, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1279, __pyx_L1_error)
  __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1279, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
    __pyx_t_20 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_R0.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_20 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_R0.rcbuffer->pybuffer, (PyObject*)__pyx_v_R0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
    }
    __pyx_pybuffernd_R0.diminfo[0].strides = __pyx_pybuffernd_R0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_R0.diminfo[0].shape = __pyx_pybuffernd_R0.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 1279, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_R0 = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_v_dR0r = __pyx_t_11;
  __pyx_t_24 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bla.rcbuffer->pybuffer);
    __pyx_t_20 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bla.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_20 < 0)) {
      PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bla.rcbuffer->pybuffer, (PyObject*)__pyx_v_bla, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_bla.diminfo[0].strides = __pyx_pybuffernd_bla.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bla.diminfo[0].shape = __pyx_pybuffernd_bla.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 1279, __pyx_L1_error)
  }
  __pyx_t_24 = 0;
  __pyx_v_bla = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_v_NR0 = __pyx_t_18;

  /* "tofu/geom/_GG03.pyx":1280
 *     # Get the basic meshes for the faces
 *     R0, dR0r, bla, NR0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=None, Lim=True, margin=margin)
 *     Z0, dZ0r, bla, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 * 
 *     PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_min); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_10.data = __pyx_v_VPoly.data;
  __pyx_t_10.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1280, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_12 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_16) {
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_9);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_12};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_12};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_16); __pyx_t_16 = NULL;
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_15, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_max); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_10.data = __pyx_v_VPoly.data;
  __pyx_t_10.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_10, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1280, __pyx_L1_error)
    }
        __pyx_t_10.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_10.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_10.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_10.suboffsets[0] = -1;

__pyx_t_15 = __pyx_memoryview_fromslice(__pyx_t_10, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  if (!__pyx_t_16) {
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_8);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_15};
      __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_15};
      __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_16); __pyx_t_16 = NULL;
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyList_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_8);
  __pyx_t_9 = 0;
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_12};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_12};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 1280, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1280, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1280, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_12);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_9,&__pyx_t_3,&__pyx_t_12};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1280, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_9,&__pyx_t_3,&__pyx_t_12};
    __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1280, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_17 = Py_TYPE(__pyx_t_8)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_17(__pyx_t_8); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_8), 4) < 0) __PYX_ERR(0, 1280, __pyx_L1_error)
    __pyx_t_17 = NULL;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_17 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1280, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1280, __pyx_L1_error)
  __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1280, __pyx_L1_error)
  __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_t_12); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1280, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
    __pyx_t_20 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_20 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_v_Z0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
    }
    __pyx_pybuffernd_Z0.diminfo[0].strides = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Z0.diminfo[0].shape = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_Z0 = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_v_dZ0r = __pyx_t_11;
  __pyx_t_24 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bla.rcbuffer->pybuffer);
    __pyx_t_20 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bla.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_20 < 0)) {
      PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bla.rcbuffer->pybuffer, (PyObject*)__pyx_v_bla, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_bla.diminfo[0].strides = __pyx_pybuffernd_bla.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bla.diminfo[0].shape = __pyx_pybuffernd_bla.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_20 < 0)) __PYX_ERR(0, 1280, __pyx_L1_error)
  }
  __pyx_t_24 = 0;
  __Pyx_DECREF_SET(__pyx_v_bla, ((PyArrayObject *)__pyx_t_3));
  __pyx_t_3 = 0;
  __pyx_v_NZ0 = __pyx_t_18;

  /* "tofu/geom/_GG03.pyx":1282
 *     Z0, dZ0r, bla, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin)
 * 
 *     PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,             # <<<<<<<<<<<<<<
 *                                                                                            DR=None, DZ=None, DPhi=None,
 *                                                                                            DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_Smesh_Tor_SubFromD_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dRPhi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_9);
  __pyx_t_12 = 0;
  __pyx_t_3 = 0;
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":1283
 * 
 *     PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,
 *                                                                                            DR=None, DZ=None, DPhi=None,             # <<<<<<<<<<<<<<
 *                                                                                            DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 *                                                                                            Out=Out, margin=margin)
 */
  __pyx_t_9 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_DR, Py_None) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_DZ, Py_None) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_DPhi, Py_None) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1284
 *     PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,
 *                                                                                            DR=None, DZ=None, DPhi=None,
 *                                                                                            DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,             # <<<<<<<<<<<<<<
 *                                                                                            Out=Out, margin=margin)
 *     # First face
 */
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_DIn, __pyx_t_3) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_VIn, __pyx_v_VIn) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_phiMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_PhiMinMax, __pyx_t_3) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":1285
 *                                                                                            DR=None, DZ=None, DPhi=None,
 *                                                                                            DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 *                                                                                            Out=Out, margin=margin)             # <<<<<<<<<<<<<<
 *     # First face
 *     ii = (ind<NR0*NZ0).nonzero()[0]
 */
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_Out, __pyx_v_Out) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":1282
 *     Z0, dZ0r, bla, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin)
 * 
 *     PtsM, dSM, indM, NL, dLr, Rref, dRPhir, nRPhi0, VPbis = _Ves_Smesh_Tor_SubFromD_cython(dL, dRPhi, VPoly,             # <<<<<<<<<<<<<<
 *                                                                                            DR=None, DZ=None, DPhi=None,
 *                                                                                            DIn=DIn, VIn=VIn, PhiMinMax=phiMinMax,
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1282, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 9)) {
      if (size > 9) __Pyx_RaiseTooManyValuesError(9);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1282, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_14 = PyTuple_GET_ITEM(sequence, 5); 
      __pyx_t_15 = PyTuple_GET_ITEM(sequence, 6); 
      __pyx_t_16 = PyTuple_GET_ITEM(sequence, 7); 
      __pyx_t_25 = PyTuple_GET_ITEM(sequence, 8); 
    } else {
      __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_12 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_14 = PyList_GET_ITEM(sequence, 5); 
      __pyx_t_15 = PyList_GET_ITEM(sequence, 6); 
      __pyx_t_16 = PyList_GET_ITEM(sequence, 7); 
      __pyx_t_25 = PyList_GET_ITEM(sequence, 8); 
    }
    __Pyx_INCREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_12);
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_INCREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_t_16);
    __Pyx_INCREF(__pyx_t_25);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[9] = {&__pyx_t_9,&__pyx_t_1,&__pyx_t_2,&__pyx_t_12,&__pyx_t_8,&__pyx_t_14,&__pyx_t_15,&__pyx_t_16,&__pyx_t_25};
      for (i=0; i < 9; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1282, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[9] = {&__pyx_t_9,&__pyx_t_1,&__pyx_t_2,&__pyx_t_12,&__pyx_t_8,&__pyx_t_14,&__pyx_t_15,&__pyx_t_16,&__pyx_t_25};
    __pyx_t_26 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_26)) __PYX_ERR(0, 1282, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_26);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_17 = Py_TYPE(__pyx_t_26)->tp_iternext;
    for (index=0; index < 9; index++) {
      PyObject* item = __pyx_t_17(__pyx_t_26); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_26), 9) < 0) __PYX_ERR(0, 1282, __pyx_L1_error)
    __pyx_t_17 = NULL;
    __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0;
    __pyx_t_17 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1282, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  if (!(likely(((__pyx_t_25) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_25, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1282, __pyx_L1_error)
  __pyx_t_27 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsM, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
    }
    __pyx_pybuffernd_PtsM.diminfo[0].strides = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsM.diminfo[0].shape = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsM.diminfo[1].strides = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsM.diminfo[1].shape = __pyx_pybuffernd_PtsM.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_27 = 0;
  __pyx_v_PtsM = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer, (PyObject*)__pyx_v_dSM, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_dSM.diminfo[0].strides = __pyx_pybuffernd_dSM.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dSM.diminfo[0].shape = __pyx_pybuffernd_dSM.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_dSM = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_24 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indM.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indM.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indM.rcbuffer->pybuffer, (PyObject*)__pyx_v_indM, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
    }
    __pyx_pybuffernd_indM.diminfo[0].strides = __pyx_pybuffernd_indM.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indM.diminfo[0].shape = __pyx_pybuffernd_indM.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_24 = 0;
  __pyx_v_indM = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_24 = ((PyArrayObject *)__pyx_t_12);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_24 = 0;
  __pyx_v_NL = ((PyArrayObject *)__pyx_t_12);
  __pyx_t_12 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
    }
    __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_dLr = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_14);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_Rref = ((PyArrayObject *)__pyx_t_14);
  __pyx_t_14 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_15);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer, (PyObject*)__pyx_v_dRPhir, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
      }
      __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
    }
    __pyx_pybuffernd_dRPhir.diminfo[0].strides = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dRPhir.diminfo[0].shape = __pyx_pybuffernd_dRPhir.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_dRPhir = ((PyArrayObject *)__pyx_t_15);
  __pyx_t_15 = 0;
  __pyx_v_nRPhi0 = __pyx_t_16;
  __pyx_t_16 = 0;
  __pyx_t_27 = ((PyArrayObject *)__pyx_t_25);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_18 < 0)) {
      PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
      }
      __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
    }
    __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1282, __pyx_L1_error)
  }
  __pyx_t_27 = 0;
  __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_25);
  __pyx_t_25 = 0;

  /* "tofu/geom/_GG03.pyx":1287
 *                                                                                            Out=Out, margin=margin)
 *     # First face
 *     ii = (ind<NR0*NZ0).nonzero()[0]             # <<<<<<<<<<<<<<
 *     nii = len(ii)
 *     if nii>0:
 */
  __pyx_t_25 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __pyx_t_16 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_25, Py_LT); __Pyx_XGOTREF(__pyx_t_16); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
  __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_25))) {
    __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_25);
    if (likely(__pyx_t_16)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25);
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_25, function);
    }
  }
  if (__pyx_t_16) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_25, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_25); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1287, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
  __pyx_t_25 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_25);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ii = __pyx_t_25;
  __pyx_t_25 = 0;

  /* "tofu/geom/_GG03.pyx":1288
 *     # First face
 *     ii = (ind<NR0*NZ0).nonzero()[0]
 *     nii = len(ii)             # <<<<<<<<<<<<<<
 *     if nii>0:
 *         indZ0 = ind[ii] // NR0
 */
  __pyx_t_28 = PyObject_Length(__pyx_v_ii); if (unlikely(__pyx_t_28 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1288, __pyx_L1_error)
  __pyx_v_nii = __pyx_t_28;

  /* "tofu/geom/_GG03.pyx":1289
 *     ii = (ind<NR0*NZ0).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = ind[ii] // NR0
 *         indR0 = (ind[ii]-indZ0*NR0)
 */
  __pyx_t_29 = ((__pyx_v_nii > 0) != 0);
  if (__pyx_t_29) {

    /* "tofu/geom/_GG03.pyx":1290
 *     nii = len(ii)
 *     if nii>0:
 *         indZ0 = ind[ii] // NR0             # <<<<<<<<<<<<<<
 *         indR0 = (ind[ii]-indZ0*NR0)
 *         if Out.lower()=='(x,y,z)':
 */
    __pyx_t_25 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NR0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = PyNumber_FloorDivide(__pyx_t_25, __pyx_t_3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1290, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1290, __pyx_L1_error)
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_16);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_indZ0.diminfo[0].strides = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ0.diminfo[0].shape = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1290, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __pyx_v_indZ0 = ((PyArrayObject *)__pyx_t_16);
    __pyx_t_16 = 0;

    /* "tofu/geom/_GG03.pyx":1291
 *     if nii>0:
 *         indZ0 = ind[ii] // NR0
 *         indR0 = (ind[ii]-indZ0*NR0)             # <<<<<<<<<<<<<<
 *         if Out.lower()=='(x,y,z)':
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[0]+Dphi), R0[indR0]*Csin(phiMinMax[0]+Dphi), Z0[indZ0]])
 */
    __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NR0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_25 = PyNumber_Multiply(((PyObject *)__pyx_v_indZ0), __pyx_t_3); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_16, __pyx_t_25); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1291, __pyx_L1_error)
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indR0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
        }
        __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_indR0.diminfo[0].strides = __pyx_pybuffernd_indR0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indR0.diminfo[0].shape = __pyx_pybuffernd_indR0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1291, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __pyx_v_indR0 = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1292
 *         indZ0 = ind[ii] // NR0
 *         indR0 = (ind[ii]-indZ0*NR0)
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[0]+Dphi), R0[indR0]*Csin(phiMinMax[0]+Dphi), Z0[indZ0]])
 *         else:
 */
    __pyx_t_25 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_25);
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_25))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_25);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_25);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_25, function);
      }
    }
    if (__pyx_t_16) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_25, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_25); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1292, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
    __pyx_t_29 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_29 < 0)) __PYX_ERR(0, 1292, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_29) {

      /* "tofu/geom/_GG03.pyx":1293
 *         indR0 = (ind[ii]-indZ0*NR0)
 *         if Out.lower()=='(x,y,z)':
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[0]+Dphi), R0[indR0]*Csin(phiMinMax[0]+Dphi), Z0[indZ0]])             # <<<<<<<<<<<<<<
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[0]+Dphi)*np.ones((nii,))])
 */
      __pyx_t_25 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_25, __pyx_n_s_array); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_25 = PyObject_GetItem(((PyObject *)__pyx_v_R0), ((PyObject *)__pyx_v_indR0)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_30 = 0;
      __pyx_t_15 = PyFloat_FromDouble(cos(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_30)) ))) + __pyx_v_Dphi))); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_14 = PyNumber_Multiply(__pyx_t_25, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_R0), ((PyObject *)__pyx_v_indR0)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_31 = 0;
      __pyx_t_25 = PyFloat_FromDouble(sin(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_31)) ))) + __pyx_v_Dphi))); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_8 = PyNumber_Multiply(__pyx_t_15, __pyx_t_25); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_25 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_15 = PyList_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1293, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_14);
      PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_15, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_25);
      PyList_SET_ITEM(__pyx_t_15, 2, __pyx_t_25);
      __pyx_t_14 = 0;
      __pyx_t_8 = 0;
      __pyx_t_25 = 0;
      __pyx_t_25 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
        __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_16);
        if (likely(__pyx_t_25)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
          __Pyx_INCREF(__pyx_t_25);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_16, function);
        }
      }
      if (!__pyx_t_25) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[2] = {__pyx_t_25, __pyx_t_15};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
          PyObject *__pyx_temp[2] = {__pyx_t_25, __pyx_t_15};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1293, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_25); __pyx_t_25 = NULL;
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_15);
          __pyx_t_15 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1293, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1293, __pyx_L1_error)
      __pyx_t_27 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
        __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_18 < 0)) {
          PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
          }
          __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
        }
        __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1293, __pyx_L1_error)
      }
      __pyx_t_27 = 0;
      __pyx_v_pts = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "tofu/geom/_GG03.pyx":1292
 *         indZ0 = ind[ii] // NR0
 *         indR0 = (ind[ii]-indZ0*NR0)
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[0]+Dphi), R0[indR0]*Csin(phiMinMax[0]+Dphi), Z0[indZ0]])
 *         else:
 */
      goto __pyx_L10;
    }

    /* "tofu/geom/_GG03.pyx":1295
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[0]+Dphi), R0[indR0]*Csin(phiMinMax[0]+Dphi), Z0[indZ0]])
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[0]+Dphi)*np.ones((nii,))])             # <<<<<<<<<<<<<<
 *         pts = pts if nii>1 else pts.reshape((3,1))
 *         LPts.append( pts )
 */
    /*else*/ {
      __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_R0), ((PyObject *)__pyx_v_indR0)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_32 = 0;
      __pyx_t_25 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_32)) ))) + __pyx_v_Dphi)); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_ones); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyInt_FromSsize_t(__pyx_v_nii); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1295, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_1};
          __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_1};
          __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_12); __pyx_t_12 = NULL;
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_25, __pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyList_New(3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_16);
      PyList_SET_ITEM(__pyx_t_14, 0, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_14, 1, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_14, 2, __pyx_t_2);
      __pyx_t_16 = 0;
      __pyx_t_15 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_14};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else
        #endif
        {
          __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_14);
          __pyx_t_14 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1295, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1295, __pyx_L1_error)
      __pyx_t_27 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
        __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_18 < 0)) {
          PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
          }
          __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
        }
        __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1295, __pyx_L1_error)
      }
      __pyx_t_27 = 0;
      __pyx_v_pts = ((PyArrayObject *)__pyx_t_3);
      __pyx_t_3 = 0;
    }
    __pyx_L10:;

    /* "tofu/geom/_GG03.pyx":1296
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[0]+Dphi)*np.ones((nii,))])
 *         pts = pts if nii>1 else pts.reshape((3,1))             # <<<<<<<<<<<<<<
 *         LPts.append( pts )
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )
 */
    if (((__pyx_v_nii > 1) != 0)) {
      __Pyx_INCREF(((PyObject *)__pyx_v_pts));
      __pyx_t_3 = ((PyObject *)__pyx_v_pts);
    } else {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pts), __pyx_n_s_reshape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__190, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1296, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1296, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_15;
      __pyx_t_15 = 0;
    }
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1296, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1297
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[0]+Dphi)*np.ones((nii,))])
 *         pts = pts if nii>1 else pts.reshape((3,1))
 *         LPts.append( pts )             # <<<<<<<<<<<<<<
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )
 * 
 */
    __pyx_t_33 = __Pyx_PyList_Append(__pyx_v_LPts, ((PyObject *)__pyx_v_pts)); if (unlikely(__pyx_t_33 == ((int)-1))) __PYX_ERR(0, 1297, __pyx_L1_error)

    /* "tofu/geom/_GG03.pyx":1298
 *         pts = pts if nii>1 else pts.reshape((3,1))
 *         LPts.append( pts )
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )             # <<<<<<<<<<<<<<
 * 
 *     # Main body
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_dR0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_ones); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_nii); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1298, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_15);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
        __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1298, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
        __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1298, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_16, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyNumber_Multiply(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_33 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_14); if (unlikely(__pyx_t_33 == ((int)-1))) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

    /* "tofu/geom/_GG03.pyx":1289
 *     ii = (ind<NR0*NZ0).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = ind[ii] // NR0
 *         indR0 = (ind[ii]-indZ0*NR0)
 */
  }

  /* "tofu/geom/_GG03.pyx":1301
 * 
 *     # Main body
 *     ii = (ind>=NR0*NZ0) & (ind<NR0*NZ0+PtsM.shape[1])             # <<<<<<<<<<<<<<
 *     nii = len(ii)
 *     if nii>0:
 */
  __pyx_t_14 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_14, Py_GE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyInt_From_Py_intptr_t(((__pyx_v_NR0 * __pyx_v_NZ0) + (__pyx_v_PtsM->dimensions[1]))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = PyNumber_And(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1301, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_ii, __pyx_t_14);
  __pyx_t_14 = 0;

  /* "tofu/geom/_GG03.pyx":1302
 *     # Main body
 *     ii = (ind>=NR0*NZ0) & (ind<NR0*NZ0+PtsM.shape[1])
 *     nii = len(ii)             # <<<<<<<<<<<<<<
 *     if nii>0:
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))
 */
  __pyx_t_28 = PyObject_Length(__pyx_v_ii); if (unlikely(__pyx_t_28 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1302, __pyx_L1_error)
  __pyx_v_nii = __pyx_t_28;

  /* "tofu/geom/_GG03.pyx":1303
 *     ii = (ind>=NR0*NZ0) & (ind<NR0*NZ0+PtsM.shape[1])
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )
 */
  __pyx_t_29 = ((__pyx_v_nii > 0) != 0);
  if (__pyx_t_29) {

    /* "tofu/geom/_GG03.pyx":1304
 *     nii = len(ii)
 *     if nii>0:
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))             # <<<<<<<<<<<<<<
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )
 *         LdS.append( dSM[ind[ii]-NR0*NZ0] )
 */
    if (((__pyx_v_nii > 1) != 0)) {
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_15 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = PyNumber_Subtract(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_slice__191);
      __Pyx_GIVEREF(__pyx_slice__191);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_slice__191);
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_PtsM), __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1304, __pyx_L1_error)
      __pyx_t_14 = __pyx_t_16;
      __pyx_t_16 = 0;
    } else {
      __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_15 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_3 = PyNumber_Subtract(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_slice__192);
      __Pyx_GIVEREF(__pyx_slice__192);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_slice__192);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_PtsM), __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_reshape); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_tuple__194, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1304, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1304, __pyx_L1_error)
      __pyx_t_14 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_14), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
        }
        __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1304, __pyx_L1_error)
    }
    __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_14));
    __pyx_t_14 = 0;

    /* "tofu/geom/_GG03.pyx":1305
 *     if nii>0:
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )             # <<<<<<<<<<<<<<
 *         LdS.append( dSM[ind[ii]-NR0*NZ0] )
 * 
 */
    __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_slice__195);
    __Pyx_GIVEREF(__pyx_slice__195);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__195);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_15);
    __pyx_t_15 = 0;
    __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_PtsM), __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_33 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_15); if (unlikely(__pyx_t_33 == ((int)-1))) __PYX_ERR(0, 1305, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

    /* "tofu/geom/_GG03.pyx":1306
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )
 *         LdS.append( dSM[ind[ii]-NR0*NZ0] )             # <<<<<<<<<<<<<<
 * 
 *     # Second face
 */
    __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_NR0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = PyNumber_Subtract(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_dSM), __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_33 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_3); if (unlikely(__pyx_t_33 == ((int)-1))) __PYX_ERR(0, 1306, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1303
 *     ii = (ind>=NR0*NZ0) & (ind<NR0*NZ0+PtsM.shape[1])
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )
 */
  }

  /* "tofu/geom/_GG03.pyx":1309
 * 
 *     # Second face
 *     ii = (ind >= NR0*NZ0+PtsM.shape[1] ).nonzero()[0]             # <<<<<<<<<<<<<<
 *     nii = len(ii)
 *     if nii>0:
 */
  __pyx_t_14 = __Pyx_PyInt_From_Py_intptr_t(((__pyx_v_NR0 * __pyx_v_NZ0) + (__pyx_v_PtsM->dimensions[1]))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_14, Py_GE); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_15)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
    }
  }
  if (__pyx_t_15) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1309, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1309, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_ii, __pyx_t_14);
  __pyx_t_14 = 0;

  /* "tofu/geom/_GG03.pyx":1310
 *     # Second face
 *     ii = (ind >= NR0*NZ0+PtsM.shape[1] ).nonzero()[0]
 *     nii = len(ii)             # <<<<<<<<<<<<<<
 *     if nii>0:
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0
 */
  __pyx_t_28 = PyObject_Length(__pyx_v_ii); if (unlikely(__pyx_t_28 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1310, __pyx_L1_error)
  __pyx_v_nii = __pyx_t_28;

  /* "tofu/geom/_GG03.pyx":1311
 *     ii = (ind >= NR0*NZ0+PtsM.shape[1] ).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0
 */
  __pyx_t_29 = ((__pyx_v_nii > 0) != 0);
  if (__pyx_t_29) {

    /* "tofu/geom/_GG03.pyx":1312
 *     nii = len(ii)
 *     if nii>0:
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0             # <<<<<<<<<<<<<<
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0
 *         if Out.lower()=='(x,y,z)':
 */
    __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(((__pyx_v_NR0 * __pyx_v_NZ0) + (__pyx_v_PtsM->dimensions[1]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NR0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = PyNumber_FloorDivide(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1312, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_14) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_14, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1312, __pyx_L1_error)
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_14);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_indZ0.diminfo[0].strides = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ0.diminfo[0].shape = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1312, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __Pyx_XDECREF_SET(__pyx_v_indZ0, ((PyArrayObject *)__pyx_t_14));
    __pyx_t_14 = 0;

    /* "tofu/geom/_GG03.pyx":1313
 *     if nii>0:
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0             # <<<<<<<<<<<<<<
 *         if Out.lower()=='(x,y,z)':
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[1]-Dphi), R0[indR0]*Csin(phiMinMax[1]-Dphi), Z0[indZ0]])
 */
    __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_ind), __pyx_v_ii); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t(((__pyx_v_NR0 * __pyx_v_NZ0) + (__pyx_v_PtsM->dimensions[1]))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = PyNumber_Subtract(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_NR0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = PyNumber_Multiply(((PyObject *)__pyx_v_indZ0), __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1313, __pyx_L1_error)
    __pyx_t_24 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indR0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
        }
        __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_indR0.diminfo[0].strides = __pyx_pybuffernd_indR0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indR0.diminfo[0].shape = __pyx_pybuffernd_indR0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1313, __pyx_L1_error)
    }
    __pyx_t_24 = 0;
    __Pyx_XDECREF_SET(__pyx_v_indR0, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1314
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[1]-Dphi), R0[indR0]*Csin(phiMinMax[1]-Dphi), Z0[indZ0]])
 *         else:
 */
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_Out, __pyx_n_s_lower); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1314, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    if (__pyx_t_15) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_15); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1314, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_29 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_kp_s_x_y_z, Py_EQ)); if (unlikely(__pyx_t_29 < 0)) __PYX_ERR(0, 1314, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_29) {

      /* "tofu/geom/_GG03.pyx":1315
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0
 *         if Out.lower()=='(x,y,z)':
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[1]-Dphi), R0[indR0]*Csin(phiMinMax[1]-Dphi), Z0[indZ0]])             # <<<<<<<<<<<<<<
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[1]-Dphi)*np.ones((nii,))])
 */
      __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_array); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_R0), ((PyObject *)__pyx_v_indR0)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_34 = 1;
      __pyx_t_16 = PyFloat_FromDouble(cos(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_34)) ))) - __pyx_v_Dphi))); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_14, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_R0), ((PyObject *)__pyx_v_indR0)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_35 = 1;
      __pyx_t_14 = PyFloat_FromDouble(sin(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_35)) ))) - __pyx_v_Dphi))); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_8 = PyNumber_Multiply(__pyx_t_16, __pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_16 = PyList_New(3); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_16, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_16, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_14);
      PyList_SET_ITEM(__pyx_t_16, 2, __pyx_t_14);
      __pyx_t_2 = 0;
      __pyx_t_8 = 0;
      __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      if (!__pyx_t_14) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1315, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_15)) {
          PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_16};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1315, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
          PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_16};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1315, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1315, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_14); __pyx_t_14 = NULL;
          __Pyx_GIVEREF(__pyx_t_16);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_16);
          __pyx_t_16 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1315, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1315, __pyx_L1_error)
      __pyx_t_27 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
        __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_18 < 0)) {
          PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
          }
          __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
        }
        __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1315, __pyx_L1_error)
      }
      __pyx_t_27 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_3));
      __pyx_t_3 = 0;

      /* "tofu/geom/_GG03.pyx":1314
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0
 *         if Out.lower()=='(x,y,z)':             # <<<<<<<<<<<<<<
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[1]-Dphi), R0[indR0]*Csin(phiMinMax[1]-Dphi), Z0[indZ0]])
 *         else:
 */
      goto __pyx_L13;
    }

    /* "tofu/geom/_GG03.pyx":1317
 *             pts = np.array([R0[indR0]*Ccos(phiMinMax[1]-Dphi), R0[indR0]*Csin(phiMinMax[1]-Dphi), Z0[indZ0]])
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[1]-Dphi)*np.ones((nii,))])             # <<<<<<<<<<<<<<
 *         pts = pts if nii>1 else pts.reshape((3,1))
 *         LPts.append( pts )
 */
    /*else*/ {
      __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_R0), ((PyObject *)__pyx_v_indR0)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_16 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_36 = 1;
      __pyx_t_14 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_phiMinMax.data) + __pyx_t_36)) ))) - __pyx_v_Dphi)); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_25 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_25, __pyx_n_s_ones); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_25); __pyx_t_25 = 0;
      __pyx_t_25 = PyInt_FromSsize_t(__pyx_v_nii); if (unlikely(!__pyx_t_25)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_25);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_25);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_25);
      __pyx_t_25 = 0;
      __pyx_t_25 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_25)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_25);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_25) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_25, __pyx_t_1};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_25, __pyx_t_1};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_25); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_25); __pyx_t_25 = NULL;
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = PyNumber_Multiply(__pyx_t_14, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1317, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_15);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_16);
      PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_9);
      PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
      __pyx_t_15 = 0;
      __pyx_t_16 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_2};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_2};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1317, __pyx_L1_error)
      __pyx_t_27 = ((PyArrayObject *)__pyx_t_3);
      {
        __Pyx_BufFmt_StackElem __pyx_stack[1];
        __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
        __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
        if (unlikely(__pyx_t_18 < 0)) {
          PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
          if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
            Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
            __Pyx_RaiseBufferFallbackError();
          } else {
            PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
          }
          __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
        }
        __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
        if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1317, __pyx_L1_error)
      }
      __pyx_t_27 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_3));
      __pyx_t_3 = 0;
    }
    __pyx_L13:;

    /* "tofu/geom/_GG03.pyx":1318
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[1]-Dphi)*np.ones((nii,))])
 *         pts = pts if nii>1 else pts.reshape((3,1))             # <<<<<<<<<<<<<<
 *         LPts.append( pts )
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )
 */
    if (((__pyx_v_nii > 1) != 0)) {
      __Pyx_INCREF(((PyObject *)__pyx_v_pts));
      __pyx_t_3 = ((PyObject *)__pyx_v_pts);
    } else {
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_pts), __pyx_n_s_reshape); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__197, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_16) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_16, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1318, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_16;
      __pyx_t_16 = 0;
    }
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_3), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1318, __pyx_L1_error)
    }
    __Pyx_DECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1319
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[1]-Dphi)*np.ones((nii,))])
 *         pts = pts if nii>1 else pts.reshape((3,1))
 *         LPts.append( pts )             # <<<<<<<<<<<<<<
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )
 * 
 */
    __pyx_t_33 = __Pyx_PyList_Append(__pyx_v_LPts, ((PyObject *)__pyx_v_pts)); if (unlikely(__pyx_t_33 == ((int)-1))) __PYX_ERR(0, 1319, __pyx_L1_error)

    /* "tofu/geom/_GG03.pyx":1320
 *         pts = pts if nii>1 else pts.reshape((3,1))
 *         LPts.append( pts )
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )             # <<<<<<<<<<<<<<
 * 
 *     # Aggregate
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_dR0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_ones); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyInt_FromSsize_t(__pyx_v_nii); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1320, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_16);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
        __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1320, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
        __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1320, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1320, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1320, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __pyx_t_33 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_2); if (unlikely(__pyx_t_33 == ((int)-1))) __PYX_ERR(0, 1320, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1311
 *     ii = (ind >= NR0*NZ0+PtsM.shape[1] ).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = (ind[ii]-(NR0*NZ0+PtsM.shape[1])) // NR0
 *         indR0 = ind[ii]-(NR0*NZ0+PtsM.shape[1]) - indZ0*NR0
 */
  }

  /* "tofu/geom/_GG03.pyx":1323
 * 
 *     # Aggregate
 *     if len(LPts)==1:             # <<<<<<<<<<<<<<
 *         Pts = LPts[0]
 *         dS = LdS[0]
 */
  __pyx_t_28 = PyList_GET_SIZE(__pyx_v_LPts); if (unlikely(__pyx_t_28 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1323, __pyx_L1_error)
  __pyx_t_29 = ((__pyx_t_28 == 1) != 0);
  if (__pyx_t_29) {

    /* "tofu/geom/_GG03.pyx":1324
 *     # Aggregate
 *     if len(LPts)==1:
 *         Pts = LPts[0]             # <<<<<<<<<<<<<<
 *         dS = LdS[0]
 *     elif len(LPts)>1:
 */
    if (!(likely(((PyList_GET_ITEM(__pyx_v_LPts, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_LPts, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1324, __pyx_L1_error)
    __pyx_t_2 = PyList_GET_ITEM(__pyx_v_LPts, 0);
    __Pyx_INCREF(__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
        }
        __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1324, __pyx_L1_error)
    }
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1325
 *     if len(LPts)==1:
 *         Pts = LPts[0]
 *         dS = LdS[0]             # <<<<<<<<<<<<<<
 *     elif len(LPts)>1:
 *         Pts = np.concatenate(tuple(LPts),axis=1)
 */
    if (!(likely(((PyList_GET_ITEM(__pyx_v_LdS, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_LdS, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1325, __pyx_L1_error)
    __pyx_t_2 = PyList_GET_ITEM(__pyx_v_LdS, 0);
    __Pyx_INCREF(__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1325, __pyx_L1_error)
    }
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1323
 * 
 *     # Aggregate
 *     if len(LPts)==1:             # <<<<<<<<<<<<<<
 *         Pts = LPts[0]
 *         dS = LdS[0]
 */
    goto __pyx_L14;
  }

  /* "tofu/geom/_GG03.pyx":1326
 *         Pts = LPts[0]
 *         dS = LdS[0]
 *     elif len(LPts)>1:             # <<<<<<<<<<<<<<
 *         Pts = np.concatenate(tuple(LPts),axis=1)
 *         dS = np.concatenate(tuple(LdS))
 */
  __pyx_t_28 = PyList_GET_SIZE(__pyx_v_LPts); if (unlikely(__pyx_t_28 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1326, __pyx_L1_error)
  __pyx_t_29 = ((__pyx_t_28 > 1) != 0);
  if (__pyx_t_29) {

    /* "tofu/geom/_GG03.pyx":1327
 *         dS = LdS[0]
 *     elif len(LPts)>1:
 *         Pts = np.concatenate(tuple(LPts),axis=1)             # <<<<<<<<<<<<<<
 *         dS = np.concatenate(tuple(LdS))
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyList_AsTuple(__pyx_v_LPts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 1327, __pyx_L1_error)
    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1327, __pyx_L1_error)
    __pyx_t_27 = ((PyArrayObject *)__pyx_t_15);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_27, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_23, &__pyx_t_22, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_23); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_23, __pyx_t_22, __pyx_t_21);
        }
        __pyx_t_23 = __pyx_t_22 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1327, __pyx_L1_error)
    }
    __pyx_t_27 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_15);
    __pyx_t_15 = 0;

    /* "tofu/geom/_GG03.pyx":1328
 *     elif len(LPts)>1:
 *         Pts = np.concatenate(tuple(LPts),axis=1)
 *         dS = np.concatenate(tuple(LdS))             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dS, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyList_AsTuple(__pyx_v_LdS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1328, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_16 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_16) {
      __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1328, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_15);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_2};
        __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1328, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_t_2};
        __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1328, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_16); __pyx_t_16 = NULL;
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1328, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1328, __pyx_L1_error)
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_15);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_22, &__pyx_t_23);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_22); Py_XDECREF(__pyx_t_23);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_22, __pyx_t_23);
        }
        __pyx_t_21 = __pyx_t_22 = __pyx_t_23 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1328, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_15);
    __pyx_t_15 = 0;

    /* "tofu/geom/_GG03.pyx":1326
 *         Pts = LPts[0]
 *         dS = LdS[0]
 *     elif len(LPts)>1:             # <<<<<<<<<<<<<<
 *         Pts = np.concatenate(tuple(LPts),axis=1)
 *         dS = np.concatenate(tuple(LdS))
 */
  }
  __pyx_L14:;

  /* "tofu/geom/_GG03.pyx":1330
 *         dS = np.concatenate(tuple(LdS))
 * 
 *     return Pts, dS, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_15 = PyFloat_FromDouble(__pyx_v_dR0r); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dZ0r); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_9 = PyTuple_New(9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_NL));
  PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_v_NL));
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_9, 3, ((PyObject *)__pyx_v_dLr));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
  PyTuple_SET_ITEM(__pyx_t_9, 4, ((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(__pyx_t_15);
  PyTuple_SET_ITEM(__pyx_t_9, 5, __pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_9, 6, __pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_dRPhir));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dRPhir));
  PyTuple_SET_ITEM(__pyx_t_9, 7, ((PyObject *)__pyx_v_dRPhir));
  __Pyx_INCREF(((PyObject *)__pyx_v_VPbis));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_VPbis));
  PyTuple_SET_ITEM(__pyx_t_9, 8, ((PyObject *)__pyx_v_VPbis));
  __pyx_t_15 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_9;
  __pyx_t_9 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1262
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                            double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                            double DIn=0., VIn=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_25);
  __Pyx_XDECREF(__pyx_t_26);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bla.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indM.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_TorStruct_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsM.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_R0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bla.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dRPhir.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dSM.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indM.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indR0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
  __pyx_L2:;
  __PYX_XDEC_MEMVIEW(&__pyx_v_phiMinMax, 1);
  __Pyx_XDECREF((PyObject *)__pyx_v_R0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Z0);
  __Pyx_XDECREF((PyObject *)__pyx_v_dSM);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_dRPhir);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_bla);
  __Pyx_XDECREF((PyObject *)__pyx_v_indR0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indZ0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indM);
  __Pyx_XDECREF((PyObject *)__pyx_v_NL);
  __Pyx_XDECREF((PyObject *)__pyx_v_pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsM);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPbis);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF(__pyx_v_LPts);
  __Pyx_XDECREF(__pyx_v_LdS);
  __Pyx_XDECREF(__pyx_v_Lind);
  __Pyx_XDECREF(__pyx_v_nRPhi0);
  __Pyx_XDECREF(__pyx_v_ii);
  __PYX_XDEC_MEMVIEW(&__pyx_v_PhiMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1346
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef _check_DLvsLMinMax(double[::1] LMinMax, DL=None):             # <<<<<<<<<<<<<<
 *     Inter = 1
 *     if DL is not None:
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03__check_DLvsLMinMax(__Pyx_memviewslice __pyx_v_LMinMax, struct __pyx_opt_args_4tofu_4geom_5_GG03__check_DLvsLMinMax *__pyx_optional_args) {
  PyObject *__pyx_v_DL = ((PyObject *)Py_None);
  long __pyx_v_Inter;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  __Pyx_RefNannySetupContext("_check_DLvsLMinMax", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_DL = __pyx_optional_args->DL;
    }
  }
  __Pyx_INCREF(__pyx_v_DL);

  /* "tofu/geom/_GG03.pyx":1347
 * @cython.boundscheck(False)
 * cdef _check_DLvsLMinMax(double[::1] LMinMax, DL=None):
 *     Inter = 1             # <<<<<<<<<<<<<<
 *     if DL is not None:
 *         assert len(DL)==2 and DL[0]<DL[1]
 */
  __pyx_v_Inter = 1;

  /* "tofu/geom/_GG03.pyx":1348
 * cdef _check_DLvsLMinMax(double[::1] LMinMax, DL=None):
 *     Inter = 1
 *     if DL is not None:             # <<<<<<<<<<<<<<
 *         assert len(DL)==2 and DL[0]<DL[1]
 *         assert LMinMax[0]<LMinMax[1]
 */
  __pyx_t_1 = (__pyx_v_DL != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "tofu/geom/_GG03.pyx":1349
 *     Inter = 1
 *     if DL is not None:
 *         assert len(DL)==2 and DL[0]<DL[1]             # <<<<<<<<<<<<<<
 *         assert LMinMax[0]<LMinMax[1]
 *         DL = list(DL)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_3 = PyObject_Length(__pyx_v_DL); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1349, __pyx_L1_error)
      __pyx_t_1 = ((__pyx_t_3 == 2) != 0);
      if (__pyx_t_1) {
      } else {
        __pyx_t_2 = __pyx_t_1;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_DL, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_DL, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1349, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1349, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1349, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_2 = __pyx_t_1;
      __pyx_L4_bool_binop_done:;
      if (unlikely(!__pyx_t_2)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 1349, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1350
 *     if DL is not None:
 *         assert len(DL)==2 and DL[0]<DL[1]
 *         assert LMinMax[0]<LMinMax[1]             # <<<<<<<<<<<<<<
 *         DL = list(DL)
 *         if DL[0]>LMinMax[1] or DL[1]<LMinMax[0]:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_7 = 0;
      __pyx_t_8 = 1;
      if (unlikely(!(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_7)) ))) < (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_8)) )))) != 0))) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 1350, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1351
 *         assert len(DL)==2 and DL[0]<DL[1]
 *         assert LMinMax[0]<LMinMax[1]
 *         DL = list(DL)             # <<<<<<<<<<<<<<
 *         if DL[0]>LMinMax[1] or DL[1]<LMinMax[0]:
 *             Inter = 0
 */
    __pyx_t_6 = PySequence_List(__pyx_v_DL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1351, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF_SET(__pyx_v_DL, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1352
 *         assert LMinMax[0]<LMinMax[1]
 *         DL = list(DL)
 *         if DL[0]>LMinMax[1] or DL[1]<LMinMax[0]:             # <<<<<<<<<<<<<<
 *             Inter = 0
 *         else:
 */
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_DL, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = 1;
    __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_9)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_DL, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = 0;
    __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_10)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1352, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_2) {

      /* "tofu/geom/_GG03.pyx":1353
 *         DL = list(DL)
 *         if DL[0]>LMinMax[1] or DL[1]<LMinMax[0]:
 *             Inter = 0             # <<<<<<<<<<<<<<
 *         else:
 *             if DL[0]<=LMinMax[0]:
 */
      __pyx_v_Inter = 0;

      /* "tofu/geom/_GG03.pyx":1352
 *         assert LMinMax[0]<LMinMax[1]
 *         DL = list(DL)
 *         if DL[0]>LMinMax[1] or DL[1]<LMinMax[0]:             # <<<<<<<<<<<<<<
 *             Inter = 0
 *         else:
 */
      goto __pyx_L6;
    }

    /* "tofu/geom/_GG03.pyx":1355
 *             Inter = 0
 *         else:
 *             if DL[0]<=LMinMax[0]:             # <<<<<<<<<<<<<<
 *                 DL[0] = None
 *             if DL[1]>=LMinMax[1]:
 */
    /*else*/ {
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_DL, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = 0;
      __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_11)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1355, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1355, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1355, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {

        /* "tofu/geom/_GG03.pyx":1356
 *         else:
 *             if DL[0]<=LMinMax[0]:
 *                 DL[0] = None             # <<<<<<<<<<<<<<
 *             if DL[1]>=LMinMax[1]:
 *                 DL[1] = None
 */
        if (unlikely(__Pyx_SetItemInt(__pyx_v_DL, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 1356, __pyx_L1_error)

        /* "tofu/geom/_GG03.pyx":1355
 *             Inter = 0
 *         else:
 *             if DL[0]<=LMinMax[0]:             # <<<<<<<<<<<<<<
 *                 DL[0] = None
 *             if DL[1]>=LMinMax[1]:
 */
      }

      /* "tofu/geom/_GG03.pyx":1357
 *             if DL[0]<=LMinMax[0]:
 *                 DL[0] = None
 *             if DL[1]>=LMinMax[1]:             # <<<<<<<<<<<<<<
 *                 DL[1] = None
 *     return Inter, DL
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_DL, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = 1;
      __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_LMinMax.data) + __pyx_t_12)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1357, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1357, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_2) {

        /* "tofu/geom/_GG03.pyx":1358
 *                 DL[0] = None
 *             if DL[1]>=LMinMax[1]:
 *                 DL[1] = None             # <<<<<<<<<<<<<<
 *     return Inter, DL
 * 
 */
        if (unlikely(__Pyx_SetItemInt(__pyx_v_DL, 1, Py_None, long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 1358, __pyx_L1_error)

        /* "tofu/geom/_GG03.pyx":1357
 *             if DL[0]<=LMinMax[0]:
 *                 DL[0] = None
 *             if DL[1]>=LMinMax[1]:             # <<<<<<<<<<<<<<
 *                 DL[1] = None
 *     return Inter, DL
 */
      }
    }
    __pyx_L6:;

    /* "tofu/geom/_GG03.pyx":1348
 * cdef _check_DLvsLMinMax(double[::1] LMinMax, DL=None):
 *     Inter = 1
 *     if DL is not None:             # <<<<<<<<<<<<<<
 *         assert len(DL)==2 and DL[0]<DL[1]
 *         assert LMinMax[0]<LMinMax[1]
 */
  }

  /* "tofu/geom/_GG03.pyx":1359
 *             if DL[1]>=LMinMax[1]:
 *                 DL[1] = None
 *     return Inter, DL             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyInt_From_long(__pyx_v_Inter); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1359, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __Pyx_INCREF(__pyx_v_DL);
  __Pyx_GIVEREF(__pyx_v_DL);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_DL);
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1346
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef _check_DLvsLMinMax(double[::1] LMinMax, DL=None):             # <<<<<<<<<<<<<<
 *     Inter = 1
 *     if DL is not None:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("tofu.geom._GG03._check_DLvsLMinMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_DL);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1366
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_41_Ves_Smesh_Lin_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_40_Ves_Smesh_Lin_SubFromD_cython[] = " Return the desired surfacic submesh indicated by the limits (DX,DY,DZ), for the desired resolution (dX,dL) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_41_Ves_Smesh_Lin_SubFromD_cython = {"_Ves_Smesh_Lin_SubFromD_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_41_Ves_Smesh_Lin_SubFromD_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_40_Ves_Smesh_Lin_SubFromD_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_41_Ves_Smesh_Lin_SubFromD_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_XMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dL;
  double __pyx_v_dX;
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_DX = 0;
  PyObject *__pyx_v_DY = 0;
  PyObject *__pyx_v_DZ = 0;
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_Lin_SubFromD_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_XMinMax,&__pyx_n_s_dL,&__pyx_n_s_dX,&__pyx_n_s_VPoly,&__pyx_n_s_DX,&__pyx_n_s_DY,&__pyx_n_s_DZ,&__pyx_n_s_DIn,&__pyx_n_s_VIn,&__pyx_n_s_margin,0};
    PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":1368
 * def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX,
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,             # <<<<<<<<<<<<<<
 *                                    double DIn=0., VIn=None, double margin=1.e-9):
 *     " Return the desired surfacic submesh indicated by the limits (DX,DY,DZ), for the desired resolution (dX,dL) "
 */
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);

    /* "tofu/geom/_GG03.pyx":1369
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,
 *                                    double DIn=0., VIn=None, double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     " Return the desired surfacic submesh indicated by the limits (DX,DY,DZ), for the desired resolution (dX,dL) "
 *     cdef cnp.ndarray[double,ndim=1] X, Y0, Z0
 */
    values[8] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_XMinMax)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromD_cython", 0, 4, 10, 1); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromD_cython", 0, 4, 10, 2); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromD_cython", 0, 4, 10, 3); __PYX_ERR(0, 1366, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DX);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DY);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DZ);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[9] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_Lin_SubFromD_cython") < 0)) __PYX_ERR(0, 1366, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_XMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_XMinMax.memview)) __PYX_ERR(0, 1366, __pyx_L3_error)
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1366, __pyx_L3_error)
    __pyx_v_dX = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dX == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1366, __pyx_L3_error)
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 1367, __pyx_L3_error)
    __pyx_v_DX = values[4];
    __pyx_v_DY = values[5];
    __pyx_v_DZ = values[6];
    if (values[7]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1369, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[8];
    if (values[9]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1369, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromD_cython", 0, 4, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1366, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Lin_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_40_Ves_Smesh_Lin_SubFromD_cython(__pyx_self, __pyx_v_XMinMax, __pyx_v_dL, __pyx_v_dX, __pyx_v_VPoly, __pyx_v_DX, __pyx_v_DY, __pyx_v_DZ, __pyx_v_DIn, __pyx_v_VIn, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":1366
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_40_Ves_Smesh_Lin_SubFromD_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_XMinMax, double __pyx_v_dL, double __pyx_v_dX, __Pyx_memviewslice __pyx_v_VPoly, PyObject *__pyx_v_DX, PyObject *__pyx_v_DY, PyObject *__pyx_v_DZ, double __pyx_v_DIn, PyObject *__pyx_v_VIn, double __pyx_v_margin) {
  PyArrayObject *__pyx_v_X = 0;
  PyArrayObject *__pyx_v_Y0 = 0;
  PyArrayObject *__pyx_v_Z0 = 0;
  double __pyx_v_dXr;
  double __pyx_v_dY0r;
  double __pyx_v_dZ0r;
  int __pyx_v_NY0;
  int __pyx_v_NZ0;
  int __pyx_v_Y0n;
  int __pyx_v_Z0n;
  int __pyx_v_NX;
  int __pyx_v_Xn;
  int __pyx_v_Ln;
  int __pyx_v_NR0;
  CYTHON_UNUSED int __pyx_v_Inter;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_PtsCross = 0;
  PyArrayObject *__pyx_v_VPbis = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_indX = 0;
  PyArrayObject *__pyx_v_indY0 = 0;
  PyArrayObject *__pyx_v_indZ0 = 0;
  PyArrayObject *__pyx_v_indL = 0;
  PyArrayObject *__pyx_v_NL = 0;
  PyArrayObject *__pyx_v_ind = 0;
  PyObject *__pyx_v_InterX = NULL;
  PyObject *__pyx_v_InterY = NULL;
  PyObject *__pyx_v_InterZ = NULL;
  PyObject *__pyx_v_indin = NULL;
  PyObject *__pyx_v_pts = NULL;
  PyObject *__pyx_v_iind = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_NL;
  __Pyx_Buffer __pyx_pybuffer_NL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsCross;
  __Pyx_Buffer __pyx_pybuffer_PtsCross;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPbis;
  __Pyx_Buffer __pyx_pybuffer_VPbis;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_X;
  __Pyx_Buffer __pyx_pybuffer_X;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Y0;
  __Pyx_Buffer __pyx_pybuffer_Y0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Z0;
  __Pyx_Buffer __pyx_pybuffer_Z0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indL;
  __Pyx_Buffer __pyx_pybuffer_indL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indX;
  __Pyx_Buffer __pyx_pybuffer_indX;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indY0;
  __Pyx_Buffer __pyx_pybuffer_indY0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indZ0;
  __Pyx_Buffer __pyx_pybuffer_indZ0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  struct __pyx_opt_args_4tofu_4geom_5_GG03__check_DLvsLMinMax __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  double __pyx_t_15;
  int __pyx_t_16;
  PyArrayObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyArrayObject *__pyx_t_22 = NULL;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  PyArrayObject *__pyx_t_25 = NULL;
  PyArrayObject *__pyx_t_26 = NULL;
  PyObject *__pyx_t_27 = NULL;
  int __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  __Pyx_memviewslice __pyx_t_30 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_31;
  double __pyx_t_32;
  double __pyx_t_33;
  __Pyx_RefNannySetupContext("_Ves_Smesh_Lin_SubFromD_cython", 0);
  __Pyx_INCREF(__pyx_v_DX);
  __Pyx_INCREF(__pyx_v_DY);
  __Pyx_INCREF(__pyx_v_DZ);
  __pyx_pybuffer_X.pybuffer.buf = NULL;
  __pyx_pybuffer_X.refcount = 0;
  __pyx_pybuffernd_X.data = NULL;
  __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X;
  __pyx_pybuffer_Y0.pybuffer.buf = NULL;
  __pyx_pybuffer_Y0.refcount = 0;
  __pyx_pybuffernd_Y0.data = NULL;
  __pyx_pybuffernd_Y0.rcbuffer = &__pyx_pybuffer_Y0;
  __pyx_pybuffer_Z0.pybuffer.buf = NULL;
  __pyx_pybuffer_Z0.refcount = 0;
  __pyx_pybuffernd_Z0.data = NULL;
  __pyx_pybuffernd_Z0.rcbuffer = &__pyx_pybuffer_Z0;
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_PtsCross.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsCross.refcount = 0;
  __pyx_pybuffernd_PtsCross.data = NULL;
  __pyx_pybuffernd_PtsCross.rcbuffer = &__pyx_pybuffer_PtsCross;
  __pyx_pybuffer_VPbis.pybuffer.buf = NULL;
  __pyx_pybuffer_VPbis.refcount = 0;
  __pyx_pybuffernd_VPbis.data = NULL;
  __pyx_pybuffernd_VPbis.rcbuffer = &__pyx_pybuffer_VPbis;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_indX.pybuffer.buf = NULL;
  __pyx_pybuffer_indX.refcount = 0;
  __pyx_pybuffernd_indX.data = NULL;
  __pyx_pybuffernd_indX.rcbuffer = &__pyx_pybuffer_indX;
  __pyx_pybuffer_indY0.pybuffer.buf = NULL;
  __pyx_pybuffer_indY0.refcount = 0;
  __pyx_pybuffernd_indY0.data = NULL;
  __pyx_pybuffernd_indY0.rcbuffer = &__pyx_pybuffer_indY0;
  __pyx_pybuffer_indZ0.pybuffer.buf = NULL;
  __pyx_pybuffer_indZ0.refcount = 0;
  __pyx_pybuffernd_indZ0.data = NULL;
  __pyx_pybuffernd_indZ0.rcbuffer = &__pyx_pybuffer_indZ0;
  __pyx_pybuffer_indL.pybuffer.buf = NULL;
  __pyx_pybuffer_indL.refcount = 0;
  __pyx_pybuffernd_indL.data = NULL;
  __pyx_pybuffernd_indL.rcbuffer = &__pyx_pybuffer_indL;
  __pyx_pybuffer_NL.pybuffer.buf = NULL;
  __pyx_pybuffer_NL.refcount = 0;
  __pyx_pybuffernd_NL.data = NULL;
  __pyx_pybuffernd_NL.rcbuffer = &__pyx_pybuffer_NL;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;

  /* "tofu/geom/_GG03.pyx":1373
 *     cdef cnp.ndarray[double,ndim=1] X, Y0, Z0
 *     cdef double dXr, dY0r, dZ0r
 *     cdef int NY0, NZ0, Y0n, Z0n, NX, Xn, Ln, NR0, Inter=1             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] Pts, PtsCross, VPbis
 *     cdef cnp.ndarray[double,ndim=1] dS, dLr, Rref
 */
  __pyx_v_Inter = 1;

  /* "tofu/geom/_GG03.pyx":1380
 *     # Preformat
 *     # Adjust limits
 *     InterX, DX = _check_DLvsLMinMax(XMinMax,DX)             # <<<<<<<<<<<<<<
 *     InterY, DY = _check_DLvsLMinMax(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]),DY)
 *     InterZ, DZ = _check_DLvsLMinMax(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]),DZ)
 */
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.DL = __pyx_v_DX;
  __pyx_t_1 = __pyx_f_4tofu_4geom_5_GG03__check_DLvsLMinMax(__pyx_v_XMinMax, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1380, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1380, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1380, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_InterX = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_DX, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":1381
 *     # Adjust limits
 *     InterX, DX = _check_DLvsLMinMax(XMinMax,DX)
 *     InterY, DY = _check_DLvsLMinMax(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]),DY)             # <<<<<<<<<<<<<<
 *     InterZ, DZ = _check_DLvsLMinMax(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]),DZ)
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8.data = __pyx_v_VPoly.data;
  __pyx_t_8.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1381, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_9) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_8.data = __pyx_v_VPoly.data;
  __pyx_t_8.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1381, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_10 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_9) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
  __pyx_t_4 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.DL = __pyx_v_DY;
  __pyx_t_1 = __pyx_f_4tofu_4geom_5_GG03__check_DLvsLMinMax(__pyx_t_8, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1381, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1381, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1381, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1381, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_InterY = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_DY, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":1382
 *     InterX, DX = _check_DLvsLMinMax(XMinMax,DX)
 *     InterY, DY = _check_DLvsLMinMax(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]),DY)
 *     InterZ, DZ = _check_DLvsLMinMax(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]),DZ)             # <<<<<<<<<<<<<<
 * 
 *     if InterX==1 and InterY==1 and InterZ==1:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_8.data = __pyx_v_VPoly.data;
  __pyx_t_8.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1382, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_11) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_8.data = __pyx_v_VPoly.data;
  __pyx_t_8.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1382, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_10 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_11) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11); __pyx_t_11 = NULL;
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
  __pyx_t_4 = 0;
  __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(__pyx_t_1);
  if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2.__pyx_n = 1;
  __pyx_t_2.DL = __pyx_v_DZ;
  __pyx_t_1 = __pyx_f_4tofu_4geom_5_GG03__check_DLvsLMinMax(__pyx_t_8, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __pyx_t_8.memview = NULL;
  __pyx_t_8.data = NULL;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1382, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1382, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 1382, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1382, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_InterZ = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_DZ, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":1384
 *     InterZ, DZ = _check_DLvsLMinMax(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]),DZ)
 * 
 *     if InterX==1 and InterY==1 and InterZ==1:             # <<<<<<<<<<<<<<
 * 
 *         # Get the mesh for the faces
 */
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_InterX, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_13) {
  } else {
    __pyx_t_12 = __pyx_t_13;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_InterY, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_13) {
  } else {
    __pyx_t_12 = __pyx_t_13;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_v_InterZ, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1384, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_12 = __pyx_t_13;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_12) {

    /* "tofu/geom/_GG03.pyx":1387
 * 
 *         # Get the mesh for the faces
 *         Y0, dY0r, indY0, NY0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DY, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *         Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 *         Y0n, Z0n = len(Y0), len(Z0)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_min); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_8.data = __pyx_v_VPoly.data;
    __pyx_t_8.memview = __pyx_v_VPoly.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1387, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_7 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_7};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_7};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_max); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_8.data = __pyx_v_VPoly.data;
    __pyx_t_8.memview = __pyx_v_VPoly.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1387, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_11 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_11};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
    __pyx_t_3 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1387, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1387, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_DL, __pyx_v_DY) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_margin, __pyx_t_4) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1387, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_7};
        for (i=0; i < 4; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1387, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_1,&__pyx_t_7};
      __pyx_t_9 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1387, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_9)->tp_iternext;
      for (index=0; index < 4; index++) {
        PyObject* item = __pyx_t_6(__pyx_t_9); if (unlikely(!item)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L14_unpacking_done;
      __pyx_L13_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1387, __pyx_L1_error)
      __pyx_L14_unpacking_done:;
    }
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1387, __pyx_L1_error)
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1387, __pyx_L1_error)
    __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_7); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1387, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_17 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer, (PyObject*)__pyx_v_Y0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Y0.diminfo[0].strides = __pyx_pybuffernd_Y0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Y0.diminfo[0].shape = __pyx_pybuffernd_Y0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1387, __pyx_L1_error)
    }
    __pyx_t_17 = 0;
    __pyx_v_Y0 = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dY0r = __pyx_t_15;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indY0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_indY0.diminfo[0].strides = __pyx_pybuffernd_indY0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indY0.diminfo[0].shape = __pyx_pybuffernd_indY0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1387, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_indY0 = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_v_NY0 = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":1388
 *         # Get the mesh for the faces
 *         Y0, dY0r, indY0, NY0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DY, Lim=True, margin=margin)
 *         Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *         Y0n, Z0n = len(Y0), len(Z0)
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8.data = __pyx_v_VPoly.data;
    __pyx_t_8.memview = __pyx_v_VPoly.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1388, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_14) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_5};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_14); __pyx_t_14 = NULL;
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_8.data = __pyx_v_VPoly.data;
    __pyx_t_8.memview = __pyx_v_VPoly.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_8, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1388, __pyx_L1_error)
    }
        __pyx_t_8.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_8.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_8.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_8.suboffsets[0] = -1;

__pyx_t_11 = __pyx_memoryview_fromslice(__pyx_t_8, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
    __pyx_t_8.memview = NULL;
    __pyx_t_8.data = NULL;
    __pyx_t_14 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_14)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_14) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1388, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_11};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_11};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_14); __pyx_t_14 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_9);
    PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_9);
    __pyx_t_1 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
    __pyx_t_7 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DL, __pyx_v_DZ) < 0) __PYX_ERR(0, 1388, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1388, __pyx_L1_error)
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_7) < 0) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1388, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_4,&__pyx_t_5};
        for (i=0; i < 4; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1388, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_4,&__pyx_t_5};
      __pyx_t_9 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_9)->tp_iternext;
      for (index=0; index < 4; index++) {
        PyObject* item = __pyx_t_6(__pyx_t_9); if (unlikely(!item)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1388, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1388, __pyx_L1_error)
      __pyx_L16_unpacking_done:;
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1388, __pyx_L1_error)
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1388, __pyx_L1_error)
    __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1388, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_17 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_v_Z0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Z0.diminfo[0].strides = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Z0.diminfo[0].shape = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1388, __pyx_L1_error)
    }
    __pyx_t_17 = 0;
    __pyx_v_Z0 = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_dZ0r = __pyx_t_15;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_indZ0.diminfo[0].strides = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ0.diminfo[0].shape = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1388, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_indZ0 = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_NZ0 = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":1389
 *         Y0, dY0r, indY0, NY0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=DY, Lim=True, margin=margin)
 *         Z0, dZ0r, indZ0, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=DZ, Lim=True, margin=margin)
 *         Y0n, Z0n = len(Y0), len(Z0)             # <<<<<<<<<<<<<<
 * 
 *         # Get the actual R and Z resolutions and mesh elements
 */
    __pyx_t_23 = PyObject_Length(((PyObject *)__pyx_v_Y0)); if (unlikely(__pyx_t_23 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1389, __pyx_L1_error)
    __pyx_t_24 = PyObject_Length(((PyObject *)__pyx_v_Z0)); if (unlikely(__pyx_t_24 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1389, __pyx_L1_error)
    __pyx_v_Y0n = __pyx_t_23;
    __pyx_v_Z0n = __pyx_t_24;

    /* "tofu/geom/_GG03.pyx":1392
 * 
 *         # Get the actual R and Z resolutions and mesh elements
 *         X, dXr, indX, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DL=DX, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *         Xn = len(X)
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_XMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dX); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
    __pyx_t_5 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_DL, __pyx_v_DX) < 0) __PYX_ERR(0, 1392, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1392, __pyx_L1_error)
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_margin, __pyx_t_5) < 0) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1392, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
      } else {
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_1,&__pyx_t_7,&__pyx_t_3};
        for (i=0; i < 4; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1392, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_1,&__pyx_t_7,&__pyx_t_3};
      __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_9)->tp_iternext;
      for (index=0; index < 4; index++) {
        PyObject* item = __pyx_t_6(__pyx_t_9); if (unlikely(!item)) goto __pyx_L17_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_9), 4) < 0) __PYX_ERR(0, 1392, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1392, __pyx_L1_error)
      __pyx_L18_unpacking_done:;
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1392, __pyx_L1_error)
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1392, __pyx_L1_error)
    __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_17 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1392, __pyx_L1_error)
    }
    __pyx_t_17 = 0;
    __pyx_v_X = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_v_dXr = __pyx_t_15;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_7);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
      __pyx_t_18 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_18 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_v_indX, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_indX.diminfo[0].strides = __pyx_pybuffernd_indX.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indX.diminfo[0].shape = __pyx_pybuffernd_indX.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1392, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_indX = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_v_NX = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":1393
 *         # Get the actual R and Z resolutions and mesh elements
 *         X, dXr, indX, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DL=DX, Lim=True, margin=margin)
 *         Xn = len(X)             # <<<<<<<<<<<<<<
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *         NR0 = Rref.size
 */
    __pyx_t_24 = PyObject_Length(((PyObject *)__pyx_v_X)); if (unlikely(__pyx_t_24 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1393, __pyx_L1_error)
    __pyx_v_Xn = __pyx_t_24;

    /* "tofu/geom/_GG03.pyx":1394
 *         X, dXr, indX, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DL=DX, Lim=True, margin=margin)
 *         Xn = len(X)
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)             # <<<<<<<<<<<<<<
 *         NR0 = Rref.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_Smesh_Cross); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_7);
    __pyx_t_3 = 0;
    __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_D1, Py_None) < 0) __PYX_ERR(0, 1394, __pyx_L1_error)
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_D2, Py_None) < 0) __PYX_ERR(0, 1394, __pyx_L1_error)
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_DIn, __pyx_t_3) < 0) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_VIn, __pyx_v_VIn) < 0) __PYX_ERR(0, 1394, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1394, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1394, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_10);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_7,&__pyx_t_1,&__pyx_t_5,&__pyx_t_4,&__pyx_t_9,&__pyx_t_10};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1394, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_7,&__pyx_t_1,&__pyx_t_5,&__pyx_t_4,&__pyx_t_9,&__pyx_t_10};
      __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1394, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_11)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_6(__pyx_t_11); if (unlikely(!item)) goto __pyx_L19_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_11), 6) < 0) __PYX_ERR(0, 1394, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L20_unpacking_done;
      __pyx_L19_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1394, __pyx_L1_error)
      __pyx_L20_unpacking_done:;
    }
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1394, __pyx_L1_error)
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1394, __pyx_L1_error)
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1394, __pyx_L1_error)
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1394, __pyx_L1_error)
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1394, __pyx_L1_error)
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1394, __pyx_L1_error)
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_7);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __pyx_v_PtsCross = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_dLr = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_5);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_v_indL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_indL.diminfo[0].strides = __pyx_pybuffernd_indL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indL.diminfo[0].shape = __pyx_pybuffernd_indL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_indL = ((PyArrayObject *)__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_NL = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_Rref = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1394, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_10);
    __pyx_t_10 = 0;

    /* "tofu/geom/_GG03.pyx":1395
 *         Xn = len(X)
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *         NR0 = Rref.size             # <<<<<<<<<<<<<<
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DY is not None:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Rref), __pyx_n_s_size); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1395, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1395, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_NR0 = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":1396
 *         PtsCross, dLr, indL, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *         NR0 = Rref.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)             # <<<<<<<<<<<<<<
 *         if DY is not None:
 *             if DY[0] is not None:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_PtsCross->dimensions[1])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)) < 0) __PYX_ERR(0, 1396, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1396, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_v_indin = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "tofu/geom/_GG03.pyx":1397
 *         NR0 = Rref.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DY is not None:             # <<<<<<<<<<<<<<
 *             if DY[0] is not None:
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 */
    __pyx_t_12 = (__pyx_v_DY != Py_None);
    __pyx_t_13 = (__pyx_t_12 != 0);
    if (__pyx_t_13) {

      /* "tofu/geom/_GG03.pyx":1398
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DY is not None:
 *             if DY[0] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 *             if DY[1] is not None:
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_DY, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1398, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = (__pyx_t_4 != Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = (__pyx_t_13 != 0);
      if (__pyx_t_12) {

        /* "tofu/geom/_GG03.pyx":1399
 *         if DY is not None:
 *             if DY[0] is not None:
 *                 indin = indin & (PtsCross[0,:]>=DY[0])             # <<<<<<<<<<<<<<
 *             if DY[1] is not None:
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__199); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1399, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_DY, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1399, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_9, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1399, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyNumber_And(__pyx_v_indin, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1399, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "tofu/geom/_GG03.pyx":1398
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DY is not None:
 *             if DY[0] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 *             if DY[1] is not None:
 */
      }

      /* "tofu/geom/_GG03.pyx":1400
 *             if DY[0] is not None:
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 *             if DY[1] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 *         if DZ is not None:
 */
      __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_DY, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1400, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_13 = (__pyx_t_12 != 0);
      if (__pyx_t_13) {

        /* "tofu/geom/_GG03.pyx":1401
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 *             if DY[1] is not None:
 *                 indin = indin & (PtsCross[0,:]<=DY[1])             # <<<<<<<<<<<<<<
 *         if DZ is not None:
 *             if DZ[0] is not None:
 */
        __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__201); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1401, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DY, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1401, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyObject_RichCompare(__pyx_t_9, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1401, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_And(__pyx_v_indin, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1401, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "tofu/geom/_GG03.pyx":1400
 *             if DY[0] is not None:
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 *             if DY[1] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 *         if DZ is not None:
 */
      }

      /* "tofu/geom/_GG03.pyx":1397
 *         NR0 = Rref.size
 *         indin = np.ones((PtsCross.shape[1],),dtype=bool)
 *         if DY is not None:             # <<<<<<<<<<<<<<
 *             if DY[0] is not None:
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 */
    }

    /* "tofu/geom/_GG03.pyx":1402
 *             if DY[1] is not None:
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 *         if DZ is not None:             # <<<<<<<<<<<<<<
 *             if DZ[0] is not None:
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 */
    __pyx_t_13 = (__pyx_v_DZ != Py_None);
    __pyx_t_12 = (__pyx_t_13 != 0);
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":1403
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 *         if DZ is not None:
 *             if DZ[0] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 *             if DZ[1] is not None:
 */
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_DZ, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1403, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = (__pyx_t_3 != Py_None);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_13 = (__pyx_t_12 != 0);
      if (__pyx_t_13) {

        /* "tofu/geom/_GG03.pyx":1404
 *         if DZ is not None:
 *             if DZ[0] is not None:
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])             # <<<<<<<<<<<<<<
 *             if DZ[1] is not None:
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 */
        __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__203); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1404, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_DZ, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1404, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1404, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_And(__pyx_v_indin, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1404, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "tofu/geom/_GG03.pyx":1403
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 *         if DZ is not None:
 *             if DZ[0] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 *             if DZ[1] is not None:
 */
      }

      /* "tofu/geom/_GG03.pyx":1405
 *             if DZ[0] is not None:
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 *             if DZ[1] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 */
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_DZ, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1405, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = (__pyx_t_4 != Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = (__pyx_t_13 != 0);
      if (__pyx_t_12) {

        /* "tofu/geom/_GG03.pyx":1406
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 *             if DZ[1] is not None:
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])             # <<<<<<<<<<<<<<
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()
 */
        __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__205); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1406, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_DZ, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1406, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_9, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1406, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyNumber_And(__pyx_v_indin, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1406, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_9);
        __pyx_t_9 = 0;

        /* "tofu/geom/_GG03.pyx":1405
 *             if DZ[0] is not None:
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 *             if DZ[1] is not None:             # <<<<<<<<<<<<<<
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 */
      }

      /* "tofu/geom/_GG03.pyx":1402
 *             if DY[1] is not None:
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 *         if DZ is not None:             # <<<<<<<<<<<<<<
 *             if DZ[0] is not None:
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 */
    }

    /* "tofu/geom/_GG03.pyx":1407
 *             if DZ[1] is not None:
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]             # <<<<<<<<<<<<<<
 *         Ln = indin.sum()
 *         # Agregating
 */
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_slice__206);
    __Pyx_GIVEREF(__pyx_slice__206);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__206);
    __Pyx_INCREF(__pyx_v_indin);
    __Pyx_GIVEREF(__pyx_v_indin);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_indin);
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1407, __pyx_L1_error)
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), __pyx_v_indin); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1407, __pyx_L1_error)
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_indL), __pyx_v_indin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1407, __pyx_L1_error)
    __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_Rref), __pyx_v_indin); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1407, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1407, __pyx_L1_error)
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1407, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __Pyx_DECREF_SET(__pyx_v_PtsCross, ((PyArrayObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1407, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __Pyx_DECREF_SET(__pyx_v_dLr, ((PyArrayObject *)__pyx_t_9));
    __pyx_t_9 = 0;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_v_indL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_indL.diminfo[0].strides = __pyx_pybuffernd_indL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indL.diminfo[0].shape = __pyx_pybuffernd_indL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1407, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __Pyx_DECREF_SET(__pyx_v_indL, ((PyArrayObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1407, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __Pyx_DECREF_SET(__pyx_v_Rref, ((PyArrayObject *)__pyx_t_10));
    __pyx_t_10 = 0;

    /* "tofu/geom/_GG03.pyx":1408
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()             # <<<<<<<<<<<<<<
 *         # Agregating
 *         Pts = np.array([np.repeat(X,Ln), np.tile(PtsCross[0,:],Xn), np.tile(PtsCross[1,:],Xn)])
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_9) {
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1408, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else {
      __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1408, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1408, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_v_Ln = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":1410
 *         Ln = indin.sum()
 *         # Agregating
 *         Pts = np.array([np.repeat(X,Ln), np.tile(PtsCross[0,:],Xn), np.tile(PtsCross[1,:],Xn)])             # <<<<<<<<<<<<<<
 *         ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn)
 *         dS = np.tile(dLr*dXr,Xn)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_repeat); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_16 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_v_X), __pyx_t_3};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_1, ((PyObject *)__pyx_v_X), __pyx_t_3};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_X));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_X));
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_16, ((PyObject *)__pyx_v_X));
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_16, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_tile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__208); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Xn); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_11 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_16 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_7, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_7, __pyx_t_1};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_16, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_16, __pyx_t_1);
      __pyx_t_7 = 0;
      __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_tile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_tuple__210); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_Xn); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_11 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_11)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_16 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_14, __pyx_t_7};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_14, __pyx_t_7};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else
    #endif
    {
      __pyx_t_27 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_14);
      PyTuple_SET_ITEM(__pyx_t_27, 0+__pyx_t_16, __pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_27, 1+__pyx_t_16, __pyx_t_7);
      __pyx_t_14 = 0;
      __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_27, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1410, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1410, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_10);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_1};
        __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1410, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_1};
        __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1410, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1410, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1410, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1410, __pyx_L1_error)
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1410, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_10);
    __pyx_t_10 = 0;

    /* "tofu/geom/_GG03.pyx":1411
 *         # Agregating
 *         Pts = np.array([np.repeat(X,Ln), np.tile(PtsCross[0,:],Xn), np.tile(PtsCross[1,:],Xn)])
 *         ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn)             # <<<<<<<<<<<<<<
 *         dS = np.tile(dLr*dXr,Xn)
 *         if DX is None or DX[0] is None:
 */
    __pyx_t_10 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_repeat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_NR0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_indX), __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_16 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_5};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_5};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_27 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_27, 0+__pyx_t_16, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_27, 1+__pyx_t_16, __pyx_t_5);
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_27, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Add(__pyx_t_10, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_tile); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_27);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_Xn); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_5 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_27))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_27);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_27);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_27, function);
        __pyx_t_16 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_27)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_indL), __pyx_t_10};
      __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_27)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, ((PyObject *)__pyx_v_indL), __pyx_t_10};
      __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_27, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(((PyObject *)__pyx_v_indL));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indL));
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_16, ((PyObject *)__pyx_v_indL));
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_16, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_27, __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1411, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    __pyx_t_27 = PyNumber_Add(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_27);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1411, __pyx_L1_error)
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_27);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1411, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_ind = ((PyArrayObject *)__pyx_t_27);
    __pyx_t_27 = 0;

    /* "tofu/geom/_GG03.pyx":1412
 *         Pts = np.array([np.repeat(X,Ln), np.tile(PtsCross[0,:],Xn), np.tile(PtsCross[1,:],Xn)])
 *         ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn)
 *         dS = np.tile(dLr*dXr,Xn)             # <<<<<<<<<<<<<<
 *         if DX is None or DX[0] is None:
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 */
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_tile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_dLr), __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Xn); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = NULL;
    __pyx_t_16 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_16 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_9};
      __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_9};
      __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_10) {
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); __pyx_t_10 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_16, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_16, __pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1412, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1412, __pyx_L1_error)
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_27);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1412, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_27);
    __pyx_t_27 = 0;

    /* "tofu/geom/_GG03.pyx":1413
 *         ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn)
 *         dS = np.tile(dLr*dXr,Xn)
 *         if DX is None or DX[0] is None:             # <<<<<<<<<<<<<<
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 */
    __pyx_t_13 = (__pyx_v_DX == Py_None);
    __pyx_t_28 = (__pyx_t_13 != 0);
    if (!__pyx_t_28) {
    } else {
      __pyx_t_12 = __pyx_t_28;
      goto __pyx_L28_bool_binop_done;
    }
    __pyx_t_27 = __Pyx_GetItemInt(__pyx_v_DX, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1413, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_27);
    __pyx_t_28 = (__pyx_t_27 == Py_None);
    __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    __pyx_t_13 = (__pyx_t_28 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L28_bool_binop_done:;
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":1414
 *         dS = np.tile(dLr*dXr,Xn)
 *         if DX is None or DX[0] is None:
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])             # <<<<<<<<<<<<<<
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_29 = 0;
      __pyx_t_1 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_XMinMax.data) + __pyx_t_29)) ))) + __pyx_v_DIn)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_Y0n * __pyx_v_Z0n)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      if (!__pyx_t_3) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Multiply(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_tile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Z0n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_Y0), __pyx_t_1};
        __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_Y0), __pyx_t_1};
        __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_Y0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Y0));
        PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_16, ((PyObject *)__pyx_v_Y0));
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_16, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_repeat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Y0n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_Z0), __pyx_t_3};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_Z0), __pyx_t_3};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_Z0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Z0));
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_16, ((PyObject *)__pyx_v_Z0));
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_16, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1414, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_10);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_9);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_7);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_7);
      __pyx_t_10 = 0;
      __pyx_t_9 = 0;
      __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1414, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_27);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
          __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
          __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1414, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_pts = __pyx_t_27;
      __pyx_t_27 = 0;

      /* "tofu/geom/_GG03.pyx":1415
 *         if DX is None or DX[0] is None:
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)             # <<<<<<<<<<<<<<
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):
 */
      __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_NY0); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_repeat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Y0n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_indZ0), __pyx_t_9};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, ((PyObject *)__pyx_v_indZ0), __pyx_t_9};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_indZ0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_indZ0));
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_16, ((PyObject *)__pyx_v_indZ0));
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_16, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_27, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_27 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_n_s_tile); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_Z0n); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_9 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_indY0), __pyx_t_27};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_9, ((PyObject *)__pyx_v_indY0), __pyx_t_27};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_9) {
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_indY0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_indY0));
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_16, ((PyObject *)__pyx_v_indY0));
        __Pyx_GIVEREF(__pyx_t_27);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_16, __pyx_t_27);
        __pyx_t_27 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1415, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1415, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_iind = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "tofu/geom/_GG03.pyx":1416
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_30 = __pyx_v_VPoly;
      __PYX_INC_MEMVIEW(&__pyx_t_30, 1);
      if (unlikely(__pyx_memslice_transpose(&__pyx_t_30) == 0)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_t_30, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
      __pyx_t_30.memview = NULL;
      __pyx_t_30.data = NULL;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1416, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_10);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
          __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1416, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
          __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1416, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_27 = PyTuple_New(1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1416, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_27, 0+1, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_27, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1416, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__213); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_T); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_27);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_27);
      __pyx_t_27 = 0;
      __pyx_t_27 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      if (PyDict_SetItem(__pyx_t_27, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1416, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_27, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1416, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, __pyx_t_27); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_1);
      __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":1417
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):             # <<<<<<<<<<<<<<
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((pts,Pts),axis=1)
 */
      __pyx_t_27 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_n_s_any); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1417, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __pyx_t_27 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_27)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_27);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      if (!__pyx_t_27) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_indin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_27, __pyx_v_indin};
          __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_27, __pyx_v_indin};
          __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_27); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_27); __pyx_t_27 = NULL;
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_indin);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1417, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1417, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_12) {

        /* "tofu/geom/_GG03.pyx":1418
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]             # <<<<<<<<<<<<<<
 *                 Pts = np.concatenate((pts,Pts),axis=1)
 *                 ind = np.concatenate((iind[indin], ind))
 */
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_27 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
          __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_5);
          if (likely(__pyx_t_27)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
            __Pyx_INCREF(__pyx_t_27);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_5, function);
          }
        }
        if (__pyx_t_27) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_27); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        } else {
          __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1418, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_10, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1418, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_12) {
          __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_slice__214);
          __Pyx_GIVEREF(__pyx_slice__214);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_slice__214);
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_indin);
          __pyx_t_10 = PyObject_GetItem(__pyx_v_pts, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_reshape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__216, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_1 = __pyx_t_10;
          __pyx_t_10 = 0;
        } else {
          __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_INCREF(__pyx_slice__217);
          __Pyx_GIVEREF(__pyx_slice__217);
          PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_slice__217);
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_indin);
          __pyx_t_5 = PyObject_GetItem(__pyx_v_pts, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1418, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_1 = __pyx_t_5;
          __pyx_t_5 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "tofu/geom/_GG03.pyx":1419
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((pts,Pts),axis=1)             # <<<<<<<<<<<<<<
 *                 ind = np.concatenate((iind[indin], ind))
 *                 dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS))
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_v_pts);
        __Pyx_GIVEREF(__pyx_v_pts);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pts);
        __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
        PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_Pts));
        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 1419, __pyx_L1_error)
        __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1419, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1419, __pyx_L1_error)
        __pyx_t_25 = ((PyArrayObject *)__pyx_t_27);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
          __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_16 < 0)) {
            PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
            }
            __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
          }
          __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1419, __pyx_L1_error)
        }
        __pyx_t_25 = 0;
        __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_27));
        __pyx_t_27 = 0;

        /* "tofu/geom/_GG03.pyx":1420
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((pts,Pts),axis=1)
 *                 ind = np.concatenate((iind[indin], ind))             # <<<<<<<<<<<<<<
 *                 dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS))
 *         if DX is None or DX[1] is None:
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetItem(__pyx_v_iind, __pyx_v_indin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1420, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_ind));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
        PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_ind));
        __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        if (!__pyx_t_1) {
          __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1420, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_27);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
            __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1420, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
            __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1420, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          {
            __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1420, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __pyx_t_1 = NULL;
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1420, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1420, __pyx_L1_error)
        __pyx_t_22 = ((PyArrayObject *)__pyx_t_27);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
          __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_16 < 0)) {
            PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            }
            __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
          }
          __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1420, __pyx_L1_error)
        }
        __pyx_t_22 = 0;
        __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_27));
        __pyx_t_27 = 0;

        /* "tofu/geom/_GG03.pyx":1421
 *                 Pts = np.concatenate((pts,Pts),axis=1)
 *                 ind = np.concatenate((iind[indin], ind))
 *                 dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS))             # <<<<<<<<<<<<<<
 *         if DX is None or DX[1] is None:
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 */
        __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyFloat_FromDouble((__pyx_v_dY0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_3 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1421, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_9);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_9, function);
          }
        }
        if (!__pyx_t_1) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_14};
            __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_14};
            __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          } else
          #endif
          {
            __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
            __Pyx_GIVEREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyNumber_Multiply(__pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1421, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9);
        __Pyx_INCREF(((PyObject *)__pyx_v_dS));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
        PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_dS));
        __pyx_t_9 = 0;
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (!__pyx_t_9) {
          __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1421, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_27);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
            __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
            __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          {
            __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1421, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1421, __pyx_L1_error)
        __pyx_t_26 = ((PyArrayObject *)__pyx_t_27);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
          __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_16 < 0)) {
            PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
            }
            __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
          }
          __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1421, __pyx_L1_error)
        }
        __pyx_t_26 = 0;
        __Pyx_DECREF_SET(__pyx_v_dS, ((PyArrayObject *)__pyx_t_27));
        __pyx_t_27 = 0;

        /* "tofu/geom/_GG03.pyx":1417
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):             # <<<<<<<<<<<<<<
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((pts,Pts),axis=1)
 */
      }

      /* "tofu/geom/_GG03.pyx":1413
 *         ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn)
 *         dS = np.tile(dLr*dXr,Xn)
 *         if DX is None or DX[0] is None:             # <<<<<<<<<<<<<<
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 */
    }

    /* "tofu/geom/_GG03.pyx":1422
 *                 ind = np.concatenate((iind[indin], ind))
 *                 dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS))
 *         if DX is None or DX[1] is None:             # <<<<<<<<<<<<<<
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 */
    __pyx_t_13 = (__pyx_v_DX == Py_None);
    __pyx_t_28 = (__pyx_t_13 != 0);
    if (!__pyx_t_28) {
    } else {
      __pyx_t_12 = __pyx_t_28;
      goto __pyx_L32_bool_binop_done;
    }
    __pyx_t_27 = __Pyx_GetItemInt(__pyx_v_DX, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_27);
    __pyx_t_28 = (__pyx_t_27 == Py_None);
    __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    __pyx_t_13 = (__pyx_t_28 != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L32_bool_binop_done:;
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":1423
 *                 dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS))
 *         if DX is None or DX[1] is None:
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])             # <<<<<<<<<<<<<<
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_31 = 1;
      __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_XMinMax.data) + __pyx_t_31)) ))) - __pyx_v_DIn)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_Y0n * __pyx_v_Z0n)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_14};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_14};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_14);
          __pyx_t_14 = 0;
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_tile); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_Z0n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_14 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_14, ((PyObject *)__pyx_v_Y0), __pyx_t_7};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_14, ((PyObject *)__pyx_v_Y0), __pyx_t_7};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_14) {
          __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_14); __pyx_t_14 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_Y0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Y0));
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_16, ((PyObject *)__pyx_v_Y0));
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_16, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_repeat); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Y0n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_14 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_14, ((PyObject *)__pyx_v_Z0), __pyx_t_9};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[3] = {__pyx_t_14, ((PyObject *)__pyx_v_Z0), __pyx_t_9};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_14) {
          __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14); __pyx_t_14 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_Z0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Z0));
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_16, ((PyObject *)__pyx_v_Z0));
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_16, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyList_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1423, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5);
      PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_1);
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_7); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1423, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_27);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_7};
          __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_7};
          __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1423, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_pts, __pyx_t_27);
      __pyx_t_27 = 0;

      /* "tofu/geom/_GG03.pyx":1424
 *         if DX is None or DX[1] is None:
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)             # <<<<<<<<<<<<<<
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):
 */
      __pyx_t_27 = __Pyx_PyInt_From_int(((__pyx_v_NY0 * __pyx_v_NZ0) + (__pyx_v_NX * __pyx_v_NR0))); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_NY0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_repeat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_Y0n); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_indZ0), __pyx_t_7};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_3, ((PyObject *)__pyx_v_indZ0), __pyx_t_7};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_indZ0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_indZ0));
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_16, ((PyObject *)__pyx_v_indZ0));
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_16, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyNumber_Multiply(__pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_27, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_27 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_n_s_tile); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __pyx_t_27 = __Pyx_PyInt_From_int(__pyx_v_Z0n); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_4 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_indY0), __pyx_t_27};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_indY0), __pyx_t_27};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(((PyObject *)__pyx_v_indY0));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_indY0));
        PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_16, ((PyObject *)__pyx_v_indY0));
        __Pyx_GIVEREF(__pyx_t_27);
        PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_16, __pyx_t_27);
        __pyx_t_27 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1424, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1424, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_iind, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "tofu/geom/_GG03.pyx":1425
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_30 = __pyx_v_VPoly;
      __PYX_INC_MEMVIEW(&__pyx_t_30, 1);
      if (unlikely(__pyx_memslice_transpose(&__pyx_t_30) == 0)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_30, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
      __pyx_t_30.memview = NULL;
      __pyx_t_30.data = NULL;
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_7) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1425, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_10);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
          __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1425, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
          __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1425, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_27 = PyTuple_New(1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1425, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_27);
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_27, 0, __pyx_t_7); __pyx_t_7 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_27, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_27, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1425, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_contains_points); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_GetItem(__pyx_v_pts, __pyx_tuple__220); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_27 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_T); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_27);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_27);
      __pyx_t_27 = 0;
      __pyx_t_27 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      if (PyDict_SetItem(__pyx_t_27, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1425, __pyx_L1_error)
      if (PyDict_SetItem(__pyx_t_27, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1425, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_27); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __Pyx_DECREF_SET(__pyx_v_indin, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "tofu/geom/_GG03.pyx":1426
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):             # <<<<<<<<<<<<<<
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((Pts,pts),axis=1)
 */
      __pyx_t_27 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_27);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_n_s_any); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1426, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
      __pyx_t_27 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_27)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_27);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      if (!__pyx_t_27) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_indin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_27, __pyx_v_indin};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1426, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_27, __pyx_v_indin};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1426, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_27); __pyx_t_27 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_27); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_27); __pyx_t_27 = NULL;
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_indin);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1426, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1426, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_12) {

        /* "tofu/geom/_GG03.pyx":1427
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]             # <<<<<<<<<<<<<<
 *                 Pts = np.concatenate((Pts,pts),axis=1)
 *                 ind = np.concatenate((ind,iind[indin]))
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_27 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_27 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_27)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_27);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (__pyx_t_27) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_27); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
        } else {
          __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1427, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyInt_EqObjC(__pyx_t_10, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1427, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        if (__pyx_t_12) {
          __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_INCREF(__pyx_slice__221);
          __Pyx_GIVEREF(__pyx_slice__221);
          PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_slice__221);
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_indin);
          __pyx_t_10 = PyObject_GetItem(__pyx_v_pts, __pyx_t_1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_reshape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__223, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_5 = __pyx_t_10;
          __pyx_t_10 = 0;
        } else {
          __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_INCREF(__pyx_slice__224);
          __Pyx_GIVEREF(__pyx_slice__224);
          PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_slice__224);
          __Pyx_INCREF(__pyx_v_indin);
          __Pyx_GIVEREF(__pyx_v_indin);
          PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_indin);
          __pyx_t_1 = PyObject_GetItem(__pyx_v_pts, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __pyx_t_5 = __pyx_t_1;
          __pyx_t_1 = 0;
        }
        __Pyx_DECREF_SET(__pyx_v_pts, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "tofu/geom/_GG03.pyx":1428
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((Pts,pts),axis=1)             # <<<<<<<<<<<<<<
 *                 ind = np.concatenate((ind,iind[indin]))
 *                 dS = np.concatenate((dS,dY0r*dZ0r*np.ones((indin.sum(),))))
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Pts));
        __Pyx_INCREF(__pyx_v_pts);
        __Pyx_GIVEREF(__pyx_v_pts);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_pts);
        __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 1428, __pyx_L1_error)
        __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1428, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_27);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1428, __pyx_L1_error)
        __pyx_t_25 = ((PyArrayObject *)__pyx_t_27);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
          __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
          if (unlikely(__pyx_t_16 < 0)) {
            PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            }
            __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
          }
          __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
          if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1428, __pyx_L1_error)
        }
        __pyx_t_25 = 0;
        __Pyx_DECREF_SET(__pyx_v_Pts, ((PyArrayObject *)__pyx_t_27));
        __pyx_t_27 = 0;

        /* "tofu/geom/_GG03.pyx":1429
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((Pts,pts),axis=1)
 *                 ind = np.concatenate((ind,iind[indin]))             # <<<<<<<<<<<<<<
 *                 dS = np.concatenate((dS,dY0r*dZ0r*np.ones((indin.sum(),))))
 * 
 */
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetItem(__pyx_v_iind, __pyx_v_indin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1429, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_ind));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_ind));
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_10, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1429, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_27);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
            __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1429, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
            PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
            __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1429, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1429, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_7, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1429, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1429, __pyx_L1_error)
        __pyx_t_22 = ((PyArrayObject *)__pyx_t_27);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
          __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_16 < 0)) {
            PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
            }
            __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
          }
          __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1429, __pyx_L1_error)
        }
        __pyx_t_22 = 0;
        __Pyx_DECREF_SET(__pyx_v_ind, ((PyArrayObject *)__pyx_t_27));
        __pyx_t_27 = 0;

        /* "tofu/geom/_GG03.pyx":1430
 *                 Pts = np.concatenate((Pts,pts),axis=1)
 *                 ind = np.concatenate((ind,iind[indin]))
 *                 dS = np.concatenate((dS,dY0r*dZ0r*np.ones((indin.sum(),))))             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
        __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyFloat_FromDouble((__pyx_v_dY0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_indin, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_9)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_9);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_9) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1430, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1430, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_5 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_4, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
            __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
            PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
            __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyNumber_Multiply(__pyx_t_10, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1430, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_INCREF(((PyObject *)__pyx_v_dS));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
        PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dS));
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_4 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (!__pyx_t_4) {
          __pyx_t_27 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1430, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_27);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_1};
            __pyx_t_27 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_1};
            __pyx_t_27 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else
          #endif
          {
            __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4); __pyx_t_4 = NULL;
            __Pyx_GIVEREF(__pyx_t_1);
            PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_1);
            __pyx_t_1 = 0;
            __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1430, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_27);
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1430, __pyx_L1_error)
        __pyx_t_26 = ((PyArrayObject *)__pyx_t_27);
        {
          __Pyx_BufFmt_StackElem __pyx_stack[1];
          __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
          __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
          if (unlikely(__pyx_t_16 < 0)) {
            PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
            if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
              Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
              __Pyx_RaiseBufferFallbackError();
            } else {
              PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
            }
            __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
          }
          __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
          if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1430, __pyx_L1_error)
        }
        __pyx_t_26 = 0;
        __Pyx_DECREF_SET(__pyx_v_dS, ((PyArrayObject *)__pyx_t_27));
        __pyx_t_27 = 0;

        /* "tofu/geom/_GG03.pyx":1426
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):             # <<<<<<<<<<<<<<
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 *                 Pts = np.concatenate((Pts,pts),axis=1)
 */
      }

      /* "tofu/geom/_GG03.pyx":1422
 *                 ind = np.concatenate((iind[indin], ind))
 *                 dS = np.concatenate((dY0r*dZ0r*np.ones((indin.sum(),)),dS))
 *         if DX is None or DX[1] is None:             # <<<<<<<<<<<<<<
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 */
    }

    /* "tofu/geom/_GG03.pyx":1384
 *     InterZ, DZ = _check_DLvsLMinMax(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]),DZ)
 * 
 *     if InterX==1 and InterY==1 and InterZ==1:             # <<<<<<<<<<<<<<
 * 
 *         # Get the mesh for the faces
 */
    goto __pyx_L9;
  }

  /* "tofu/geom/_GG03.pyx":1433
 * 
 *     else:
 *         Pts, dS, ind, NL, dLr, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.ones((0,)), np.ones((0,))             # <<<<<<<<<<<<<<
 *         dXr, dY0r, dZ0r, VPbis = 0., 0., 0., np.ones((3,0))
 * 
 */
  /*else*/ {
    __pyx_t_27 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_27);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_27, __pyx_n_s_ones); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_27); __pyx_t_27 = 0;
    __pyx_t_27 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple__226, NULL); if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_27);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (!(likely(((__pyx_t_27) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_27, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__228, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__230, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__232, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__234, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__236, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1433, __pyx_L1_error)
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_27);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_27);
    __pyx_t_27 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_7);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_7);
    __pyx_t_7 = 0;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_4);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_ind = ((PyArrayObject *)__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_22 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    __pyx_t_22 = 0;
    __pyx_v_NL = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_10);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_dLr = ((PyArrayObject *)__pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_26 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_26, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_19, &__pyx_t_20, &__pyx_t_21);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_21);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_19, __pyx_t_20, __pyx_t_21);
        }
        __pyx_t_19 = __pyx_t_20 = __pyx_t_21 = 0;
      }
      __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1433, __pyx_L1_error)
    }
    __pyx_t_26 = 0;
    __pyx_v_Rref = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":1434
 *     else:
 *         Pts, dS, ind, NL, dLr, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.ones((0,)), np.ones((0,))
 *         dXr, dY0r, dZ0r, VPbis = 0., 0., 0., np.ones((3,0))             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dS, ind, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis
 */
    __pyx_t_15 = 0.;
    __pyx_t_32 = 0.;
    __pyx_t_33 = 0.;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__238, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1434, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1434, __pyx_L1_error)
    __pyx_v_dXr = __pyx_t_15;
    __pyx_v_dY0r = __pyx_t_32;
    __pyx_v_dZ0r = __pyx_t_33;
    __pyx_t_25 = ((PyArrayObject *)__pyx_t_1);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
      __pyx_t_16 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_16 < 0)) {
        PyErr_Fetch(&__pyx_t_21, &__pyx_t_20, &__pyx_t_19);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_21); Py_XDECREF(__pyx_t_20); Py_XDECREF(__pyx_t_19);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_21, __pyx_t_20, __pyx_t_19);
        }
        __pyx_t_21 = __pyx_t_20 = __pyx_t_19 = 0;
      }
      __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 1434, __pyx_L1_error)
    }
    __pyx_t_25 = 0;
    __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
  }
  __pyx_L9:;

  /* "tofu/geom/_GG03.pyx":1436
 *         dXr, dY0r, dZ0r, VPbis = 0., 0., 0., np.ones((3,0))
 * 
 *     return Pts, dS, ind, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_dY0r); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_dZ0r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = PyTuple_New(10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(((PyObject *)__pyx_v_ind));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ind));
  PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_v_ind));
  __Pyx_INCREF(((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_NL));
  PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_v_NL));
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_v_dLr));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
  PyTuple_SET_ITEM(__pyx_t_4, 5, ((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_VPbis));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_VPbis));
  PyTuple_SET_ITEM(__pyx_t_4, 9, ((PyObject *)__pyx_v_VPbis));
  __pyx_t_1 = 0;
  __pyx_t_10 = 0;
  __pyx_t_9 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1366
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_27);
  __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Lin_SubFromD_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_X);
  __Pyx_XDECREF((PyObject *)__pyx_v_Y0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Z0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsCross);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPbis);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_indX);
  __Pyx_XDECREF((PyObject *)__pyx_v_indY0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indZ0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indL);
  __Pyx_XDECREF((PyObject *)__pyx_v_NL);
  __Pyx_XDECREF((PyObject *)__pyx_v_ind);
  __Pyx_XDECREF(__pyx_v_InterX);
  __Pyx_XDECREF(__pyx_v_InterY);
  __Pyx_XDECREF(__pyx_v_InterZ);
  __Pyx_XDECREF(__pyx_v_indin);
  __Pyx_XDECREF(__pyx_v_pts);
  __Pyx_XDECREF(__pyx_v_iind);
  __PYX_XDEC_MEMVIEW(&__pyx_v_XMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __Pyx_XDECREF(__pyx_v_DX);
  __Pyx_XDECREF(__pyx_v_DY);
  __Pyx_XDECREF(__pyx_v_DZ);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1443
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                      double DIn=0., VIn=None, double margin=1.e-9):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_43_Ves_Smesh_Lin_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_42_Ves_Smesh_Lin_SubFromInd_cython[] = " Return the desired surfacic submesh indicated by ind, for the desired resolution (dX,dL) ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_43_Ves_Smesh_Lin_SubFromInd_cython = {"_Ves_Smesh_Lin_SubFromInd_cython", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_43_Ves_Smesh_Lin_SubFromInd_cython, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_42_Ves_Smesh_Lin_SubFromInd_cython};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_43_Ves_Smesh_Lin_SubFromInd_cython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_XMinMax = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_v_dL;
  double __pyx_v_dX;
  __Pyx_memviewslice __pyx_v_VPoly = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyArrayObject *__pyx_v_ind = 0;
  double __pyx_v_DIn;
  PyObject *__pyx_v_VIn = 0;
  double __pyx_v_margin;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_Ves_Smesh_Lin_SubFromInd_cython (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_XMinMax,&__pyx_n_s_dL,&__pyx_n_s_dX,&__pyx_n_s_VPoly,&__pyx_n_s_ind,&__pyx_n_s_DIn,&__pyx_n_s_VIn,&__pyx_n_s_margin,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":1445
 * def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX,
 *                                      double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                      double DIn=0., VIn=None, double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     " Return the desired surfacic submesh indicated by ind, for the desired resolution (dX,dL) "
 *     cdef double dXr, dY0r, dZ0r
 */
    values[6] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_XMinMax)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromInd_cython", 0, 5, 8, 1); __PYX_ERR(0, 1443, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromInd_cython", 0, 5, 8, 2); __PYX_ERR(0, 1443, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromInd_cython", 0, 5, 8, 3); __PYX_ERR(0, 1443, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ind)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromInd_cython", 0, 5, 8, 4); __PYX_ERR(0, 1443, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DIn);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_margin);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_Ves_Smesh_Lin_SubFromInd_cython") < 0)) __PYX_ERR(0, 1443, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_XMinMax = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[0]); if (unlikely(!__pyx_v_XMinMax.memview)) __PYX_ERR(0, 1443, __pyx_L3_error)
    __pyx_v_dL = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_dL == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1443, __pyx_L3_error)
    __pyx_v_dX = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_dX == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1443, __pyx_L3_error)
    __pyx_v_VPoly = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3]); if (unlikely(!__pyx_v_VPoly.memview)) __PYX_ERR(0, 1444, __pyx_L3_error)
    __pyx_v_ind = ((PyArrayObject *)values[4]);
    if (values[5]) {
      __pyx_v_DIn = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_DIn == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1445, __pyx_L3_error)
    } else {
      __pyx_v_DIn = ((double)0.);
    }
    __pyx_v_VIn = values[6];
    if (values[7]) {
      __pyx_v_margin = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_margin == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1445, __pyx_L3_error)
    } else {
      __pyx_v_margin = ((double)1.e-9);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_Ves_Smesh_Lin_SubFromInd_cython", 0, 5, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1443, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Lin_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ind), __pyx_ptype_5numpy_ndarray, 1, "ind", 0))) __PYX_ERR(0, 1444, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_42_Ves_Smesh_Lin_SubFromInd_cython(__pyx_self, __pyx_v_XMinMax, __pyx_v_dL, __pyx_v_dX, __pyx_v_VPoly, __pyx_v_ind, __pyx_v_DIn, __pyx_v_VIn, __pyx_v_margin);

  /* "tofu/geom/_GG03.pyx":1443
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                      double DIn=0., VIn=None, double margin=1.e-9):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_42_Ves_Smesh_Lin_SubFromInd_cython(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_XMinMax, double __pyx_v_dL, double __pyx_v_dX, __Pyx_memviewslice __pyx_v_VPoly, PyArrayObject *__pyx_v_ind, double __pyx_v_DIn, PyObject *__pyx_v_VIn, double __pyx_v_margin) {
  double __pyx_v_dXr;
  double __pyx_v_dY0r;
  double __pyx_v_dZ0r;
  int __pyx_v_NX;
  int __pyx_v_NY0;
  int __pyx_v_NZ0;
  int __pyx_v_Ln;
  int __pyx_v_nii;
  PyObject *__pyx_v_LPts = 0;
  PyObject *__pyx_v_LdS = 0;
  PyArrayObject *__pyx_v_Pts = 0;
  PyArrayObject *__pyx_v_PtsCross = 0;
  PyArrayObject *__pyx_v_VPbis = 0;
  PyArrayObject *__pyx_v_X = 0;
  PyArrayObject *__pyx_v_Y0 = 0;
  PyArrayObject *__pyx_v_Z0 = 0;
  PyArrayObject *__pyx_v_dS = 0;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_Rref = 0;
  PyArrayObject *__pyx_v_indX = 0;
  PyArrayObject *__pyx_v_indY0 = 0;
  PyArrayObject *__pyx_v_indZ0 = 0;
  PyArrayObject *__pyx_v_indL = 0;
  PyArrayObject *__pyx_v_NL = 0;
  PyArrayObject *__pyx_v_ii = 0;
  CYTHON_UNUSED PyObject *__pyx_v_bla = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_NL;
  __Pyx_Buffer __pyx_pybuffer_NL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Pts;
  __Pyx_Buffer __pyx_pybuffer_Pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PtsCross;
  __Pyx_Buffer __pyx_pybuffer_PtsCross;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Rref;
  __Pyx_Buffer __pyx_pybuffer_Rref;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPbis;
  __Pyx_Buffer __pyx_pybuffer_VPbis;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_X;
  __Pyx_Buffer __pyx_pybuffer_X;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Y0;
  __Pyx_Buffer __pyx_pybuffer_Y0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Z0;
  __Pyx_Buffer __pyx_pybuffer_Z0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dS;
  __Pyx_Buffer __pyx_pybuffer_dS;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ii;
  __Pyx_Buffer __pyx_pybuffer_ii;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ind;
  __Pyx_Buffer __pyx_pybuffer_ind;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indL;
  __Pyx_Buffer __pyx_pybuffer_indL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indX;
  __Pyx_Buffer __pyx_pybuffer_indX;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indY0;
  __Pyx_Buffer __pyx_pybuffer_indY0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indZ0;
  __Pyx_Buffer __pyx_pybuffer_indZ0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  double __pyx_t_12;
  int __pyx_t_13;
  PyArrayObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyArrayObject *__pyx_t_19 = NULL;
  PyArrayObject *__pyx_t_20 = NULL;
  Py_ssize_t __pyx_t_21;
  int __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  int __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  __Pyx_RefNannySetupContext("_Ves_Smesh_Lin_SubFromInd_cython", 0);
  __pyx_pybuffer_Pts.pybuffer.buf = NULL;
  __pyx_pybuffer_Pts.refcount = 0;
  __pyx_pybuffernd_Pts.data = NULL;
  __pyx_pybuffernd_Pts.rcbuffer = &__pyx_pybuffer_Pts;
  __pyx_pybuffer_PtsCross.pybuffer.buf = NULL;
  __pyx_pybuffer_PtsCross.refcount = 0;
  __pyx_pybuffernd_PtsCross.data = NULL;
  __pyx_pybuffernd_PtsCross.rcbuffer = &__pyx_pybuffer_PtsCross;
  __pyx_pybuffer_VPbis.pybuffer.buf = NULL;
  __pyx_pybuffer_VPbis.refcount = 0;
  __pyx_pybuffernd_VPbis.data = NULL;
  __pyx_pybuffernd_VPbis.rcbuffer = &__pyx_pybuffer_VPbis;
  __pyx_pybuffer_X.pybuffer.buf = NULL;
  __pyx_pybuffer_X.refcount = 0;
  __pyx_pybuffernd_X.data = NULL;
  __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X;
  __pyx_pybuffer_Y0.pybuffer.buf = NULL;
  __pyx_pybuffer_Y0.refcount = 0;
  __pyx_pybuffernd_Y0.data = NULL;
  __pyx_pybuffernd_Y0.rcbuffer = &__pyx_pybuffer_Y0;
  __pyx_pybuffer_Z0.pybuffer.buf = NULL;
  __pyx_pybuffer_Z0.refcount = 0;
  __pyx_pybuffernd_Z0.data = NULL;
  __pyx_pybuffernd_Z0.rcbuffer = &__pyx_pybuffer_Z0;
  __pyx_pybuffer_dS.pybuffer.buf = NULL;
  __pyx_pybuffer_dS.refcount = 0;
  __pyx_pybuffernd_dS.data = NULL;
  __pyx_pybuffernd_dS.rcbuffer = &__pyx_pybuffer_dS;
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_Rref.pybuffer.buf = NULL;
  __pyx_pybuffer_Rref.refcount = 0;
  __pyx_pybuffernd_Rref.data = NULL;
  __pyx_pybuffernd_Rref.rcbuffer = &__pyx_pybuffer_Rref;
  __pyx_pybuffer_indX.pybuffer.buf = NULL;
  __pyx_pybuffer_indX.refcount = 0;
  __pyx_pybuffernd_indX.data = NULL;
  __pyx_pybuffernd_indX.rcbuffer = &__pyx_pybuffer_indX;
  __pyx_pybuffer_indY0.pybuffer.buf = NULL;
  __pyx_pybuffer_indY0.refcount = 0;
  __pyx_pybuffernd_indY0.data = NULL;
  __pyx_pybuffernd_indY0.rcbuffer = &__pyx_pybuffer_indY0;
  __pyx_pybuffer_indZ0.pybuffer.buf = NULL;
  __pyx_pybuffer_indZ0.refcount = 0;
  __pyx_pybuffernd_indZ0.data = NULL;
  __pyx_pybuffernd_indZ0.rcbuffer = &__pyx_pybuffer_indZ0;
  __pyx_pybuffer_indL.pybuffer.buf = NULL;
  __pyx_pybuffer_indL.refcount = 0;
  __pyx_pybuffernd_indL.data = NULL;
  __pyx_pybuffernd_indL.rcbuffer = &__pyx_pybuffer_indL;
  __pyx_pybuffer_NL.pybuffer.buf = NULL;
  __pyx_pybuffer_NL.refcount = 0;
  __pyx_pybuffernd_NL.data = NULL;
  __pyx_pybuffernd_NL.rcbuffer = &__pyx_pybuffer_NL;
  __pyx_pybuffer_ii.pybuffer.buf = NULL;
  __pyx_pybuffer_ii.refcount = 0;
  __pyx_pybuffernd_ii.data = NULL;
  __pyx_pybuffernd_ii.rcbuffer = &__pyx_pybuffer_ii;
  __pyx_pybuffer_ind.pybuffer.buf = NULL;
  __pyx_pybuffer_ind.refcount = 0;
  __pyx_pybuffernd_ind.data = NULL;
  __pyx_pybuffernd_ind.rcbuffer = &__pyx_pybuffer_ind;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ind.rcbuffer->pybuffer, (PyObject*)__pyx_v_ind, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1443, __pyx_L1_error)
  }
  __pyx_pybuffernd_ind.diminfo[0].strides = __pyx_pybuffernd_ind.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ind.diminfo[0].shape = __pyx_pybuffernd_ind.rcbuffer->pybuffer.shape[0];

  /* "tofu/geom/_GG03.pyx":1455
 * 
 *     # Get the mesh for the faces
 *     Y0, dY0r, bla, NY0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     Z0, dZ0r, bla, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7.data = __pyx_v_VPoly.data;
  __pyx_t_7.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1455, __pyx_L1_error)
    }
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_7.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_7.data = __pyx_v_VPoly.data;
  __pyx_t_7.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1455, __pyx_L1_error)
    }
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_7.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 1455, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1455, __pyx_L1_error)
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_margin, __pyx_t_2) < 0) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1455, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_3,&__pyx_t_1,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1455, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_3,&__pyx_t_1,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1455, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 4) < 0) __PYX_ERR(0, 1455, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1455, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1455, __pyx_L1_error)
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1455, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer, (PyObject*)__pyx_v_Y0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
    }
    __pyx_pybuffernd_Y0.diminfo[0].strides = __pyx_pybuffernd_Y0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Y0.diminfo[0].shape = __pyx_pybuffernd_Y0.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 1455, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_Y0 = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_v_dY0r = __pyx_t_12;
  __pyx_v_bla = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_NY0 = __pyx_t_13;

  /* "tofu/geom/_GG03.pyx":1456
 *     # Get the mesh for the faces
 *     Y0, dY0r, bla, NY0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[0,:]),np.max(VPoly[0,:])]), dL, DL=None, Lim=True, margin=margin)
 *     Z0, dZ0r, bla, NZ0 = _Ves_mesh_dlfromL_cython(np.array([np.min(VPoly[1,:]),np.max(VPoly[1,:])]), dL, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 * 
 *     # Get the actual R and Z resolutions and mesh elements
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_min); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7.data = __pyx_v_VPoly.data;
  __pyx_t_7.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1456, __pyx_L1_error)
    }
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_7.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__pyx_t_4 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_10) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_max); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_7.data = __pyx_v_VPoly.data;
  __pyx_t_7.memview = __pyx_v_VPoly.memview;
  __PYX_INC_MEMVIEW(&__pyx_t_7, 0);
  {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1456, __pyx_L1_error)
    }
        __pyx_t_7.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_7.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_7.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_7.suboffsets[0] = -1;

__pyx_t_9 = __pyx_memoryview_fromslice(__pyx_t_7, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __pyx_t_7.memview = NULL;
  __pyx_t_7.data = NULL;
  __pyx_t_10 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_10) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_9};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __pyx_t_5 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 1456, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1456, __pyx_L1_error)
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_margin, __pyx_t_5) < 0) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1456, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_2,&__pyx_t_4};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1456, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_2,&__pyx_t_4};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_6); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 4) < 0) __PYX_ERR(0, 1456, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1456, __pyx_L1_error)
    __pyx_L6_unpacking_done:;
  }
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1456, __pyx_L1_error)
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1456, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer, (PyObject*)__pyx_v_Z0, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
      __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_Z0.diminfo[0].strides = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Z0.diminfo[0].shape = __pyx_pybuffernd_Z0.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 1456, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_Z0 = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_dZ0r = __pyx_t_12;
  __Pyx_DECREF_SET(__pyx_v_bla, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_NZ0 = __pyx_t_13;

  /* "tofu/geom/_GG03.pyx":1459
 * 
 *     # Get the actual R and Z resolutions and mesh elements
 *     X, dXr, bla, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DL=None, Lim=True, margin=margin)             # <<<<<<<<<<<<<<
 *     PtsCross, dLr, bla, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *     Ln = PtsCross.shape[1]
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_mesh_dlfromL_cython); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_XMinMax, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __pyx_t_4 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_DL, Py_None) < 0) __PYX_ERR(0, 1459, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Lim, Py_True) < 0) __PYX_ERR(0, 1459, __pyx_L1_error)
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_margin, __pyx_t_4) < 0) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
    PyObject* sequence = __pyx_t_4;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1459, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_3);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_5,&__pyx_t_3};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1459, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_1,&__pyx_t_5,&__pyx_t_3};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_6); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 4) < 0) __PYX_ERR(0, 1459, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1459, __pyx_L1_error)
    __pyx_L8_unpacking_done:;
  }
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1459, __pyx_L1_error)
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1459, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
    __pyx_t_15 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_15 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
    }
    __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 1459, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_X = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_v_dXr = __pyx_t_12;
  __Pyx_DECREF_SET(__pyx_v_bla, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_v_NX = __pyx_t_13;

  /* "tofu/geom/_GG03.pyx":1460
 *     # Get the actual R and Z resolutions and mesh elements
 *     X, dXr, bla, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DL=None, Lim=True, margin=margin)
 *     PtsCross, dLr, bla, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)             # <<<<<<<<<<<<<<
 *     Ln = PtsCross.shape[1]
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_Ves_Smesh_Cross); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_VPoly, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_dL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_D1, Py_None) < 0) __PYX_ERR(0, 1460, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_D2, Py_None) < 0) __PYX_ERR(0, 1460, __pyx_L1_error)
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_margin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_margin, __pyx_t_3) < 0) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_DIn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_DIn, __pyx_t_3) < 0) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_VIn, __pyx_v_VIn) < 0) __PYX_ERR(0, 1460, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 6)) {
      if (size > 6) __Pyx_RaiseTooManyValuesError(6);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 1460, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 5); 
    } else {
      __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 4); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 5); 
    }
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_t_8);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[6] = {&__pyx_t_5,&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_6,&__pyx_t_8};
      for (i=0; i < 6; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1460, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[6] = {&__pyx_t_5,&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_6,&__pyx_t_8};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1460, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = Py_TYPE(__pyx_t_9)->tp_iternext;
    for (index=0; index < 6; index++) {
      PyObject* item = __pyx_t_11(__pyx_t_9); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_9), 6) < 0) __PYX_ERR(0, 1460, __pyx_L1_error)
    __pyx_t_11 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 1460, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1460, __pyx_L1_error)
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1460, __pyx_L1_error)
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1460, __pyx_L1_error)
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1460, __pyx_L1_error)
  if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1460, __pyx_L1_error)
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer, (PyObject*)__pyx_v_PtsCross, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
      __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_PtsCross.diminfo[0].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PtsCross.diminfo[0].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PtsCross.diminfo[1].strides = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PtsCross.diminfo[1].shape = __pyx_pybuffernd_PtsCross.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1460, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_PtsCross = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_v_dLr, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
    }
    __pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1460, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_dLr = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_bla, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_20 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_NL.rcbuffer->pybuffer, (PyObject*)__pyx_v_NL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
      __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_NL.diminfo[0].strides = __pyx_pybuffernd_NL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_NL.diminfo[0].shape = __pyx_pybuffernd_NL.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1460, __pyx_L1_error)
  }
  __pyx_t_20 = 0;
  __pyx_v_NL = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_14 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer, (PyObject*)__pyx_v_Rref, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
    }
    __pyx_pybuffernd_Rref.diminfo[0].strides = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Rref.diminfo[0].shape = __pyx_pybuffernd_Rref.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1460, __pyx_L1_error)
  }
  __pyx_t_14 = 0;
  __pyx_v_Rref = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_19 = ((PyArrayObject *)__pyx_t_8);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPbis, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
      __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_VPbis.diminfo[0].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPbis.diminfo[0].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPbis.diminfo[1].strides = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPbis.diminfo[1].shape = __pyx_pybuffernd_VPbis.rcbuffer->pybuffer.shape[1];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1460, __pyx_L1_error)
  }
  __pyx_t_19 = 0;
  __pyx_v_VPbis = ((PyArrayObject *)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "tofu/geom/_GG03.pyx":1461
 *     X, dXr, bla, NX = _Ves_mesh_dlfromL_cython(XMinMax, dX, DL=None, Lim=True, margin=margin)
 *     PtsCross, dLr, bla, NL, Rref, VPbis = _Ves_Smesh_Cross(VPoly, dL, D1=None, D2=None, margin=margin, DIn=DIn, VIn=VIn)
 *     Ln = PtsCross.shape[1]             # <<<<<<<<<<<<<<
 * 
 *     LPts, LdS = [], []
 */
  __pyx_v_Ln = (__pyx_v_PtsCross->dimensions[1]);

  /* "tofu/geom/_GG03.pyx":1463
 *     Ln = PtsCross.shape[1]
 * 
 *     LPts, LdS = [], []             # <<<<<<<<<<<<<<
 *     # First face
 *     ii = (ind<NY0*NZ0).nonzero()[0]
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1463, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_v_LPts = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_v_LdS = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "tofu/geom/_GG03.pyx":1465
 *     LPts, LdS = [], []
 *     # First face
 *     ii = (ind<NY0*NZ0).nonzero()[0]             # <<<<<<<<<<<<<<
 *     nii = len(ii)
 *     if nii>0:
 */
  __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_6) {
    __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1465, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  } else {
    __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1465, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_8, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1465, __pyx_L1_error)
  __pyx_t_20 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ii.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ii.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ii.rcbuffer->pybuffer, (PyObject*)__pyx_v_ii, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
    }
    __pyx_pybuffernd_ii.diminfo[0].strides = __pyx_pybuffernd_ii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ii.diminfo[0].shape = __pyx_pybuffernd_ii.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1465, __pyx_L1_error)
  }
  __pyx_t_20 = 0;
  __pyx_v_ii = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":1466
 *     # First face
 *     ii = (ind<NY0*NZ0).nonzero()[0]
 *     nii = len(ii)             # <<<<<<<<<<<<<<
 *     if nii>0:
 *         indZ0 = ind[ii] // NY0
 */
  __pyx_t_21 = PyObject_Length(((PyObject *)__pyx_v_ii)); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1466, __pyx_L1_error)
  __pyx_v_nii = __pyx_t_21;

  /* "tofu/geom/_GG03.pyx":1467
 *     ii = (ind<NY0*NZ0).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = ind[ii] // NY0
 *         indY0 = (ind[ii]-indZ0*NY0)
 */
  __pyx_t_22 = ((__pyx_v_nii > 0) != 0);
  if (__pyx_t_22) {

    /* "tofu/geom/_GG03.pyx":1468
 *     nii = len(ii)
 *     if nii>0:
 *         indZ0 = ind[ii] // NY0             # <<<<<<<<<<<<<<
 *         indY0 = (ind[ii]-indZ0*NY0)
 *         if nii==1:
 */
    __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_ii)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_NY0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyNumber_FloorDivide(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1468, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1468, __pyx_L1_error)
    __pyx_t_20 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
        }
        __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
      }
      __pyx_pybuffernd_indZ0.diminfo[0].strides = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ0.diminfo[0].shape = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1468, __pyx_L1_error)
    }
    __pyx_t_20 = 0;
    __pyx_v_indZ0 = ((PyArrayObject *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1469
 *     if nii>0:
 *         indZ0 = ind[ii] // NY0
 *         indY0 = (ind[ii]-indZ0*NY0)             # <<<<<<<<<<<<<<
 *         if nii==1:
 *             LPts.append( np.array([[XMinMax[0]+DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 */
    __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_ii)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_NY0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_indZ0), __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1469, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1469, __pyx_L1_error)
    __pyx_t_20 = ((PyArrayObject *)__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indY0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
      }
      __pyx_pybuffernd_indY0.diminfo[0].strides = __pyx_pybuffernd_indY0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indY0.diminfo[0].shape = __pyx_pybuffernd_indY0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1469, __pyx_L1_error)
    }
    __pyx_t_20 = 0;
    __pyx_v_indY0 = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "tofu/geom/_GG03.pyx":1470
 *         indZ0 = ind[ii] // NY0
 *         indY0 = (ind[ii]-indZ0*NY0)
 *         if nii==1:             # <<<<<<<<<<<<<<
 *             LPts.append( np.array([[XMinMax[0]+DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 *         else:
 */
    __pyx_t_22 = ((__pyx_v_nii == 1) != 0);
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1471
 *         indY0 = (ind[ii]-indZ0*NY0)
 *         if nii==1:
 *             LPts.append( np.array([[XMinMax[0]+DIn], [Y0[indY0]], [Z0[indZ0]]]) )             # <<<<<<<<<<<<<<
 *         else:
 *             LPts.append( np.array([(XMinMax[0]+DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) )
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_23 = 0;
      __pyx_t_3 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_XMinMax.data) + __pyx_t_23)) ))) + __pyx_v_DIn)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_Y0), ((PyObject *)__pyx_v_indY0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1471, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1471, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1471, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1471, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1471, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_8); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1471, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":1470
 *         indZ0 = ind[ii] // NY0
 *         indY0 = (ind[ii]-indZ0*NY0)
 *         if nii==1:             # <<<<<<<<<<<<<<
 *             LPts.append( np.array([[XMinMax[0]+DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 *         else:
 */
      goto __pyx_L12;
    }

    /* "tofu/geom/_GG03.pyx":1473
 *             LPts.append( np.array([[XMinMax[0]+DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 *         else:
 *             LPts.append( np.array([(XMinMax[0]+DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) )             # <<<<<<<<<<<<<<
 *         LdS.append( dY0r*dZ0r*np.ones((nii,)) )
 * 
 */
    /*else*/ {
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_25 = 0;
      __pyx_t_6 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_XMinMax.data) + __pyx_t_25)) ))) + __pyx_v_DIn)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nii); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
          __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
          __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_Y0), ((PyObject *)__pyx_v_indY0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = PyList_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_9, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_9, 2, __pyx_t_6);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1473, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_9};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_9};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        } else
        #endif
        {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1473, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_8); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1473, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __pyx_L12:;

    /* "tofu/geom/_GG03.pyx":1474
 *         else:
 *             LPts.append( np.array([(XMinMax[0]+DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) )
 *         LdS.append( dY0r*dZ0r*np.ones((nii,)) )             # <<<<<<<<<<<<<<
 * 
 *     # Cylinder
 */
    __pyx_t_8 = PyFloat_FromDouble((__pyx_v_dY0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_nii); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1474, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1474, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1474, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1474, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1474, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Multiply(__pyx_t_8, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_9); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1474, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":1467
 *     ii = (ind<NY0*NZ0).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = ind[ii] // NY0
 *         indY0 = (ind[ii]-indZ0*NY0)
 */
  }

  /* "tofu/geom/_GG03.pyx":1477
 * 
 *     # Cylinder
 *     ii = ((ind>=NY0*NZ0) & (ind<NY0*NZ0+NX*Ln)).nonzero()[0]             # <<<<<<<<<<<<<<
 *     nii = len(ii)
 *     if nii>0:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(((__pyx_v_NY0 * __pyx_v_NZ0) + (__pyx_v_NX * __pyx_v_Ln))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_And(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1477, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1477, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1477, __pyx_L1_error)
  __pyx_t_20 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ii.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ii.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ii.rcbuffer->pybuffer, (PyObject*)__pyx_v_ii, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
      }
      __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
    }
    __pyx_pybuffernd_ii.diminfo[0].strides = __pyx_pybuffernd_ii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ii.diminfo[0].shape = __pyx_pybuffernd_ii.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1477, __pyx_L1_error)
  }
  __pyx_t_20 = 0;
  __Pyx_DECREF_SET(__pyx_v_ii, ((PyArrayObject *)__pyx_t_2));
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":1478
 *     # Cylinder
 *     ii = ((ind>=NY0*NZ0) & (ind<NY0*NZ0+NX*Ln)).nonzero()[0]
 *     nii = len(ii)             # <<<<<<<<<<<<<<
 *     if nii>0:
 *         indX = (ind[ii]-NY0*NZ0) // Ln
 */
  __pyx_t_21 = PyObject_Length(((PyObject *)__pyx_v_ii)); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1478, __pyx_L1_error)
  __pyx_v_nii = __pyx_t_21;

  /* "tofu/geom/_GG03.pyx":1479
 *     ii = ((ind>=NY0*NZ0) & (ind<NY0*NZ0+NX*Ln)).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indX = (ind[ii]-NY0*NZ0) // Ln
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)
 */
  __pyx_t_22 = ((__pyx_v_nii > 0) != 0);
  if (__pyx_t_22) {

    /* "tofu/geom/_GG03.pyx":1480
 *     nii = len(ii)
 *     if nii>0:
 *         indX = (ind[ii]-NY0*NZ0) // Ln             # <<<<<<<<<<<<<<
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)
 *         if nii==1:
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_ii)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyNumber_FloorDivide(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1480, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1480, __pyx_L1_error)
    __pyx_t_20 = ((PyArrayObject *)__pyx_t_2);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indX.rcbuffer->pybuffer, (PyObject*)__pyx_v_indX, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
      }
      __pyx_pybuffernd_indX.diminfo[0].strides = __pyx_pybuffernd_indX.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indX.diminfo[0].shape = __pyx_pybuffernd_indX.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1480, __pyx_L1_error)
    }
    __pyx_t_20 = 0;
    __pyx_v_indX = ((PyArrayObject *)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":1481
 *     if nii>0:
 *         indX = (ind[ii]-NY0*NZ0) // Ln
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)             # <<<<<<<<<<<<<<
 *         if nii==1:
 *             LPts.append( np.array([[X[indX]], [PtsCross[0,indL]], [PtsCross[1,indL]]]) )
 */
    __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_ii)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_Ln); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyNumber_Multiply(__pyx_t_9, ((PyObject *)__pyx_v_indX)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1481, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1481, __pyx_L1_error)
    __pyx_t_20 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indL.rcbuffer->pybuffer, (PyObject*)__pyx_v_indL, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
        }
        __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
      }
      __pyx_pybuffernd_indL.diminfo[0].strides = __pyx_pybuffernd_indL.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indL.diminfo[0].shape = __pyx_pybuffernd_indL.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1481, __pyx_L1_error)
    }
    __pyx_t_20 = 0;
    __pyx_v_indL = ((PyArrayObject *)__pyx_t_9);
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":1482
 *         indX = (ind[ii]-NY0*NZ0) // Ln
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)
 *         if nii==1:             # <<<<<<<<<<<<<<
 *             LPts.append( np.array([[X[indX]], [PtsCross[0,indL]], [PtsCross[1,indL]]]) )
 *             LdS.append( np.array([dXr*dLr[indL]]) )
 */
    __pyx_t_22 = ((__pyx_v_nii == 1) != 0);
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1483
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)
 *         if nii==1:
 *             LPts.append( np.array([[X[indX]], [PtsCross[0,indL]], [PtsCross[1,indL]]]) )             # <<<<<<<<<<<<<<
 *             LdS.append( np.array([dXr*dLr[indL]]) )
 *         else:
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_v_indX)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_0);
      __Pyx_INCREF(((PyObject *)__pyx_v_indL));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indL));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_indL));
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_indL));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indL));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_indL));
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1483, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1483, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1483, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1483, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_9); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1483, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "tofu/geom/_GG03.pyx":1484
 *         if nii==1:
 *             LPts.append( np.array([[X[indX]], [PtsCross[0,indL]], [PtsCross[1,indL]]]) )
 *             LdS.append( np.array([dXr*dLr[indL]]) )             # <<<<<<<<<<<<<<
 *         else:
 *             LPts.append( np.array([X[indX], PtsCross[0,indL], PtsCross[1,indL]]) )
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), ((PyObject *)__pyx_v_indL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_6) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1484, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1484, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1484, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1484, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1484, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_9); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1484, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "tofu/geom/_GG03.pyx":1482
 *         indX = (ind[ii]-NY0*NZ0) // Ln
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)
 *         if nii==1:             # <<<<<<<<<<<<<<
 *             LPts.append( np.array([[X[indX]], [PtsCross[0,indL]], [PtsCross[1,indL]]]) )
 *             LdS.append( np.array([dXr*dLr[indL]]) )
 */
      goto __pyx_L14;
    }

    /* "tofu/geom/_GG03.pyx":1486
 *             LdS.append( np.array([dXr*dLr[indL]]) )
 *         else:
 *             LPts.append( np.array([X[indX], PtsCross[0,indL], PtsCross[1,indL]]) )             # <<<<<<<<<<<<<<
 *             LdS.append( dXr*dLr[indL] )
 * 
 */
    /*else*/ {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_v_indX)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
      __Pyx_INCREF(((PyObject *)__pyx_v_indL));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indL));
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_indL));
      __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
      __Pyx_INCREF(((PyObject *)__pyx_v_indL));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_indL));
      PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_indL));
      __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_PtsCross), __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_8);
      __pyx_t_2 = 0;
      __pyx_t_6 = 0;
      __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1486, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_9);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
          __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1486, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
          __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1486, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1486, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1486, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_9); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1486, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "tofu/geom/_GG03.pyx":1487
 *         else:
 *             LPts.append( np.array([X[indX], PtsCross[0,indL], PtsCross[1,indL]]) )
 *             LdS.append( dXr*dLr[indL] )             # <<<<<<<<<<<<<<
 * 
 *     # End face
 */
      __pyx_t_9 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_dLr), ((PyObject *)__pyx_v_indL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_6 = PyNumber_Multiply(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1487, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_6); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1487, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L14:;

    /* "tofu/geom/_GG03.pyx":1479
 *     ii = ((ind>=NY0*NZ0) & (ind<NY0*NZ0+NX*Ln)).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indX = (ind[ii]-NY0*NZ0) // Ln
 *         indL = (ind[ii]-NY0*NZ0 - Ln*indX)
 */
  }

  /* "tofu/geom/_GG03.pyx":1490
 * 
 *     # End face
 *     ii = (ind >= NY0*NZ0+NX*Ln).nonzero()[0]             # <<<<<<<<<<<<<<
 *     nii = len(ii)
 *     if nii>0:
 */
  __pyx_t_4 = __Pyx_PyInt_From_int(((__pyx_v_NY0 * __pyx_v_NZ0) + (__pyx_v_NX * __pyx_v_Ln))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyObject_RichCompare(((PyObject *)__pyx_v_ind), __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_nonzero); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_9) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1490, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1490, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1490, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1490, __pyx_L1_error)
  __pyx_t_20 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ii.rcbuffer->pybuffer);
    __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ii.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
    if (unlikely(__pyx_t_13 < 0)) {
      PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ii.rcbuffer->pybuffer, (PyObject*)__pyx_v_ii, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
        Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
        __Pyx_RaiseBufferFallbackError();
      } else {
        PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
    }
    __pyx_pybuffernd_ii.diminfo[0].strides = __pyx_pybuffernd_ii.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ii.diminfo[0].shape = __pyx_pybuffernd_ii.rcbuffer->pybuffer.shape[0];
    if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1490, __pyx_L1_error)
  }
  __pyx_t_20 = 0;
  __Pyx_DECREF_SET(__pyx_v_ii, ((PyArrayObject *)__pyx_t_4));
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":1491
 *     # End face
 *     ii = (ind >= NY0*NZ0+NX*Ln).nonzero()[0]
 *     nii = len(ii)             # <<<<<<<<<<<<<<
 *     if nii>0:
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0
 */
  __pyx_t_21 = PyObject_Length(((PyObject *)__pyx_v_ii)); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1491, __pyx_L1_error)
  __pyx_v_nii = __pyx_t_21;

  /* "tofu/geom/_GG03.pyx":1492
 *     ii = (ind >= NY0*NZ0+NX*Ln).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0
 */
  __pyx_t_22 = ((__pyx_v_nii > 0) != 0);
  if (__pyx_t_22) {

    /* "tofu/geom/_GG03.pyx":1493
 *     nii = len(ii)
 *     if nii>0:
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0             # <<<<<<<<<<<<<<
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0
 *         if nii==1:
 */
    __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_ii)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_Subtract(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_NX * __pyx_v_Ln)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_NY0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_FloorDivide(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1493, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1493, __pyx_L1_error)
    __pyx_t_20 = ((PyArrayObject *)__pyx_t_9);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indZ0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
        }
        __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
      }
      __pyx_pybuffernd_indZ0.diminfo[0].strides = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indZ0.diminfo[0].shape = __pyx_pybuffernd_indZ0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1493, __pyx_L1_error)
    }
    __pyx_t_20 = 0;
    __Pyx_XDECREF_SET(__pyx_v_indZ0, ((PyArrayObject *)__pyx_t_9));
    __pyx_t_9 = 0;

    /* "tofu/geom/_GG03.pyx":1494
 *     if nii>0:
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0             # <<<<<<<<<<<<<<
 *         if nii==1:
 *             LPts.append( np.array([[XMinMax[1]-DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 */
    __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_ind), ((PyObject *)__pyx_v_ii)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_NY0 * __pyx_v_NZ0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyNumber_Subtract(__pyx_t_9, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_NX * __pyx_v_Ln)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_9 = PyNumber_Subtract(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_NY0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyNumber_Subtract(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1494, __pyx_L1_error)
    __pyx_t_20 = ((PyArrayObject *)__pyx_t_6);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer, (PyObject*)__pyx_v_indY0, &__Pyx_TypeInfo_long, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
      }
      __pyx_pybuffernd_indY0.diminfo[0].strides = __pyx_pybuffernd_indY0.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indY0.diminfo[0].shape = __pyx_pybuffernd_indY0.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1494, __pyx_L1_error)
    }
    __pyx_t_20 = 0;
    __Pyx_XDECREF_SET(__pyx_v_indY0, ((PyArrayObject *)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1495
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0
 *         if nii==1:             # <<<<<<<<<<<<<<
 *             LPts.append( np.array([[XMinMax[1]-DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 *         else:
 */
    __pyx_t_22 = ((__pyx_v_nii == 1) != 0);
    if (__pyx_t_22) {

      /* "tofu/geom/_GG03.pyx":1496
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0
 *         if nii==1:
 *             LPts.append( np.array([[XMinMax[1]-DIn], [Y0[indY0]], [Z0[indZ0]]]) )             # <<<<<<<<<<<<<<
 *         else:
 *             LPts.append( np.array([(XMinMax[1]-DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) )
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_26 = 1;
      __pyx_t_4 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_XMinMax.data) + __pyx_t_26)) ))) - __pyx_v_DIn)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_Y0), ((PyObject *)__pyx_v_indY0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_8);
      PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_2);
      PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
      __pyx_t_3 = 0;
      __pyx_t_8 = 0;
      __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        } else
        #endif
        {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1496, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_6); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1496, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":1495
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0
 *         if nii==1:             # <<<<<<<<<<<<<<
 *             LPts.append( np.array([[XMinMax[1]-DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 *         else:
 */
      goto __pyx_L16;
    }

    /* "tofu/geom/_GG03.pyx":1498
 *             LPts.append( np.array([[XMinMax[1]-DIn], [Y0[indY0]], [Z0[indZ0]]]) )
 *         else:
 *             LPts.append( np.array([(XMinMax[1]-DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) )             # <<<<<<<<<<<<<<
 *         LdS.append( dY0r*dZ0r*np.ones((nii,)) )
 * 
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_array); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_27 = 1;
      __pyx_t_9 = PyFloat_FromDouble(((*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_XMinMax.data) + __pyx_t_27)) ))) - __pyx_v_DIn)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_nii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_Y0), ((PyObject *)__pyx_v_indY0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_Z0), ((PyObject *)__pyx_v_indZ0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_9);
      PyList_SET_ITEM(__pyx_t_1, 2, __pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_1};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_1};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_1);
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_1);
          __pyx_t_1 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1498, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LPts, __pyx_t_6); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1498, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __pyx_L16:;

    /* "tofu/geom/_GG03.pyx":1499
 *         else:
 *             LPts.append( np.array([(XMinMax[1]-DIn)*np.ones((nii,)), Y0[indY0], Z0[indZ0]]) )
 *         LdS.append( dY0r*dZ0r*np.ones((nii,)) )             # <<<<<<<<<<<<<<
 * 
 *     # Format output
 */
    __pyx_t_6 = PyFloat_FromDouble((__pyx_v_dY0r * __pyx_v_dZ0r)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nii); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1499, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_8);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_9};
        __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1499, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_9};
        __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1499, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
        __Pyx_GIVEREF(__pyx_t_9);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_9);
        __pyx_t_9 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1499, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_24 = __Pyx_PyList_Append(__pyx_v_LdS, __pyx_t_1); if (unlikely(__pyx_t_24 == ((int)-1))) __PYX_ERR(0, 1499, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":1492
 *     ii = (ind >= NY0*NZ0+NX*Ln).nonzero()[0]
 *     nii = len(ii)
 *     if nii>0:             # <<<<<<<<<<<<<<
 *         indZ0 = (ind[ii]-NY0*NZ0-NX*Ln) // NY0
 *         indY0 = ind[ii]-NY0*NZ0-NX*Ln - NY0*indZ0
 */
  }

  /* "tofu/geom/_GG03.pyx":1502
 * 
 *     # Format output
 *     if len(LPts)==1:             # <<<<<<<<<<<<<<
 *         Pts, dS = LPts[0], LdS[0]
 *     else:
 */
  __pyx_t_21 = PyList_GET_SIZE(__pyx_v_LPts); if (unlikely(__pyx_t_21 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1502, __pyx_L1_error)
  __pyx_t_22 = ((__pyx_t_21 == 1) != 0);
  if (__pyx_t_22) {

    /* "tofu/geom/_GG03.pyx":1503
 *     # Format output
 *     if len(LPts)==1:
 *         Pts, dS = LPts[0], LdS[0]             # <<<<<<<<<<<<<<
 *     else:
 *         Pts = np.concatenate(tuple(LPts),axis=1)
 */
    if (!(likely(((PyList_GET_ITEM(__pyx_v_LPts, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_LPts, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1503, __pyx_L1_error)
    __pyx_t_1 = PyList_GET_ITEM(__pyx_v_LPts, 0);
    __Pyx_INCREF(__pyx_t_1);
    if (!(likely(((PyList_GET_ITEM(__pyx_v_LdS, 0)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_LdS, 0), __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1503, __pyx_L1_error)
    __pyx_t_8 = PyList_GET_ITEM(__pyx_v_LdS, 0);
    __Pyx_INCREF(__pyx_t_8);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
        }
        __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1503, __pyx_L1_error)
    }
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_8), &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1503, __pyx_L1_error)
    }
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_8);
    __pyx_t_8 = 0;

    /* "tofu/geom/_GG03.pyx":1502
 * 
 *     # Format output
 *     if len(LPts)==1:             # <<<<<<<<<<<<<<
 *         Pts, dS = LPts[0], LdS[0]
 *     else:
 */
    goto __pyx_L17;
  }

  /* "tofu/geom/_GG03.pyx":1505
 *         Pts, dS = LPts[0], LdS[0]
 *     else:
 *         Pts = np.concatenate(tuple(LPts),axis=1)             # <<<<<<<<<<<<<<
 *         dS = np.concatenate(tuple(LdS))
 * 
 */
  /*else*/ {
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyList_AsTuple(__pyx_v_LPts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 1505, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1505, __pyx_L1_error)
    __pyx_t_19 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_18, &__pyx_t_17, &__pyx_t_16);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_Pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_16);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_18, __pyx_t_17, __pyx_t_16);
        }
        __pyx_t_18 = __pyx_t_17 = __pyx_t_16 = 0;
      }
      __pyx_pybuffernd_Pts.diminfo[0].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Pts.diminfo[0].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_Pts.diminfo[1].strides = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_Pts.diminfo[1].shape = __pyx_pybuffernd_Pts.rcbuffer->pybuffer.shape[1];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1505, __pyx_L1_error)
    }
    __pyx_t_19 = 0;
    __pyx_v_Pts = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1506
 *     else:
 *         Pts = np.concatenate(tuple(LPts),axis=1)
 *         dS = np.concatenate(tuple(LdS))             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dS, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_concatenate); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyList_AsTuple(__pyx_v_LdS); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1506, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
        PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_8};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1506, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL;
        __Pyx_GIVEREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1506, __pyx_L1_error)
    __pyx_t_14 = ((PyArrayObject *)__pyx_t_3);
    {
      __Pyx_BufFmt_StackElem __pyx_stack[1];
      __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
      __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
      if (unlikely(__pyx_t_13 < 0)) {
        PyErr_Fetch(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
        if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dS.rcbuffer->pybuffer, (PyObject*)__pyx_v_dS, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
          Py_XDECREF(__pyx_t_16); Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18);
          __Pyx_RaiseBufferFallbackError();
        } else {
          PyErr_Restore(__pyx_t_16, __pyx_t_17, __pyx_t_18);
        }
        __pyx_t_16 = __pyx_t_17 = __pyx_t_18 = 0;
      }
      __pyx_pybuffernd_dS.diminfo[0].strides = __pyx_pybuffernd_dS.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dS.diminfo[0].shape = __pyx_pybuffernd_dS.rcbuffer->pybuffer.shape[0];
      if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1506, __pyx_L1_error)
    }
    __pyx_t_14 = 0;
    __pyx_v_dS = ((PyArrayObject *)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L17:;

  /* "tofu/geom/_GG03.pyx":1508
 *         dS = np.concatenate(tuple(LdS))
 * 
 *     return Pts, dS, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dXr); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_dY0r); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_dZ0r); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_8 = PyTuple_New(9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_v_Pts));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Pts));
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_Pts));
  __Pyx_INCREF(((PyObject *)__pyx_v_dS));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dS));
  PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_dS));
  __Pyx_INCREF(((PyObject *)__pyx_v_NL));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_NL));
  PyTuple_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_v_NL));
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_v_dLr));
  __Pyx_INCREF(((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Rref));
  PyTuple_SET_ITEM(__pyx_t_8, 4, ((PyObject *)__pyx_v_Rref));
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_v_VPbis));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_VPbis));
  PyTuple_SET_ITEM(__pyx_t_8, 8, ((PyObject *)__pyx_v_VPbis));
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_9 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1443
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                      double DIn=0., VIn=None, double margin=1.e-9):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ii.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03._Ves_Smesh_Lin_SubFromInd_cython", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_NL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PtsCross.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Rref.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPbis.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Y0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Z0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dS.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ii.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ind.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indL.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indX.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indY0.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indZ0.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_LPts);
  __Pyx_XDECREF(__pyx_v_LdS);
  __Pyx_XDECREF((PyObject *)__pyx_v_Pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_PtsCross);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPbis);
  __Pyx_XDECREF((PyObject *)__pyx_v_X);
  __Pyx_XDECREF((PyObject *)__pyx_v_Y0);
  __Pyx_XDECREF((PyObject *)__pyx_v_Z0);
  __Pyx_XDECREF((PyObject *)__pyx_v_dS);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_Rref);
  __Pyx_XDECREF((PyObject *)__pyx_v_indX);
  __Pyx_XDECREF((PyObject *)__pyx_v_indY0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indZ0);
  __Pyx_XDECREF((PyObject *)__pyx_v_indL);
  __Pyx_XDECREF((PyObject *)__pyx_v_NL);
  __Pyx_XDECREF((PyObject *)__pyx_v_ii);
  __Pyx_XDECREF(__pyx_v_bla);
  __PYX_XDEC_MEMVIEW(&__pyx_v_XMinMax, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPoly, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1532
 * 
 * 
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,             # <<<<<<<<<<<<<<
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_45LOS_Calc_PInOut_VesStruct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_44LOS_Calc_PInOut_VesStruct[] = " Compute the entry and exit point of all provided LOS for the provided vessel polygon (toroidal or linear), also return the normal vector at impact point and the index of the impact segment\n\n    For each LOS,\n\n    Parameters\n    ----------\n\n\n\n    Return\n    ------\n    PIn :       np.ndarray\n        Point of entry (if any) of the LOS into the vessel, returned in (X,Y,Z) cartesian coordinates as:\n            1 LOS => (3,) array or None if there is no entry point\n            NL LOS => (3,NL), with NaNs when there is no entry point\n    POut :      np.ndarray\n        Point of exit of the LOS from the vessel, returned in (X,Y,Z) cartesian coordinates as:\n            1 LOS => (3,) array or None if there is no entry point\n            NL LOS => (3,NL), with NaNs when there is no entry point\n    VOut :      np.ndarray\n\n    IOut :      np.ndarray\n\n    ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_45LOS_Calc_PInOut_VesStruct = {"LOS_Calc_PInOut_VesStruct", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_45LOS_Calc_PInOut_VesStruct, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_44LOS_Calc_PInOut_VesStruct};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_45LOS_Calc_PInOut_VesStruct(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Ds = 0;
  PyObject *__pyx_v_dus = 0;
  PyArrayObject *__pyx_v_VPoly = 0;
  PyArrayObject *__pyx_v_VIn = 0;
  PyObject *__pyx_v_Lim = 0;
  PyObject *__pyx_v_LSPoly = 0;
  PyObject *__pyx_v_LSLim = 0;
  PyObject *__pyx_v_LSVIn = 0;
  PyObject *__pyx_v_RMin = 0;
  PyObject *__pyx_v_Forbid = 0;
  PyObject *__pyx_v_EpsUz = 0;
  PyObject *__pyx_v_EpsVz = 0;
  PyObject *__pyx_v_EpsA = 0;
  PyObject *__pyx_v_EpsB = 0;
  PyObject *__pyx_v_EpsPlane = 0;
  PyObject *__pyx_v_VType = 0;
  PyObject *__pyx_v_Test = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LOS_Calc_PInOut_VesStruct (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Ds,&__pyx_n_s_dus,&__pyx_n_s_VPoly,&__pyx_n_s_VIn,&__pyx_n_s_Lim,&__pyx_n_s_LSPoly,&__pyx_n_s_LSLim,&__pyx_n_s_LSVIn,&__pyx_n_s_RMin,&__pyx_n_s_Forbid,&__pyx_n_s_EpsUz,&__pyx_n_s_EpsVz,&__pyx_n_s_EpsA,&__pyx_n_s_EpsB,&__pyx_n_s_EpsPlane,&__pyx_n_s_VType,&__pyx_n_s_Test,0};
    PyObject* values[17] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":1533
 * 
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,             # <<<<<<<<<<<<<<
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 *                               RMin=None, Forbid=True, EpsUz=1.e-6, EpsVz=1.e-9, EpsA=1.e-9, EpsB=1.e-9, EpsPlane=1.e-9,
 */
    values[4] = ((PyObject *)Py_None);

    /* "tofu/geom/_GG03.pyx":1534
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,             # <<<<<<<<<<<<<<
 *                               RMin=None, Forbid=True, EpsUz=1.e-6, EpsVz=1.e-9, EpsA=1.e-9, EpsB=1.e-9, EpsPlane=1.e-9,
 *                               VType='Tor', Test=True):
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);

    /* "tofu/geom/_GG03.pyx":1535
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 *                               RMin=None, Forbid=True, EpsUz=1.e-6, EpsVz=1.e-9, EpsA=1.e-9, EpsB=1.e-9, EpsPlane=1.e-9,             # <<<<<<<<<<<<<<
 *                               VType='Tor', Test=True):
 *     """ Compute the entry and exit point of all provided LOS for the provided vessel polygon (toroidal or linear), also return the normal vector at impact point and the index of the impact segment
 */
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)Py_True);
    values[10] = ((PyObject *)__pyx_float_1_eneg_6);
    values[11] = ((PyObject *)__pyx_float_1_eneg_9);
    values[12] = ((PyObject *)__pyx_float_1_eneg_9);
    values[13] = ((PyObject *)__pyx_float_1_eneg_9);
    values[14] = ((PyObject *)__pyx_float_1_eneg_9);
    values[15] = ((PyObject *)__pyx_n_s_Tor);

    /* "tofu/geom/_GG03.pyx":1536
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 *                               RMin=None, Forbid=True, EpsUz=1.e-6, EpsVz=1.e-9, EpsA=1.e-9, EpsB=1.e-9, EpsPlane=1.e-9,
 *                               VType='Tor', Test=True):             # <<<<<<<<<<<<<<
 *     """ Compute the entry and exit point of all provided LOS for the provided vessel polygon (toroidal or linear), also return the normal vector at impact point and the index of the impact segment
 * 
 */
    values[16] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Ds)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dus)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_Calc_PInOut_VesStruct", 0, 4, 17, 1); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VPoly)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_Calc_PInOut_VesStruct", 0, 4, 17, 2); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VIn)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_Calc_PInOut_VesStruct", 0, 4, 17, 3); __PYX_ERR(0, 1532, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Lim);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LSPoly);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LSLim);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_LSVIn);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RMin);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Forbid);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_EpsUz);
          if (value) { values[10] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 11:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_EpsVz);
          if (value) { values[11] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 12:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_EpsA);
          if (value) { values[12] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 13:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_EpsB);
          if (value) { values[13] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 14:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_EpsPlane);
          if (value) { values[14] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 15:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VType);
          if (value) { values[15] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 16:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Test);
          if (value) { values[16] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "LOS_Calc_PInOut_VesStruct") < 0)) __PYX_ERR(0, 1532, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
        CYTHON_FALLTHROUGH;
        case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
        CYTHON_FALLTHROUGH;
        case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
        CYTHON_FALLTHROUGH;
        case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
        CYTHON_FALLTHROUGH;
        case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
        CYTHON_FALLTHROUGH;
        case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
        CYTHON_FALLTHROUGH;
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Ds = values[0];
    __pyx_v_dus = values[1];
    __pyx_v_VPoly = ((PyArrayObject *)values[2]);
    __pyx_v_VIn = ((PyArrayObject *)values[3]);
    __pyx_v_Lim = values[4];
    __pyx_v_LSPoly = values[5];
    __pyx_v_LSLim = values[6];
    __pyx_v_LSVIn = values[7];
    __pyx_v_RMin = values[8];
    __pyx_v_Forbid = values[9];
    __pyx_v_EpsUz = values[10];
    __pyx_v_EpsVz = values[11];
    __pyx_v_EpsA = values[12];
    __pyx_v_EpsB = values[13];
    __pyx_v_EpsPlane = values[14];
    __pyx_v_VType = values[15];
    __pyx_v_Test = values[16];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("LOS_Calc_PInOut_VesStruct", 0, 4, 17, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1532, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_Calc_PInOut_VesStruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_VPoly), __pyx_ptype_5numpy_ndarray, 1, "VPoly", 0))) __PYX_ERR(0, 1533, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_VIn), __pyx_ptype_5numpy_ndarray, 1, "VIn", 0))) __PYX_ERR(0, 1533, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_44LOS_Calc_PInOut_VesStruct(__pyx_self, __pyx_v_Ds, __pyx_v_dus, __pyx_v_VPoly, __pyx_v_VIn, __pyx_v_Lim, __pyx_v_LSPoly, __pyx_v_LSLim, __pyx_v_LSVIn, __pyx_v_RMin, __pyx_v_Forbid, __pyx_v_EpsUz, __pyx_v_EpsVz, __pyx_v_EpsA, __pyx_v_EpsB, __pyx_v_EpsPlane, __pyx_v_VType, __pyx_v_Test);

  /* "tofu/geom/_GG03.pyx":1532
 * 
 * 
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,             # <<<<<<<<<<<<<<
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_44LOS_Calc_PInOut_VesStruct(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Ds, PyObject *__pyx_v_dus, PyArrayObject *__pyx_v_VPoly, PyArrayObject *__pyx_v_VIn, PyObject *__pyx_v_Lim, PyObject *__pyx_v_LSPoly, PyObject *__pyx_v_LSLim, PyObject *__pyx_v_LSVIn, PyObject *__pyx_v_RMin, PyObject *__pyx_v_Forbid, PyObject *__pyx_v_EpsUz, PyObject *__pyx_v_EpsVz, PyObject *__pyx_v_EpsA, PyObject *__pyx_v_EpsB, PyObject *__pyx_v_EpsPlane, PyObject *__pyx_v_VType, PyObject *__pyx_v_Test) {
  PyObject *__pyx_v_C1 = NULL;
  PyObject *__pyx_v_C2 = NULL;
  int __pyx_v_ii;
  int __pyx_v_jj;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_NL = NULL;
  PyObject *__pyx_v_IOut = NULL;
  PyObject *__pyx_v_PIn = NULL;
  PyObject *__pyx_v_POut = NULL;
  PyObject *__pyx_v_VperpIn = NULL;
  PyObject *__pyx_v_VperpOut = NULL;
  PyObject *__pyx_v_IIn = NULL;
  PyObject *__pyx_v_kPOut = NULL;
  PyObject *__pyx_v_kPIn = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_Ind = NULL;
  PyObject *__pyx_v_lslim = NULL;
  PyObject *__pyx_v_pIn = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_pOut = NULL;
  PyObject *__pyx_v_vperpIn = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_vperpOut = NULL;
  PyObject *__pyx_v_iIn = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_iOut = NULL;
  PyObject *__pyx_v_kpin = NULL;
  PyObject *__pyx_v_indNoNan = NULL;
  PyObject *__pyx_v_indout = NULL;
  PyObject *__pyx_v_pp = NULL;
  PyObject *__pyx_v_ee = NULL;
  PyObject *__pyx_v_ll = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VIn;
  __Pyx_Buffer __pyx_pybuffer_VIn;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPoly;
  __Pyx_Buffer __pyx_pybuffer_VPoly;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
  double __pyx_t_20;
  double __pyx_t_21;
  double __pyx_t_22;
  double __pyx_t_23;
  double __pyx_t_24;
  struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor __pyx_t_25;
  PyObject *(*__pyx_t_26)(PyObject *);
  PyObject *(*__pyx_t_27)(PyObject *);
  int __pyx_t_28;
  struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin __pyx_t_29;
  PyObject *__pyx_t_30 = NULL;
  PyObject *__pyx_t_31 = NULL;
  __Pyx_RefNannySetupContext("LOS_Calc_PInOut_VesStruct", 0);
  __Pyx_INCREF(__pyx_v_Ds);
  __Pyx_INCREF(__pyx_v_dus);
  __Pyx_INCREF(__pyx_v_RMin);
  __pyx_pybuffer_VPoly.pybuffer.buf = NULL;
  __pyx_pybuffer_VPoly.refcount = 0;
  __pyx_pybuffernd_VPoly.data = NULL;
  __pyx_pybuffernd_VPoly.rcbuffer = &__pyx_pybuffer_VPoly;
  __pyx_pybuffer_VIn.pybuffer.buf = NULL;
  __pyx_pybuffer_VIn.refcount = 0;
  __pyx_pybuffernd_VIn.data = NULL;
  __pyx_pybuffernd_VIn.rcbuffer = &__pyx_pybuffer_VIn;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPoly.rcbuffer->pybuffer, (PyObject*)__pyx_v_VPoly, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1532, __pyx_L1_error)
  }
  __pyx_pybuffernd_VPoly.diminfo[0].strides = __pyx_pybuffernd_VPoly.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPoly.diminfo[0].shape = __pyx_pybuffernd_VPoly.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPoly.diminfo[1].strides = __pyx_pybuffernd_VPoly.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPoly.diminfo[1].shape = __pyx_pybuffernd_VPoly.rcbuffer->pybuffer.shape[1];
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VIn.rcbuffer->pybuffer, (PyObject*)__pyx_v_VIn, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 1532, __pyx_L1_error)
  }
  __pyx_pybuffernd_VIn.diminfo[0].strides = __pyx_pybuffernd_VIn.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VIn.diminfo[0].shape = __pyx_pybuffernd_VIn.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VIn.diminfo[1].strides = __pyx_pybuffernd_VIn.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VIn.diminfo[1].shape = __pyx_pybuffernd_VIn.rcbuffer->pybuffer.shape[1];

  /* "tofu/geom/_GG03.pyx":1561
 * 
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert type(Ds) is np.ndarray and type(dus) is np.ndarray and Ds.ndim in [1,2] and Ds.shape==dus.shape and Ds.shape[0]==3, "Args Ds and dus must be of the same shape (3,) or (3,NL) !"
 *         assert VPoly.shape[0]==2 and VIn.shape[0]==2 and VIn.shape[1]==VPoly.shape[1]-1, "Args VPoly and VIn must be of the same shape (2,NS) !"
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Test); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1561, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":1562
 *     """
 *     if Test:
 *         assert type(Ds) is np.ndarray and type(dus) is np.ndarray and Ds.ndim in [1,2] and Ds.shape==dus.shape and Ds.shape[0]==3, "Args Ds and dus must be of the same shape (3,) or (3,NL) !"             # <<<<<<<<<<<<<<
 *         assert VPoly.shape[0]==2 and VIn.shape[0]==2 and VIn.shape[1]==VPoly.shape[1]-1, "Args VPoly and VIn must be of the same shape (2,NS) !"
 *         C1 = all([pp is None for pp in [LSPoly,LSLim,LSVIn]])
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (((PyObject *)Py_TYPE(__pyx_v_Ds)) == __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (((PyObject *)Py_TYPE(__pyx_v_dus)) == __pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_4 = (__pyx_t_5 != 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_1 = __pyx_t_4;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L8_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_2, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_5;
      __pyx_L8_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = (__pyx_t_4 != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dus, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L4_bool_binop_done;
      }
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_shape); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_3, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1562, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = __pyx_t_5;
      __pyx_L4_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_Ds_and_dus_must_be_of_the_s);
        __PYX_ERR(0, 1562, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1563
 *     if Test:
 *         assert type(Ds) is np.ndarray and type(dus) is np.ndarray and Ds.ndim in [1,2] and Ds.shape==dus.shape and Ds.shape[0]==3, "Args Ds and dus must be of the same shape (3,) or (3,NL) !"
 *         assert VPoly.shape[0]==2 and VIn.shape[0]==2 and VIn.shape[1]==VPoly.shape[1]-1, "Args VPoly and VIn must be of the same shape (2,NS) !"             # <<<<<<<<<<<<<<
 *         C1 = all([pp is None for pp in [LSPoly,LSLim,LSVIn]])
 *         C2 = all([hasattr(pp,'__iter__') and len(pp)==len(LSPoly) for pp in [LSPoly,LSLim,LSVIn]])
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_5 = (((__pyx_v_VPoly->dimensions[0]) == 2) != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_5 = (((__pyx_v_VIn->dimensions[0]) == 2) != 0);
      if (__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_5 = (((__pyx_v_VIn->dimensions[1]) == ((__pyx_v_VPoly->dimensions[1]) - 1)) != 0);
      __pyx_t_1 = __pyx_t_5;
      __pyx_L11_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_VPoly_and_VIn_must_be_of_th);
        __PYX_ERR(0, 1563, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1564
 *         assert type(Ds) is np.ndarray and type(dus) is np.ndarray and Ds.ndim in [1,2] and Ds.shape==dus.shape and Ds.shape[0]==3, "Args Ds and dus must be of the same shape (3,) or (3,NL) !"
 *         assert VPoly.shape[0]==2 and VIn.shape[0]==2 and VIn.shape[1]==VPoly.shape[1]-1, "Args VPoly and VIn must be of the same shape (2,NS) !"
 *         C1 = all([pp is None for pp in [LSPoly,LSLim,LSVIn]])             # <<<<<<<<<<<<<<
 *         C2 = all([hasattr(pp,'__iter__') and len(pp)==len(LSPoly) for pp in [LSPoly,LSLim,LSVIn]])
 *         assert C1 or C2, "Args LSPoly,LSLim,LSVIn must be None or lists of same len() !"
 */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_LSPoly);
    __Pyx_GIVEREF(__pyx_v_LSPoly);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_LSPoly);
    __Pyx_INCREF(__pyx_v_LSLim);
    __Pyx_GIVEREF(__pyx_v_LSLim);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_LSLim);
    __Pyx_INCREF(__pyx_v_LSVIn);
    __Pyx_GIVEREF(__pyx_v_LSVIn);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_LSVIn);
    __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_7 >= 3) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1564, __pyx_L1_error)
      #else
      __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = (__pyx_v_pp == Py_None);
      __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1564, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1564, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_C1 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1565
 *         assert VPoly.shape[0]==2 and VIn.shape[0]==2 and VIn.shape[1]==VPoly.shape[1]-1, "Args VPoly and VIn must be of the same shape (2,NS) !"
 *         C1 = all([pp is None for pp in [LSPoly,LSLim,LSVIn]])
 *         C2 = all([hasattr(pp,'__iter__') and len(pp)==len(LSPoly) for pp in [LSPoly,LSLim,LSVIn]])             # <<<<<<<<<<<<<<
 *         assert C1 or C2, "Args LSPoly,LSLim,LSVIn must be None or lists of same len() !"
 *         assert RMin is None or type(RMin) in [float,int,np.float64,np.int64], "Arg RMin must be None or a float !"
 */
    __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_LSPoly);
    __Pyx_GIVEREF(__pyx_v_LSPoly);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_LSPoly);
    __Pyx_INCREF(__pyx_v_LSLim);
    __Pyx_GIVEREF(__pyx_v_LSLim);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_LSLim);
    __Pyx_INCREF(__pyx_v_LSVIn);
    __Pyx_GIVEREF(__pyx_v_LSVIn);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_LSVIn);
    __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (__pyx_t_7 >= 3) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1565, __pyx_L1_error)
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_HasAttr(__pyx_v_pp, __pyx_n_s_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 1565, __pyx_L1_error)
      if (__pyx_t_1) {
      } else {
        __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1565, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L18_bool_binop_done;
      }
      __pyx_t_9 = PyObject_Length(__pyx_v_pp); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1565, __pyx_L1_error)
      __pyx_t_10 = PyObject_Length(__pyx_v_LSPoly); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1565, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_9 == __pyx_t_10);
      __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __pyx_t_8;
      __pyx_t_8 = 0;
      __pyx_L18_bool_binop_done:;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 1565, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_C2 = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1566
 *         C1 = all([pp is None for pp in [LSPoly,LSLim,LSVIn]])
 *         C2 = all([hasattr(pp,'__iter__') and len(pp)==len(LSPoly) for pp in [LSPoly,LSLim,LSVIn]])
 *         assert C1 or C2, "Args LSPoly,LSLim,LSVIn must be None or lists of same len() !"             # <<<<<<<<<<<<<<
 *         assert RMin is None or type(RMin) in [float,int,np.float64,np.int64], "Arg RMin must be None or a float !"
 *         assert type(Forbid) is bool, "Arg Forbid must be a bool !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_C1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1566, __pyx_L1_error)
      if (!__pyx_t_5) {
      } else {
        __pyx_t_1 = __pyx_t_5;
        goto __pyx_L20_bool_binop_done;
      }
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_C2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1566, __pyx_L1_error)
      __pyx_t_1 = __pyx_t_5;
      __pyx_L20_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_LSPoly_LSLim_LSVIn_must_be);
        __PYX_ERR(0, 1566, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1567
 *         C2 = all([hasattr(pp,'__iter__') and len(pp)==len(LSPoly) for pp in [LSPoly,LSLim,LSVIn]])
 *         assert C1 or C2, "Args LSPoly,LSLim,LSVIn must be None or lists of same len() !"
 *         assert RMin is None or type(RMin) in [float,int,np.float64,np.int64], "Arg RMin must be None or a float !"             # <<<<<<<<<<<<<<
 *         assert type(Forbid) is bool, "Arg Forbid must be a bool !"
 *         assert all([type(ee) in [int,float,np.int64,np.float64] and ee<1.e-4 for ee in [EpsUz,EpsVz,EpsA,EpsB,EpsPlane]]), "Args [EpsUz,EpsVz,EpsA,EpsB] must be floats < 1.e-4 !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_5 = (__pyx_v_RMin == Py_None);
      __pyx_t_4 = (__pyx_t_5 != 0);
      if (!__pyx_t_4) {
      } else {
        __pyx_t_1 = __pyx_t_4;
        goto __pyx_L22_bool_binop_done;
      }
      __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_RMin)));
      __pyx_t_6 = ((PyObject *)Py_TYPE(__pyx_v_RMin));
      __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_6), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_6), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_6), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_5) {
      } else {
        __pyx_t_4 = __pyx_t_5;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_6), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1567, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_4 = __pyx_t_5;
      __pyx_L24_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_5 = (__pyx_t_4 != 0);
      __pyx_t_1 = __pyx_t_5;
      __pyx_L22_bool_binop_done:;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_RMin_must_be_None_or_a_float);
        __PYX_ERR(0, 1567, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1568
 *         assert C1 or C2, "Args LSPoly,LSLim,LSVIn must be None or lists of same len() !"
 *         assert RMin is None or type(RMin) in [float,int,np.float64,np.int64], "Arg RMin must be None or a float !"
 *         assert type(Forbid) is bool, "Arg Forbid must be a bool !"             # <<<<<<<<<<<<<<
 *         assert all([type(ee) in [int,float,np.int64,np.float64] and ee<1.e-4 for ee in [EpsUz,EpsVz,EpsA,EpsB,EpsPlane]]), "Args [EpsUz,EpsVz,EpsA,EpsB] must be floats < 1.e-4 !"
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_Forbid)) == ((PyObject *)__pyx_ptype_7cpython_4bool_bool));
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_Forbid_must_be_a_bool);
        __PYX_ERR(0, 1568, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1569
 *         assert RMin is None or type(RMin) in [float,int,np.float64,np.int64], "Arg RMin must be None or a float !"
 *         assert type(Forbid) is bool, "Arg Forbid must be a bool !"
 *         assert all([type(ee) in [int,float,np.int64,np.float64] and ee<1.e-4 for ee in [EpsUz,EpsVz,EpsA,EpsB,EpsPlane]]), "Args [EpsUz,EpsVz,EpsA,EpsB] must be floats < 1.e-4 !"             # <<<<<<<<<<<<<<
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_EpsUz);
      __Pyx_GIVEREF(__pyx_v_EpsUz);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_EpsUz);
      __Pyx_INCREF(__pyx_v_EpsVz);
      __Pyx_GIVEREF(__pyx_v_EpsVz);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_EpsVz);
      __Pyx_INCREF(__pyx_v_EpsA);
      __Pyx_GIVEREF(__pyx_v_EpsA);
      PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_EpsA);
      __Pyx_INCREF(__pyx_v_EpsB);
      __Pyx_GIVEREF(__pyx_v_EpsB);
      PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_EpsB);
      __Pyx_INCREF(__pyx_v_EpsPlane);
      __Pyx_GIVEREF(__pyx_v_EpsPlane);
      PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_EpsPlane);
      __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      for (;;) {
        if (__pyx_t_7 >= 5) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_ee, __pyx_t_3);
        __pyx_t_3 = 0;
        __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_ee)));
        __pyx_t_8 = ((PyObject *)Py_TYPE(__pyx_v_ee));
        __pyx_t_11 = PyObject_RichCompare(((PyObject *)__pyx_t_8), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (!__pyx_t_5) {
        } else {
          __pyx_t_1 = __pyx_t_5;
          goto __pyx_L32_bool_binop_done;
        }
        __pyx_t_11 = PyObject_RichCompare(((PyObject *)__pyx_t_8), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (!__pyx_t_5) {
        } else {
          __pyx_t_1 = __pyx_t_5;
          goto __pyx_L32_bool_binop_done;
        }
        __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_int64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyObject_RichCompare(((PyObject *)__pyx_t_8), __pyx_t_12, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (!__pyx_t_5) {
        } else {
          __pyx_t_1 = __pyx_t_5;
          goto __pyx_L32_bool_binop_done;
        }
        __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_float64); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = PyObject_RichCompare(((PyObject *)__pyx_t_8), __pyx_t_12, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_1 = __pyx_t_5;
        __pyx_L32_bool_binop_done:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_5 = __pyx_t_1;
        if (__pyx_t_5) {
        } else {
          __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1569, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_3 = __pyx_t_8;
          __pyx_t_8 = 0;
          goto __pyx_L30_bool_binop_done;
        }
        __pyx_t_8 = PyObject_RichCompare(__pyx_v_ee, __pyx_float_1_eneg_4, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_INCREF(__pyx_t_8);
        __pyx_t_3 = __pyx_t_8;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_L30_bool_binop_done:;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1569, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1569, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_EpsUz_EpsVz_EpsA_EpsB_must);
        __PYX_ERR(0, 1569, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1570
 *         assert type(Forbid) is bool, "Arg Forbid must be a bool !"
 *         assert all([type(ee) in [int,float,np.int64,np.float64] and ee<1.e-4 for ee in [EpsUz,EpsVz,EpsA,EpsB,EpsPlane]]), "Args [EpsUz,EpsVz,EpsA,EpsB] must be floats < 1.e-4 !"
 *         assert type(VType) is str and VType.lower() in ['tor','lin'], "Arg VType must be a str in ['Tor','Lin'] !"             # <<<<<<<<<<<<<<
 * 
 *     cdef int ii, jj
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_VType)) == ((PyObject *)(&PyString_Type)));
      __pyx_t_4 = (__pyx_t_1 != 0);
      if (__pyx_t_4) {
      } else {
        __pyx_t_5 = __pyx_t_4;
        goto __pyx_L36_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VType, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1570, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1570, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1570, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_6, __pyx_n_s_tor, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1570, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_4 = __pyx_t_1;
        goto __pyx_L38_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_6, __pyx_n_s_lin, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1570, __pyx_L1_error)
      __pyx_t_4 = __pyx_t_1;
      __pyx_L38_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_1 = (__pyx_t_4 != 0);
      __pyx_t_5 = __pyx_t_1;
      __pyx_L36_bool_binop_done:;
      if (unlikely(!__pyx_t_5)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_VType_must_be_a_str_in_Tor_L);
        __PYX_ERR(0, 1570, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1561
 * 
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert type(Ds) is np.ndarray and type(dus) is np.ndarray and Ds.ndim in [1,2] and Ds.shape==dus.shape and Ds.shape[0]==3, "Args Ds and dus must be of the same shape (3,) or (3,NL) !"
 *         assert VPoly.shape[0]==2 and VIn.shape[0]==2 and VIn.shape[1]==VPoly.shape[1]-1, "Args VPoly and VIn must be of the same shape (2,NS) !"
 */
  }

  /* "tofu/geom/_GG03.pyx":1574
 *     cdef int ii, jj
 * 
 *     v = Ds.ndim==2             # <<<<<<<<<<<<<<
 *     if not v:
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_ndim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1574, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_v = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":1575
 * 
 *     v = Ds.ndim==2
 *     if not v:             # <<<<<<<<<<<<<<
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))
 *     NL = Ds.shape[1]
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1575, __pyx_L1_error)
  __pyx_t_1 = ((!__pyx_t_5) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":1576
 *     v = Ds.ndim==2
 *     if not v:
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))             # <<<<<<<<<<<<<<
 *     NL = Ds.shape[1]
 *     IOut = np.zeros((3,Ds.shape[1]))
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__240, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dus, __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__242, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_Ds, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_dus, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1575
 * 
 *     v = Ds.ndim==2
 *     if not v:             # <<<<<<<<<<<<<<
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))
 *     NL = Ds.shape[1]
 */
  }

  /* "tofu/geom/_GG03.pyx":1577
 *     if not v:
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))
 *     NL = Ds.shape[1]             # <<<<<<<<<<<<<<
 *     IOut = np.zeros((3,Ds.shape[1]))
 *     if VType.lower()=='tor':
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_NL = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "tofu/geom/_GG03.pyx":1578
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))
 *     NL = Ds.shape[1]
 *     IOut = np.zeros((3,Ds.shape[1]))             # <<<<<<<<<<<<<<
 *     if VType.lower()=='tor':
 *         if RMin is None:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Ds, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1578, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
  __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_8) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1578, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_IOut = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "tofu/geom/_GG03.pyx":1579
 *     NL = Ds.shape[1]
 *     IOut = np.zeros((3,Ds.shape[1]))
 *     if VType.lower()=='tor':             # <<<<<<<<<<<<<<
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VType, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_11 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_11) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1579, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  } else {
    __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1579, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_6, __pyx_n_s_tor, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1579, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":1580
 *     IOut = np.zeros((3,Ds.shape[1]))
 *     if VType.lower()=='tor':
 *         if RMin is None:             # <<<<<<<<<<<<<<
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 */
    __pyx_t_1 = (__pyx_v_RMin == Py_None);
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "tofu/geom/_GG03.pyx":1582
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))             # <<<<<<<<<<<<<<
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_min); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_hypot); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(__pyx_v_Ds, __pyx_tuple__244); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_12 = PyObject_GetItem(__pyx_v_Ds, __pyx_tuple__246); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = NULL;
      __pyx_t_14 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
          __pyx_t_14 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_3, __pyx_t_12};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1582, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_t_3, __pyx_t_12};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1582, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_12);
        __pyx_t_3 = 0;
        __pyx_t_12 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1582, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1582, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1582, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_2};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1582, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else
        #endif
        {
          __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1582, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1582, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "tofu/geom/_GG03.pyx":1581
 *     if VType.lower()=='tor':
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),             # <<<<<<<<<<<<<<
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 */
      __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_VPoly), __pyx_tuple__248); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_8) {
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1581, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_15};
          __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1581, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
          PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_15};
          __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1581, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1581, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8); __pyx_t_8 = NULL;
          __Pyx_GIVEREF(__pyx_t_15);
          PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_15);
          __pyx_t_15 = 0;
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_12, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1581, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "tofu/geom/_GG03.pyx":1582
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))             # <<<<<<<<<<<<<<
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 */
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_6, __pyx_t_11, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1582, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_5) {
        __Pyx_INCREF(__pyx_t_6);
        __pyx_t_2 = __pyx_t_6;
      } else {
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_2 = __pyx_t_11;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":1581
 *     if VType.lower()=='tor':
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),             # <<<<<<<<<<<<<<
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 */
      __pyx_t_6 = PyNumber_Multiply(__pyx_float_0_95, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1581, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF_SET(__pyx_v_RMin, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":1580
 *     IOut = np.zeros((3,Ds.shape[1]))
 *     if VType.lower()=='tor':
 *         if RMin is None:             # <<<<<<<<<<<<<<
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 */
    }

    /* "tofu/geom/_GG03.pyx":1583
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,             # <<<<<<<<<<<<<<
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 */
    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_Ds);
    if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_dus);
    if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VPoly));
    if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VIn));
    if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 1583, __pyx_L1_error)
    if (!(likely(((__pyx_v_Forbid) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Forbid, __pyx_ptype_7cpython_4bool_bool))))) __PYX_ERR(0, 1583, __pyx_L1_error)

    /* "tofu/geom/_GG03.pyx":1584
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)             # <<<<<<<<<<<<<<
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 */
    __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_EpsUz); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1584, __pyx_L1_error)
    __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_EpsVz); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1584, __pyx_L1_error)
    __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_v_EpsA); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1584, __pyx_L1_error)
    __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_EpsB); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1584, __pyx_L1_error)
    __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_EpsPlane); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1584, __pyx_L1_error)

    /* "tofu/geom/_GG03.pyx":1583
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,             # <<<<<<<<<<<<<<
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 */
    __pyx_t_25.__pyx_n = 8;
    __pyx_t_25.Lim = __pyx_v_Lim;
    __pyx_t_25.Forbid = ((PyBoolObject *)__pyx_v_Forbid);
    __pyx_t_25.RMin = __pyx_v_RMin;
    __pyx_t_25.EpsUz = __pyx_t_20;
    __pyx_t_25.EpsVz = __pyx_t_21;
    __pyx_t_25.EpsA = __pyx_t_22;
    __pyx_t_25.EpsB = __pyx_t_23;
    __pyx_t_25.EpsPlane = __pyx_t_24;
    __pyx_t_6 = __pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, &__pyx_t_25); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
    __pyx_t_16.memview = NULL;
    __pyx_t_16.data = NULL;
    __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
    __pyx_t_17.memview = NULL;
    __pyx_t_17.data = NULL;
    __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
    __pyx_t_18.memview = NULL;
    __pyx_t_18.data = NULL;
    __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
    __pyx_t_19.memview = NULL;
    __pyx_t_19.data = NULL;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1583, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_2,&__pyx_t_11,&__pyx_t_12,&__pyx_t_15,&__pyx_t_8,&__pyx_t_3};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1583, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_2,&__pyx_t_11,&__pyx_t_12,&__pyx_t_15,&__pyx_t_8,&__pyx_t_3};
      __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_26 = Py_TYPE(__pyx_t_13)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_26(__pyx_t_13); if (unlikely(!item)) goto __pyx_L43_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_26(__pyx_t_13), 6) < 0) __PYX_ERR(0, 1583, __pyx_L1_error)
      __pyx_t_26 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L44_unpacking_done;
      __pyx_L43_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_26 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1583, __pyx_L1_error)
      __pyx_L44_unpacking_done:;
    }
    __pyx_v_PIn = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_POut = __pyx_t_11;
    __pyx_t_11 = 0;
    __pyx_v_VperpIn = __pyx_t_12;
    __pyx_t_12 = 0;
    __pyx_v_VperpOut = __pyx_t_15;
    __pyx_t_15 = 0;
    __pyx_v_IIn = __pyx_t_8;
    __pyx_t_8 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_tuple__250, __pyx_t_3) < 0)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":1585
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))             # <<<<<<<<<<<<<<
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_sum); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_POut, __pyx_v_Ds); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_12 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1585, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_12) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_11};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_11};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1585, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __pyx_t_12 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_kPOut = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1586
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))             # <<<<<<<<<<<<<<
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sum); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Subtract(__pyx_v_PIn, __pyx_v_Ds); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_12 = PyNumber_Power(__pyx_t_8, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_12);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1586, __pyx_L1_error)
    __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_12) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_15};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_15};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1586, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_12); __pyx_t_12 = NULL;
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_15);
        __pyx_t_15 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_kPIn = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1587
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)             # <<<<<<<<<<<<<<
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_allclose); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Subtract(__pyx_v_POut, __pyx_v_Ds); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = PyNumber_Multiply(__pyx_t_6, __pyx_v_dus); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1587, __pyx_L1_error)
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_v_kPOut);
      __Pyx_GIVEREF(__pyx_v_kPOut);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_kPOut);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_equal_nan, Py_True) < 0) __PYX_ERR(0, 1587, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1587, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 1587, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1588
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)             # <<<<<<<<<<<<<<
 *         if LSPoly is not None:
 *             Ind = np.zeros((2,NL))
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_allclose); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Subtract(__pyx_v_PIn, __pyx_v_Ds); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_v_dus); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1588, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_kPIn);
      __Pyx_GIVEREF(__pyx_v_kPIn);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_kPIn);
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_equal_nan, Py_True) < 0) __PYX_ERR(0, 1588, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1588, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_5)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 1588, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1589
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:             # <<<<<<<<<<<<<<
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 */
    __pyx_t_5 = (__pyx_v_LSPoly != Py_None);
    __pyx_t_1 = (__pyx_t_5 != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":1590
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:
 *             Ind = np.zeros((2,NL))             # <<<<<<<<<<<<<<
 *             for ii in range(0,len(LSPoly)):
 *                 if LSLim[ii] is None or not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]):
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1590, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_2);
      __Pyx_INCREF(__pyx_v_NL);
      __Pyx_GIVEREF(__pyx_v_NL);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_NL);
      __pyx_t_12 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1590, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_8};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1590, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
          PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_8};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1590, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else
        #endif
        {
          __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1590, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_12); __pyx_t_12 = NULL;
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_15, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1590, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_Ind = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":1591
 *         if LSPoly is not None:
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):             # <<<<<<<<<<<<<<
 *                 if LSLim[ii] is None or not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]):
 *                     lslim = [LSLim[ii]]
 */
      __pyx_t_7 = PyObject_Length(__pyx_v_LSPoly); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1591, __pyx_L1_error)
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_7; __pyx_t_14+=1) {
        __pyx_v_ii = __pyx_t_14;

        /* "tofu/geom/_GG03.pyx":1592
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 *                 if LSLim[ii] is None or not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]):             # <<<<<<<<<<<<<<
 *                     lslim = [LSLim[ii]]
 *                 else:
 */
        __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_5 = (__pyx_t_6 == Py_None);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_4 = (__pyx_t_5 != 0);
        if (!__pyx_t_4) {
        } else {
          __pyx_t_1 = __pyx_t_4;
          goto __pyx_L49_bool_binop_done;
        }
        __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
          __pyx_t_15 = __pyx_t_3; __Pyx_INCREF(__pyx_t_15); __pyx_t_10 = 0;
          __pyx_t_27 = NULL;
        } else {
          __pyx_t_10 = -1; __pyx_t_15 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1592, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_27 = Py_TYPE(__pyx_t_15)->tp_iternext; if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1592, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        for (;;) {
          if (likely(!__pyx_t_27)) {
            if (likely(PyList_CheckExact(__pyx_t_15))) {
              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_15)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyList_GET_ITEM(__pyx_t_15, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1592, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            } else {
              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_15)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_15, __pyx_t_10); __Pyx_INCREF(__pyx_t_3); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1592, __pyx_L1_error)
              #else
              __pyx_t_3 = PySequence_ITEM(__pyx_t_15, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              #endif
            }
          } else {
            __pyx_t_3 = __pyx_t_27(__pyx_t_15);
            if (unlikely(!__pyx_t_3)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1592, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_3);
          }
          __Pyx_XDECREF_SET(__pyx_v_ll, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_4 = __Pyx_HasAttr(__pyx_v_ll, __pyx_n_s_iter); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1592, __pyx_L1_error)
          __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1592, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 1592, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_15, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 1592, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_5 = ((!__pyx_t_4) != 0);
        __pyx_t_1 = __pyx_t_5;
        __pyx_L49_bool_binop_done:;
        if (__pyx_t_1) {

          /* "tofu/geom/_GG03.pyx":1593
 *             for ii in range(0,len(LSPoly)):
 *                 if LSLim[ii] is None or not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]):
 *                     lslim = [LSLim[ii]]             # <<<<<<<<<<<<<<
 *                 else:
 *                     lslim = LSLim[ii]
 */
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1593, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_15 = PyList_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1593, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_GIVEREF(__pyx_t_6);
          PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_6);
          __pyx_t_6 = 0;
          __Pyx_XDECREF_SET(__pyx_v_lslim, __pyx_t_15);
          __pyx_t_15 = 0;

          /* "tofu/geom/_GG03.pyx":1592
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 *                 if LSLim[ii] is None or not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]):             # <<<<<<<<<<<<<<
 *                     lslim = [LSLim[ii]]
 *                 else:
 */
          goto __pyx_L48;
        }

        /* "tofu/geom/_GG03.pyx":1595
 *                     lslim = [LSLim[ii]]
 *                 else:
 *                     lslim = LSLim[ii]             # <<<<<<<<<<<<<<
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Tor(Ds, dus, LSPoly[ii], LSVIn[ii], Lim=lslim[jj], Forbid=Forbid, RMin=RMin,
 */
        /*else*/ {
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1595, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_XDECREF_SET(__pyx_v_lslim, __pyx_t_15);
          __pyx_t_15 = 0;
        }
        __pyx_L48:;

        /* "tofu/geom/_GG03.pyx":1596
 *                 else:
 *                     lslim = LSLim[ii]
 *                 for jj in range(0,len(lslim)):             # <<<<<<<<<<<<<<
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Tor(Ds, dus, LSPoly[ii], LSVIn[ii], Lim=lslim[jj], Forbid=Forbid, RMin=RMin,
 *                                                                                   EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 */
        __pyx_t_10 = PyObject_Length(__pyx_v_lslim); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1596, __pyx_L1_error)
        for (__pyx_t_28 = 0; __pyx_t_28 < __pyx_t_10; __pyx_t_28+=1) {
          __pyx_v_jj = __pyx_t_28;

          /* "tofu/geom/_GG03.pyx":1597
 *                     lslim = LSLim[ii]
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Tor(Ds, dus, LSPoly[ii], LSVIn[ii], Lim=lslim[jj], Forbid=Forbid, RMin=RMin,             # <<<<<<<<<<<<<<
 *                                                                                   EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 */
          __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_Ds);
          if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_dus);
          if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_LSPoly, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_15);
          if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_LSVIn, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_15);
          if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_lslim, __pyx_v_jj, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (!(likely(((__pyx_v_Forbid) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Forbid, __pyx_ptype_7cpython_4bool_bool))))) __PYX_ERR(0, 1597, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":1598
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Tor(Ds, dus, LSPoly[ii], LSVIn[ii], Lim=lslim[jj], Forbid=Forbid, RMin=RMin,
 *                                                                                   EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)             # <<<<<<<<<<<<<<
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 */
          __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_EpsUz); if (unlikely((__pyx_t_24 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error)
          __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_EpsVz); if (unlikely((__pyx_t_23 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error)
          __pyx_t_22 = __pyx_PyFloat_AsDouble(__pyx_v_EpsA); if (unlikely((__pyx_t_22 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error)
          __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_EpsB); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error)
          __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_EpsPlane); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1598, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":1597
 *                     lslim = LSLim[ii]
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Tor(Ds, dus, LSPoly[ii], LSVIn[ii], Lim=lslim[jj], Forbid=Forbid, RMin=RMin,             # <<<<<<<<<<<<<<
 *                                                                                   EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 */
          __pyx_t_25.__pyx_n = 8;
          __pyx_t_25.Lim = __pyx_t_15;
          __pyx_t_25.Forbid = ((PyBoolObject *)__pyx_v_Forbid);
          __pyx_t_25.RMin = __pyx_v_RMin;
          __pyx_t_25.EpsUz = __pyx_t_24;
          __pyx_t_25.EpsVz = __pyx_t_23;
          __pyx_t_25.EpsA = __pyx_t_22;
          __pyx_t_25.EpsB = __pyx_t_21;
          __pyx_t_25.EpsPlane = __pyx_t_20;
          __pyx_t_6 = __pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor(__pyx_t_19, __pyx_t_18, __pyx_t_17, __pyx_t_16, &__pyx_t_25); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1597, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
          __pyx_t_19.memview = NULL;
          __pyx_t_19.data = NULL;
          __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
          __pyx_t_18.memview = NULL;
          __pyx_t_18.data = NULL;
          __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
          __pyx_t_17.memview = NULL;
          __pyx_t_17.data = NULL;
          __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
          __pyx_t_16.memview = NULL;
          __pyx_t_16.data = NULL;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
            PyObject* sequence = __pyx_t_6;
            #if !CYTHON_COMPILING_IN_PYPY
            Py_ssize_t size = Py_SIZE(sequence);
            #else
            Py_ssize_t size = PySequence_Size(sequence);
            #endif
            if (unlikely(size != 6)) {
              if (size > 6) __Pyx_RaiseTooManyValuesError(6);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 1597, __pyx_L1_error)
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
              __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
              __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
              __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
              __pyx_t_2 = PyTuple_GET_ITEM(sequence, 5); 
            } else {
              __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
              __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
              __pyx_t_12 = PyList_GET_ITEM(sequence, 3); 
              __pyx_t_11 = PyList_GET_ITEM(sequence, 4); 
              __pyx_t_2 = PyList_GET_ITEM(sequence, 5); 
            }
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_2);
            #else
            {
              Py_ssize_t i;
              PyObject** temps[6] = {&__pyx_t_15,&__pyx_t_3,&__pyx_t_8,&__pyx_t_12,&__pyx_t_11,&__pyx_t_2};
              for (i=0; i < 6; i++) {
                PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1597, __pyx_L1_error)
                __Pyx_GOTREF(item);
                *(temps[i]) = item;
              }
            }
            #endif
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else {
            Py_ssize_t index = -1;
            PyObject** temps[6] = {&__pyx_t_15,&__pyx_t_3,&__pyx_t_8,&__pyx_t_12,&__pyx_t_11,&__pyx_t_2};
            __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1597, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_26 = Py_TYPE(__pyx_t_13)->tp_iternext;
            for (index=0; index < 6; index++) {
              PyObject* item = __pyx_t_26(__pyx_t_13); if (unlikely(!item)) goto __pyx_L55_unpacking_failed;
              __Pyx_GOTREF(item);
              *(temps[index]) = item;
            }
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_26(__pyx_t_13), 6) < 0) __PYX_ERR(0, 1597, __pyx_L1_error)
            __pyx_t_26 = NULL;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            goto __pyx_L56_unpacking_done;
            __pyx_L55_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_26 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 1597, __pyx_L1_error)
            __pyx_L56_unpacking_done:;
          }
          __Pyx_XDECREF_SET(__pyx_v_pIn, __pyx_t_15);
          __pyx_t_15 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pOut, __pyx_t_3);
          __pyx_t_3 = 0;
          __Pyx_XDECREF_SET(__pyx_v_vperpIn, __pyx_t_8);
          __pyx_t_8 = 0;
          __Pyx_XDECREF_SET(__pyx_v_vperpOut, __pyx_t_12);
          __pyx_t_12 = 0;
          __Pyx_XDECREF_SET(__pyx_v_iIn, __pyx_t_11);
          __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_iOut, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":1599
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Tor(Ds, dus, LSPoly[ii], LSVIn[ii], Lim=lslim[jj], Forbid=Forbid, RMin=RMin,
 *                                                                                   EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))             # <<<<<<<<<<<<<<
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 *                     indout = np.zeros((NL,),dtype=bool)
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyNumber_Subtract(__pyx_v_Ds, __pyx_v_pIn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
          __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1599, __pyx_L1_error)
          __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1599, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          if (!__pyx_t_8) {
            __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1599, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_GOTREF(__pyx_t_6);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
              __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1599, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_3};
              __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1599, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            } else
            #endif
            {
              __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1599, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); __pyx_t_8 = NULL;
              __Pyx_GIVEREF(__pyx_t_3);
              PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_3);
              __pyx_t_3 = 0;
              __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1599, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kpin, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "tofu/geom/_GG03.pyx":1600
 *                                                                                   EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))             # <<<<<<<<<<<<<<
 *                     indout = np.zeros((NL,),dtype=bool)
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 */
          __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_isnan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_11) {
            __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_kpin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_kpin};
              __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_t_6);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_kpin};
              __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_t_6);
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); __pyx_t_11 = NULL;
              __Pyx_INCREF(__pyx_v_kpin);
              __Pyx_GIVEREF(__pyx_v_kpin);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_kpin);
              __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyNumber_Invert(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_kPOut); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_kPOut};
              __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_6);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_kPOut};
              __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_6);
            } else
            #endif
            {
              __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_INCREF(__pyx_v_kPOut);
              __Pyx_GIVEREF(__pyx_v_kPOut);
              PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_kPOut);
              __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyNumber_Invert(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyNumber_And(__pyx_t_2, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_indNoNan, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "tofu/geom/_GG03.pyx":1601
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 *                     indout = np.zeros((NL,),dtype=bool)             # <<<<<<<<<<<<<<
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 */
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_INCREF(__pyx_v_NL);
          __Pyx_GIVEREF(__pyx_v_NL);
          PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_NL);
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_6);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
          __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)) < 0) __PYX_ERR(0, 1601, __pyx_L1_error)
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1601, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_XDECREF_SET(__pyx_v_indout, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "tofu/geom/_GG03.pyx":1602
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 *                     indout = np.zeros((NL,),dtype=bool)
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]             # <<<<<<<<<<<<<<
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):
 */
          __pyx_t_8 = PyObject_GetItem(__pyx_v_kpin, __pyx_v_indNoNan); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1602, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_6 = PyObject_GetItem(__pyx_v_kPOut, __pyx_v_indNoNan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1602, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1602, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (unlikely(PyObject_SetItem(__pyx_v_indout, __pyx_v_indNoNan, __pyx_t_2) < 0)) __PYX_ERR(0, 1602, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":1603
 *                     indout = np.zeros((NL,),dtype=bool)
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True             # <<<<<<<<<<<<<<
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]
 */
          __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_isnan); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_6)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_6);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
            }
          }
          if (!__pyx_t_6) {
            __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_kpin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_8)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_kpin};
              __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
              PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_kpin};
              __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            {
              __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL;
              __Pyx_INCREF(__pyx_v_kpin);
              __Pyx_GIVEREF(__pyx_v_kpin);
              PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_kpin);
              __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyNumber_Invert(__pyx_t_2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_isnan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_6, function);
            }
          }
          if (!__pyx_t_11) {
            __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_kPOut); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_kPOut};
              __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
              PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_v_kPOut};
              __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_t_2);
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); __pyx_t_11 = NULL;
              __Pyx_INCREF(__pyx_v_kPOut);
              __Pyx_GIVEREF(__pyx_v_kPOut);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_kPOut);
              __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1603, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = PyNumber_And(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (unlikely(PyObject_SetItem(__pyx_v_indout, __pyx_t_6, Py_True) < 0)) __PYX_ERR(0, 1603, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

          /* "tofu/geom/_GG03.pyx":1604
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):             # <<<<<<<<<<<<<<
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_any); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_2)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_2);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
            }
          }
          if (!__pyx_t_2) {
            __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_indout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_8)) {
              PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_indout};
              __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_6);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
              PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_indout};
              __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
              __Pyx_GOTREF(__pyx_t_6);
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1604, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
              __Pyx_INCREF(__pyx_v_indout);
              __Pyx_GIVEREF(__pyx_v_indout);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_indout);
              __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1604, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_6);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1604, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":1605
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]             # <<<<<<<<<<<<<<
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 */
            __pyx_t_6 = PyObject_GetItem(__pyx_v_kpin, __pyx_v_indout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1605, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            if (unlikely(PyObject_SetItem(__pyx_v_kPOut, __pyx_v_indout, __pyx_t_6) < 0)) __PYX_ERR(0, 1605, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "tofu/geom/_GG03.pyx":1606
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]             # <<<<<<<<<<<<<<
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]
 */
            __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1606, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_slice__251);
            __Pyx_GIVEREF(__pyx_slice__251);
            PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_slice__251);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_indout);
            __pyx_t_8 = PyObject_GetItem(__pyx_v_pIn, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1606, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1606, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_slice__252);
            __Pyx_GIVEREF(__pyx_slice__252);
            PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_slice__252);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_POut, __pyx_t_6, __pyx_t_8) < 0)) __PYX_ERR(0, 1606, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

            /* "tofu/geom/_GG03.pyx":1607
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]             # <<<<<<<<<<<<<<
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii
 */
            __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_slice__253);
            __Pyx_GIVEREF(__pyx_slice__253);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_slice__253);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_indout);
            __pyx_t_6 = PyObject_GetItem(__pyx_v_vperpIn, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_slice__254);
            __Pyx_GIVEREF(__pyx_slice__254);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_slice__254);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_VperpOut, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 1607, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "tofu/geom/_GG03.pyx":1608
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]             # <<<<<<<<<<<<<<
 *                         IOut[0,indout] = 1+ii
 *                         IOut[1,indout] = jj
 */
            __pyx_t_6 = PyObject_GetItem(__pyx_v_iIn, __pyx_v_indout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1608, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1608, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_int_2);
            __Pyx_GIVEREF(__pyx_int_2);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_2);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 1608, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "tofu/geom/_GG03.pyx":1609
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii             # <<<<<<<<<<<<<<
 *                         IOut[1,indout] = jj
 *     else:
 */
            __pyx_t_6 = __Pyx_PyInt_From_long((1 + __pyx_v_ii)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1609, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1609, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_int_0);
            __Pyx_GIVEREF(__pyx_int_0);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 1609, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "tofu/geom/_GG03.pyx":1610
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii
 *                         IOut[1,indout] = jj             # <<<<<<<<<<<<<<
 *     else:
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Lin(Ds, dus, VPoly, VIn, Lim, EpsPlane=EpsPlane)
 */
            __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_jj); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1610, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1610, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
            __Pyx_INCREF(__pyx_int_1);
            __Pyx_GIVEREF(__pyx_int_1);
            PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_1);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 1610, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

            /* "tofu/geom/_GG03.pyx":1604
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):             # <<<<<<<<<<<<<<
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 */
          }
        }
      }

      /* "tofu/geom/_GG03.pyx":1589
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:             # <<<<<<<<<<<<<<
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 */
    }

    /* "tofu/geom/_GG03.pyx":1579
 *     NL = Ds.shape[1]
 *     IOut = np.zeros((3,Ds.shape[1]))
 *     if VType.lower()=='tor':             # <<<<<<<<<<<<<<
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 */
    goto __pyx_L41;
  }

  /* "tofu/geom/_GG03.pyx":1612
 *                         IOut[1,indout] = jj
 *     else:
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Lin(Ds, dus, VPoly, VIn, Lim, EpsPlane=EpsPlane)             # <<<<<<<<<<<<<<
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 */
  /*else*/ {
    __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_Ds);
    if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_dus);
    if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VPoly));
    if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VIn));
    if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_EpsPlane); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1612, __pyx_L1_error)
    __pyx_t_29.__pyx_n = 1;
    __pyx_t_29.EpsPlane = __pyx_t_20;
    __pyx_t_6 = __pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin(__pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_v_Lim, &__pyx_t_29); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
    __pyx_t_16.memview = NULL;
    __pyx_t_16.data = NULL;
    __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
    __pyx_t_17.memview = NULL;
    __pyx_t_17.data = NULL;
    __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
    __pyx_t_18.memview = NULL;
    __pyx_t_18.data = NULL;
    __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
    __pyx_t_19.memview = NULL;
    __pyx_t_19.data = NULL;
    if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
      PyObject* sequence = __pyx_t_6;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 6)) {
        if (size > 6) __Pyx_RaiseTooManyValuesError(6);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1612, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 5); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 5); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_15);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[6] = {&__pyx_t_8,&__pyx_t_3,&__pyx_t_2,&__pyx_t_11,&__pyx_t_12,&__pyx_t_15};
        for (i=0; i < 6; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1612, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[6] = {&__pyx_t_8,&__pyx_t_3,&__pyx_t_2,&__pyx_t_11,&__pyx_t_12,&__pyx_t_15};
      __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1612, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_26 = Py_TYPE(__pyx_t_13)->tp_iternext;
      for (index=0; index < 6; index++) {
        PyObject* item = __pyx_t_26(__pyx_t_13); if (unlikely(!item)) goto __pyx_L58_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_26(__pyx_t_13), 6) < 0) __PYX_ERR(0, 1612, __pyx_L1_error)
      __pyx_t_26 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L59_unpacking_done;
      __pyx_L58_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_26 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1612, __pyx_L1_error)
      __pyx_L59_unpacking_done:;
    }
    __pyx_v_PIn = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_v_POut = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_VperpIn = __pyx_t_2;
    __pyx_t_2 = 0;
    __pyx_v_VperpOut = __pyx_t_11;
    __pyx_t_11 = 0;
    __pyx_v_IIn = __pyx_t_12;
    __pyx_t_12 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_tuple__256, __pyx_t_15) < 0)) __PYX_ERR(0, 1612, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

    /* "tofu/geom/_GG03.pyx":1613
 *     else:
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Lin(Ds, dus, VPoly, VIn, Lim, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))             # <<<<<<<<<<<<<<
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 */
    __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_sum); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyNumber_Subtract(__pyx_v_POut, __pyx_v_Ds); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_2 = PyNumber_Power(__pyx_t_15, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1613, __pyx_L1_error)
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1613, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_12);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_12, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1613, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1613, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1613, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1613, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1613, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_v_kPOut = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1614
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Lin(Ds, dus, VPoly, VIn, Lim, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))             # <<<<<<<<<<<<<<
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 */
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyNumber_Subtract(__pyx_v_PIn, __pyx_v_Ds); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_2 = PyNumber_Power(__pyx_t_12, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1614, __pyx_L1_error)
    __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_12, __pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_6);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_15)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_11};
        __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
        PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_11};
        __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1614, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_2); __pyx_t_2 = NULL;
        __Pyx_GIVEREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_12, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1614, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_v_kPIn = __pyx_t_6;
    __pyx_t_6 = 0;

    /* "tofu/geom/_GG03.pyx":1615
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)             # <<<<<<<<<<<<<<
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_allclose); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Subtract(__pyx_v_POut, __pyx_v_Ds); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = PyNumber_Multiply(__pyx_t_6, __pyx_v_dus); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_11);
      __pyx_t_11 = 0;
      __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1615, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_6, __pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_v_kPOut);
      __Pyx_GIVEREF(__pyx_v_kPOut);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_kPOut);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_equal_nan, Py_True) < 0) __PYX_ERR(0, 1615, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1615, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 1615, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1616
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)             # <<<<<<<<<<<<<<
 *         if LSPoly is not None:
 *             Ind = np.zeros((2,NL))
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_allclose); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyNumber_Subtract(__pyx_v_PIn, __pyx_v_Ds); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_15 = PyNumber_Multiply(__pyx_t_6, __pyx_v_dus); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1616, __pyx_L1_error)
      __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_6, __pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_v_kPIn);
      __Pyx_GIVEREF(__pyx_v_kPIn);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_kPIn);
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_equal_nan, Py_True) < 0) __PYX_ERR(0, 1616, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_15, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1616, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) {
        PyErr_SetNone(PyExc_AssertionError);
        __PYX_ERR(0, 1616, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":1617
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:             # <<<<<<<<<<<<<<
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 */
    __pyx_t_1 = (__pyx_v_LSPoly != Py_None);
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "tofu/geom/_GG03.pyx":1618
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:
 *             Ind = np.zeros((2,NL))             # <<<<<<<<<<<<<<
 *             for ii in range(0,len(LSPoly)):
 *                 lslim = [LSLim[ii]] if not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]) else LSLim[ii]
 */
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1618, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_int_2);
      __Pyx_INCREF(__pyx_v_NL);
      __Pyx_GIVEREF(__pyx_v_NL);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_NL);
      __pyx_t_2 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1618, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_15)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_12};
          __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1618, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
          PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_12};
          __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1618, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        } else
        #endif
        {
          __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1618, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL;
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_11, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1618, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_v_Ind = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":1619
 *         if LSPoly is not None:
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):             # <<<<<<<<<<<<<<
 *                 lslim = [LSLim[ii]] if not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]) else LSLim[ii]
 *                 for jj in range(0,len(lslim)):
 */
      __pyx_t_7 = PyObject_Length(__pyx_v_LSPoly); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1619, __pyx_L1_error)
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_7; __pyx_t_14+=1) {
        __pyx_v_ii = __pyx_t_14;

        /* "tofu/geom/_GG03.pyx":1620
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 *                 lslim = [LSLim[ii]] if not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]) else LSLim[ii]             # <<<<<<<<<<<<<<
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Lin(Ds, dus, LSPoly[ii], LSVIn[ii], lslim[jj], EpsPlane=EpsPlane)
 */
        __pyx_t_15 = PyList_New(0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_11 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) {
          __pyx_t_12 = __pyx_t_11; __Pyx_INCREF(__pyx_t_12); __pyx_t_10 = 0;
          __pyx_t_27 = NULL;
        } else {
          __pyx_t_10 = -1; __pyx_t_12 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1620, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_27 = Py_TYPE(__pyx_t_12)->tp_iternext; if (unlikely(!__pyx_t_27)) __PYX_ERR(0, 1620, __pyx_L1_error)
        }
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        for (;;) {
          if (likely(!__pyx_t_27)) {
            if (likely(PyList_CheckExact(__pyx_t_12))) {
              if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_12)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyList_GET_ITEM(__pyx_t_12, __pyx_t_10); __Pyx_INCREF(__pyx_t_11); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1620, __pyx_L1_error)
              #else
              __pyx_t_11 = PySequence_ITEM(__pyx_t_12, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1620, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            } else {
              if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_12)) break;
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_12, __pyx_t_10); __Pyx_INCREF(__pyx_t_11); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 1620, __pyx_L1_error)
              #else
              __pyx_t_11 = PySequence_ITEM(__pyx_t_12, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1620, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              #endif
            }
          } else {
            __pyx_t_11 = __pyx_t_27(__pyx_t_12);
            if (unlikely(!__pyx_t_11)) {
              PyObject* exc_type = PyErr_Occurred();
              if (exc_type) {
                if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
                else __PYX_ERR(0, 1620, __pyx_L1_error)
              }
              break;
            }
            __Pyx_GOTREF(__pyx_t_11);
          }
          __Pyx_XDECREF_SET(__pyx_v_ll, __pyx_t_11);
          __pyx_t_11 = 0;
          __pyx_t_5 = __Pyx_HasAttr(__pyx_v_ll, __pyx_n_s_iter); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 1620, __pyx_L1_error)
          __pyx_t_11 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1620, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_15, (PyObject*)__pyx_t_11))) __PYX_ERR(0, 1620, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_15);
        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_15);
        __pyx_t_15 = 0;
        __pyx_t_15 = __Pyx_PyObject_Call(__pyx_builtin_all, __pyx_t_12, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1620, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1620, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        if (((!__pyx_t_5) != 0)) {
          __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1620, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_12 = PyList_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1620, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_GIVEREF(__pyx_t_15);
          PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_15);
          __pyx_t_15 = 0;
          __pyx_t_6 = __pyx_t_12;
          __pyx_t_12 = 0;
        } else {
          __pyx_t_12 = __Pyx_GetItemInt(__pyx_v_LSLim, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1620, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_6 = __pyx_t_12;
          __pyx_t_12 = 0;
        }
        __Pyx_XDECREF_SET(__pyx_v_lslim, __pyx_t_6);
        __pyx_t_6 = 0;

        /* "tofu/geom/_GG03.pyx":1621
 *             for ii in range(0,len(LSPoly)):
 *                 lslim = [LSLim[ii]] if not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]) else LSLim[ii]
 *                 for jj in range(0,len(lslim)):             # <<<<<<<<<<<<<<
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Lin(Ds, dus, LSPoly[ii], LSVIn[ii], lslim[jj], EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 */
        __pyx_t_10 = PyObject_Length(__pyx_v_lslim); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1621, __pyx_L1_error)
        for (__pyx_t_28 = 0; __pyx_t_28 < __pyx_t_10; __pyx_t_28+=1) {
          __pyx_v_jj = __pyx_t_28;

          /* "tofu/geom/_GG03.pyx":1622
 *                 lslim = [LSLim[ii]] if not all([hasattr(ll,'__iter__') for ll in LSLim[ii]]) else LSLim[ii]
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Lin(Ds, dus, LSPoly[ii], LSVIn[ii], lslim[jj], EpsPlane=EpsPlane)             # <<<<<<<<<<<<<<
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 */
          __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_Ds);
          if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_dus);
          if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_LSPoly, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_6);
          if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_LSVIn, __pyx_v_ii, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_t_6);
          if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_lslim, __pyx_v_jj, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_EpsPlane); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1622, __pyx_L1_error)
          __pyx_t_29.__pyx_n = 1;
          __pyx_t_29.EpsPlane = __pyx_t_20;
          __pyx_t_12 = __pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin(__pyx_t_19, __pyx_t_18, __pyx_t_17, __pyx_t_16, __pyx_t_6, &__pyx_t_29); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1622, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
          __pyx_t_19.memview = NULL;
          __pyx_t_19.data = NULL;
          __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
          __pyx_t_18.memview = NULL;
          __pyx_t_18.data = NULL;
          __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
          __pyx_t_17.memview = NULL;
          __pyx_t_17.data = NULL;
          __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
          __pyx_t_16.memview = NULL;
          __pyx_t_16.data = NULL;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) {
            PyObject* sequence = __pyx_t_12;
            #if !CYTHON_COMPILING_IN_PYPY
            Py_ssize_t size = Py_SIZE(sequence);
            #else
            Py_ssize_t size = PySequence_Size(sequence);
            #endif
            if (unlikely(size != 6)) {
              if (size > 6) __Pyx_RaiseTooManyValuesError(6);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 1622, __pyx_L1_error)
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            if (likely(PyTuple_CheckExact(sequence))) {
              __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
              __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
              __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); 
              __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
              __pyx_t_3 = PyTuple_GET_ITEM(sequence, 4); 
              __pyx_t_8 = PyTuple_GET_ITEM(sequence, 5); 
            } else {
              __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
              __pyx_t_11 = PyList_GET_ITEM(sequence, 2); 
              __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
              __pyx_t_3 = PyList_GET_ITEM(sequence, 4); 
              __pyx_t_8 = PyList_GET_ITEM(sequence, 5); 
            }
            __Pyx_INCREF(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_8);
            #else
            {
              Py_ssize_t i;
              PyObject** temps[6] = {&__pyx_t_6,&__pyx_t_15,&__pyx_t_11,&__pyx_t_2,&__pyx_t_3,&__pyx_t_8};
              for (i=0; i < 6; i++) {
                PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1622, __pyx_L1_error)
                __Pyx_GOTREF(item);
                *(temps[i]) = item;
              }
            }
            #endif
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          } else {
            Py_ssize_t index = -1;
            PyObject** temps[6] = {&__pyx_t_6,&__pyx_t_15,&__pyx_t_11,&__pyx_t_2,&__pyx_t_3,&__pyx_t_8};
            __pyx_t_13 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1622, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_26 = Py_TYPE(__pyx_t_13)->tp_iternext;
            for (index=0; index < 6; index++) {
              PyObject* item = __pyx_t_26(__pyx_t_13); if (unlikely(!item)) goto __pyx_L67_unpacking_failed;
              __Pyx_GOTREF(item);
              *(temps[index]) = item;
            }
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_26(__pyx_t_13), 6) < 0) __PYX_ERR(0, 1622, __pyx_L1_error)
            __pyx_t_26 = NULL;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            goto __pyx_L68_unpacking_done;
            __pyx_L67_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __pyx_t_26 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 1622, __pyx_L1_error)
            __pyx_L68_unpacking_done:;
          }
          __Pyx_XDECREF_SET(__pyx_v_pIn, __pyx_t_6);
          __pyx_t_6 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pOut, __pyx_t_15);
          __pyx_t_15 = 0;
          __Pyx_XDECREF_SET(__pyx_v_vperpIn, __pyx_t_11);
          __pyx_t_11 = 0;
          __Pyx_XDECREF_SET(__pyx_v_vperpOut, __pyx_t_2);
          __pyx_t_2 = 0;
          __Pyx_XDECREF_SET(__pyx_v_iIn, __pyx_t_3);
          __pyx_t_3 = 0;
          __Pyx_XDECREF_SET(__pyx_v_iOut, __pyx_t_8);
          __pyx_t_8 = 0;

          /* "tofu/geom/_GG03.pyx":1623
 *                 for jj in range(0,len(lslim)):
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Lin(Ds, dus, LSPoly[ii], LSVIn[ii], lslim[jj], EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))             # <<<<<<<<<<<<<<
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 *                     indout = np.zeros((NL,),dtype=bool)
 */
          __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sqrt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyNumber_Subtract(__pyx_v_Ds, __pyx_v_pIn); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = PyNumber_Power(__pyx_t_8, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11);
          __pyx_t_11 = 0;
          __pyx_t_11 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          if (PyDict_SetItem(__pyx_t_11, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 1623, __pyx_L1_error)
          __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, __pyx_t_11); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1623, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_11)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_11);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (!__pyx_t_11) {
            __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1623, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_3)) {
              PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_15};
              __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1623, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
              PyObject *__pyx_temp[2] = {__pyx_t_11, __pyx_t_15};
              __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1623, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            } else
            #endif
            {
              __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1623, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_11); __pyx_t_11 = NULL;
              __Pyx_GIVEREF(__pyx_t_15);
              PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_15);
              __pyx_t_15 = 0;
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1623, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kpin, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "tofu/geom/_GG03.pyx":1624
 *                     pIn, pOut, vperpIn, vperpOut, iIn, iOut = Calc_LOS_PInOut_Lin(Ds, dus, LSPoly[ii], LSVIn[ii], lslim[jj], EpsPlane=EpsPlane)
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))             # <<<<<<<<<<<<<<
 *                     indout = np.zeros((NL,),dtype=bool)
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 */
          __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_8, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_kpin); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_8)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_kpin};
              __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_12);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_kpin};
              __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_12);
            } else
            #endif
            {
              __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_INCREF(__pyx_v_kpin);
              __Pyx_GIVEREF(__pyx_v_kpin);
              PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_kpin);
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_15, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = PyNumber_Invert(__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_isnan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __pyx_t_15 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (!__pyx_t_15) {
            __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_kPOut); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_3)) {
              PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_kPOut};
              __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_GOTREF(__pyx_t_12);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
              PyObject *__pyx_temp[2] = {__pyx_t_15, __pyx_v_kPOut};
              __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
              __Pyx_GOTREF(__pyx_t_12);
            } else
            #endif
            {
              __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_11);
              __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_15); __pyx_t_15 = NULL;
              __Pyx_INCREF(__pyx_v_kPOut);
              __Pyx_GIVEREF(__pyx_v_kPOut);
              PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_kPOut);
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = PyNumber_Invert(__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = PyNumber_And(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1624, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_XDECREF_SET(__pyx_v_indNoNan, __pyx_t_12);
          __pyx_t_12 = 0;

          /* "tofu/geom/_GG03.pyx":1625
 *                     kpin = np.sqrt(np.sum((Ds-pIn)**2,axis=0))
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 *                     indout = np.zeros((NL,),dtype=bool)             # <<<<<<<<<<<<<<
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 */
          __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = PyTuple_New(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_INCREF(__pyx_v_NL);
          __Pyx_GIVEREF(__pyx_v_NL);
          PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_NL);
          __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_12);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_12);
          __pyx_t_12 = 0;
          __pyx_t_12 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (PyDict_SetItem(__pyx_t_12, __pyx_n_s_dtype, ((PyObject *)__pyx_ptype_7cpython_4bool_bool)) < 0) __PYX_ERR(0, 1625, __pyx_L1_error)
          __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1625, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __Pyx_XDECREF_SET(__pyx_v_indout, __pyx_t_11);
          __pyx_t_11 = 0;

          /* "tofu/geom/_GG03.pyx":1626
 *                     indNoNan = (~np.isnan(kpin)) & (~np.isnan(kPOut))
 *                     indout = np.zeros((NL,),dtype=bool)
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]             # <<<<<<<<<<<<<<
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):
 */
          __pyx_t_11 = PyObject_GetItem(__pyx_v_kpin, __pyx_v_indNoNan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1626, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __pyx_t_12 = PyObject_GetItem(__pyx_v_kPOut, __pyx_v_indNoNan); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1626, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_8 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1626, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(PyObject_SetItem(__pyx_v_indout, __pyx_v_indNoNan, __pyx_t_8) < 0)) __PYX_ERR(0, 1626, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

          /* "tofu/geom/_GG03.pyx":1627
 *                     indout = np.zeros((NL,),dtype=bool)
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True             # <<<<<<<<<<<<<<
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]
 */
          __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_isnan); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_12)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_12);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          if (!__pyx_t_12) {
            __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_kpin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_v_kpin};
              __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_v_kpin};
              __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __pyx_t_12 = NULL;
              __Pyx_INCREF(__pyx_v_kpin);
              __Pyx_GIVEREF(__pyx_v_kpin);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_kpin);
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_11 = PyNumber_Invert(__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_isnan); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_12, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_kPOut); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_8);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_12)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_kPOut};
              __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_kPOut};
              __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_8);
            } else
            #endif
            {
              __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_INCREF(__pyx_v_kPOut);
              __Pyx_GIVEREF(__pyx_v_kPOut);
              PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_kPOut);
              __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_15, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1627, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_8);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          __pyx_t_12 = PyNumber_And(__pyx_t_11, __pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          if (unlikely(PyObject_SetItem(__pyx_v_indout, __pyx_t_12, Py_True) < 0)) __PYX_ERR(0, 1627, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

          /* "tofu/geom/_GG03.pyx":1628
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):             # <<<<<<<<<<<<<<
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 */
          __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_any); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_11);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
          __pyx_t_8 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) {
            __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_11);
            if (likely(__pyx_t_8)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
              __Pyx_INCREF(__pyx_t_8);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_11, function);
            }
          }
          if (!__pyx_t_8) {
            __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_v_indout); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1628, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_indout};
              __pyx_t_12 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1628, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_GOTREF(__pyx_t_12);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
              PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_v_indout};
              __pyx_t_12 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1628, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
              __Pyx_GOTREF(__pyx_t_12);
            } else
            #endif
            {
              __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1628, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); __pyx_t_8 = NULL;
              __Pyx_INCREF(__pyx_v_indout);
              __Pyx_GIVEREF(__pyx_v_indout);
              PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_v_indout);
              __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1628, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_12);
              __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1628, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (__pyx_t_5) {

            /* "tofu/geom/_GG03.pyx":1629
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]             # <<<<<<<<<<<<<<
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 */
            __pyx_t_12 = PyObject_GetItem(__pyx_v_kpin, __pyx_v_indout); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1629, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            if (unlikely(PyObject_SetItem(__pyx_v_kPOut, __pyx_v_indout, __pyx_t_12) < 0)) __PYX_ERR(0, 1629, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "tofu/geom/_GG03.pyx":1630
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]             # <<<<<<<<<<<<<<
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]
 */
            __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1630, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_INCREF(__pyx_slice__257);
            __Pyx_GIVEREF(__pyx_slice__257);
            PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_slice__257);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_indout);
            __pyx_t_11 = PyObject_GetItem(__pyx_v_pIn, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1630, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1630, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_INCREF(__pyx_slice__258);
            __Pyx_GIVEREF(__pyx_slice__258);
            PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_slice__258);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_POut, __pyx_t_12, __pyx_t_11) < 0)) __PYX_ERR(0, 1630, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

            /* "tofu/geom/_GG03.pyx":1631
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]             # <<<<<<<<<<<<<<
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii
 */
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1631, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_slice__259);
            __Pyx_GIVEREF(__pyx_slice__259);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_slice__259);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_indout);
            __pyx_t_12 = PyObject_GetItem(__pyx_v_vperpIn, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1631, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1631, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_slice__260);
            __Pyx_GIVEREF(__pyx_slice__260);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_slice__260);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_VperpOut, __pyx_t_11, __pyx_t_12) < 0)) __PYX_ERR(0, 1631, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "tofu/geom/_GG03.pyx":1632
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]             # <<<<<<<<<<<<<<
 *                         IOut[0,indout] = 1+ii
 *                         IOut[1,indout] = jj
 */
            __pyx_t_12 = PyObject_GetItem(__pyx_v_iIn, __pyx_v_indout); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1632, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1632, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_int_2);
            __Pyx_GIVEREF(__pyx_int_2);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_2);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_t_11, __pyx_t_12) < 0)) __PYX_ERR(0, 1632, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "tofu/geom/_GG03.pyx":1633
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii             # <<<<<<<<<<<<<<
 *                         IOut[1,indout] = jj
 * 
 */
            __pyx_t_12 = __Pyx_PyInt_From_long((1 + __pyx_v_ii)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1633, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1633, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_int_0);
            __Pyx_GIVEREF(__pyx_int_0);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_0);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_t_11, __pyx_t_12) < 0)) __PYX_ERR(0, 1633, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "tofu/geom/_GG03.pyx":1634
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii
 *                         IOut[1,indout] = jj             # <<<<<<<<<<<<<<
 * 
 *     if not v:
 */
            __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_jj); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1634, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_12);
            __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1634, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_11);
            __Pyx_INCREF(__pyx_int_1);
            __Pyx_GIVEREF(__pyx_int_1);
            PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_1);
            __Pyx_INCREF(__pyx_v_indout);
            __Pyx_GIVEREF(__pyx_v_indout);
            PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_indout);
            if (unlikely(PyObject_SetItem(__pyx_v_IOut, __pyx_t_11, __pyx_t_12) < 0)) __PYX_ERR(0, 1634, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
            __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

            /* "tofu/geom/_GG03.pyx":1628
 *                     indout[indNoNan] = kpin[indNoNan]<kPOut[indNoNan]
 *                     indout[(~np.isnan(kpin)) & np.isnan(kPOut)] = True
 *                     if np.any(indout):             # <<<<<<<<<<<<<<
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 */
          }
        }
      }

      /* "tofu/geom/_GG03.pyx":1617
 *         assert np.allclose(kPOut,np.sum((POut-Ds)*dus,axis=0),equal_nan=True)
 *         assert np.allclose(kPIn,np.sum((PIn-Ds)*dus,axis=0),equal_nan=True)
 *         if LSPoly is not None:             # <<<<<<<<<<<<<<
 *             Ind = np.zeros((2,NL))
 *             for ii in range(0,len(LSPoly)):
 */
    }
  }
  __pyx_L41:;

  /* "tofu/geom/_GG03.pyx":1636
 *                         IOut[1,indout] = jj
 * 
 *     if not v:             # <<<<<<<<<<<<<<
 *         PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut = PIn.flatten(), POut.flatten(), kPIn[0], kPOut[0], VperpIn.flatten(), VperpOut.flatten(), IIn[0], IOut.flatten()
 *     return PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_v); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 1636, __pyx_L1_error)
  __pyx_t_1 = ((!__pyx_t_5) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":1637
 * 
 *     if not v:
 *         PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut = PIn.flatten(), POut.flatten(), kPIn[0], kPOut[0], VperpIn.flatten(), VperpOut.flatten(), IIn[0], IOut.flatten()             # <<<<<<<<<<<<<<
 *     return PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut
 * 
 */
    __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_PIn, __pyx_n_s_flatten); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_11);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_11, function);
      }
    }
    if (__pyx_t_15) {
      __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_15); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1637, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_POut, __pyx_n_s_flatten); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1637, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_kPIn, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_kPOut, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_VperpIn, __pyx_n_s_flatten); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1637, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_VperpOut, __pyx_n_s_flatten); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_13 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_13)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_13) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1637, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_IIn, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_30 = __Pyx_PyObject_GetAttrStr(__pyx_v_IOut, __pyx_n_s_flatten); if (unlikely(!__pyx_t_30)) __PYX_ERR(0, 1637, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_30);
    __pyx_t_31 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_30))) {
      __pyx_t_31 = PyMethod_GET_SELF(__pyx_t_30);
      if (likely(__pyx_t_31)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_30);
        __Pyx_INCREF(__pyx_t_31);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_30, function);
      }
    }
    if (__pyx_t_31) {
      __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_30, __pyx_t_31); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1637, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
    } else {
      __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_30); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1637, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
    __Pyx_DECREF_SET(__pyx_v_PIn, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_DECREF_SET(__pyx_v_POut, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_DECREF_SET(__pyx_v_kPIn, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_kPOut, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_DECREF_SET(__pyx_v_VperpIn, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_VperpOut, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_IIn, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_DECREF_SET(__pyx_v_IOut, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "tofu/geom/_GG03.pyx":1636
 *                         IOut[1,indout] = jj
 * 
 *     if not v:             # <<<<<<<<<<<<<<
 *         PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut = PIn.flatten(), POut.flatten(), kPIn[0], kPOut[0], VperpIn.flatten(), VperpOut.flatten(), IIn[0], IOut.flatten()
 *     return PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut
 */
  }

  /* "tofu/geom/_GG03.pyx":1638
 *     if not v:
 *         PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut = PIn.flatten(), POut.flatten(), kPIn[0], kPOut[0], VperpIn.flatten(), VperpOut.flatten(), IIn[0], IOut.flatten()
 *     return PIn, POut, kPIn, kPOut, VperpIn, VperpOut, IIn, IOut             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_13 = PyTuple_New(8); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_INCREF(__pyx_v_PIn);
  __Pyx_GIVEREF(__pyx_v_PIn);
  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_v_PIn);
  __Pyx_INCREF(__pyx_v_POut);
  __Pyx_GIVEREF(__pyx_v_POut);
  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_v_POut);
  __Pyx_INCREF(__pyx_v_kPIn);
  __Pyx_GIVEREF(__pyx_v_kPIn);
  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_kPIn);
  __Pyx_INCREF(__pyx_v_kPOut);
  __Pyx_GIVEREF(__pyx_v_kPOut);
  PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_v_kPOut);
  __Pyx_INCREF(__pyx_v_VperpIn);
  __Pyx_GIVEREF(__pyx_v_VperpIn);
  PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_v_VperpIn);
  __Pyx_INCREF(__pyx_v_VperpOut);
  __Pyx_GIVEREF(__pyx_v_VperpOut);
  PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_v_VperpOut);
  __Pyx_INCREF(__pyx_v_IIn);
  __Pyx_GIVEREF(__pyx_v_IIn);
  PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_v_IIn);
  __Pyx_INCREF(__pyx_v_IOut);
  __Pyx_GIVEREF(__pyx_v_IOut);
  PyTuple_SET_ITEM(__pyx_t_13, 7, __pyx_v_IOut);
  __pyx_r = __pyx_t_13;
  __pyx_t_13 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1532
 * 
 * 
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,             # <<<<<<<<<<<<<<
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_15);
  __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
  __Pyx_XDECREF(__pyx_t_30);
  __Pyx_XDECREF(__pyx_t_31);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VIn.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPoly.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_Calc_PInOut_VesStruct", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VIn.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPoly.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_C1);
  __Pyx_XDECREF(__pyx_v_C2);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_NL);
  __Pyx_XDECREF(__pyx_v_IOut);
  __Pyx_XDECREF(__pyx_v_PIn);
  __Pyx_XDECREF(__pyx_v_POut);
  __Pyx_XDECREF(__pyx_v_VperpIn);
  __Pyx_XDECREF(__pyx_v_VperpOut);
  __Pyx_XDECREF(__pyx_v_IIn);
  __Pyx_XDECREF(__pyx_v_kPOut);
  __Pyx_XDECREF(__pyx_v_kPIn);
  __Pyx_XDECREF(__pyx_v_Ind);
  __Pyx_XDECREF(__pyx_v_lslim);
  __Pyx_XDECREF(__pyx_v_pIn);
  __Pyx_XDECREF(__pyx_v_pOut);
  __Pyx_XDECREF(__pyx_v_vperpIn);
  __Pyx_XDECREF(__pyx_v_vperpOut);
  __Pyx_XDECREF(__pyx_v_iIn);
  __Pyx_XDECREF(__pyx_v_iOut);
  __Pyx_XDECREF(__pyx_v_kpin);
  __Pyx_XDECREF(__pyx_v_indNoNan);
  __Pyx_XDECREF(__pyx_v_indout);
  __Pyx_XDECREF(__pyx_v_pp);
  __Pyx_XDECREF(__pyx_v_ee);
  __Pyx_XDECREF(__pyx_v_ll);
  __Pyx_XDECREF(__pyx_v_Ds);
  __Pyx_XDECREF(__pyx_v_dus);
  __Pyx_XDECREF(__pyx_v_RMin);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1649
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Tor(double [:,::1] Ds, double [:,::1] us, double [:,::1] VPoly, double [:,::1] vIn, Lim=None,             # <<<<<<<<<<<<<<
 *                          bool Forbid=True, RMin=None, double EpsUz=1.e-6, double EpsVz=1.e-9, double EpsA=1.e-9, double EpsB=1.e-9, double EpsPlane=1.e-9):
 * 
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor(__Pyx_memviewslice __pyx_v_Ds, __Pyx_memviewslice __pyx_v_us, __Pyx_memviewslice __pyx_v_VPoly, __Pyx_memviewslice __pyx_v_vIn, struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Tor *__pyx_optional_args) {
  PyObject *__pyx_v_Lim = ((PyObject *)Py_None);

  /* "tofu/geom/_GG03.pyx":1650
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Tor(double [:,::1] Ds, double [:,::1] us, double [:,::1] VPoly, double [:,::1] vIn, Lim=None,
 *                          bool Forbid=True, RMin=None, double EpsUz=1.e-6, double EpsVz=1.e-9, double EpsA=1.e-9, double EpsB=1.e-9, double EpsPlane=1.e-9):             # <<<<<<<<<<<<<<
 * 
 *     cdef int ii, jj, Nl=Ds.shape[1], Ns=vIn.shape[1]
 */
  PyBoolObject *__pyx_v_Forbid = ((PyBoolObject *)Py_True);
  PyObject *__pyx_v_RMin = ((PyObject *)Py_None);
  double __pyx_v_EpsUz = ((double)1.e-6);
  double __pyx_v_EpsVz = ((double)1.e-9);
  double __pyx_v_EpsA = ((double)1.e-9);
  double __pyx_v_EpsB = ((double)1.e-9);
  double __pyx_v_EpsPlane = ((double)1.e-9);
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_Nl;
  int __pyx_v_Ns;
  double __pyx_v_Rmin;
  double __pyx_v_upscaDp;
  double __pyx_v_upar2;
  double __pyx_v_Dpar2;
  double __pyx_v_Crit2;
  double __pyx_v_kout;
  double __pyx_v_kin;
  int __pyx_v_indin;
  int __pyx_v_indout;
  int __pyx_v_Done;
  double __pyx_v_L;
  double __pyx_v_S1X;
  double __pyx_v_S1Y;
  double __pyx_v_S2X;
  double __pyx_v_S2Y;
  double __pyx_v_sca;
  double __pyx_v_sca0;
  double __pyx_v_sca1;
  double __pyx_v_sca2;
  double __pyx_v_q;
  double __pyx_v_C;
  double __pyx_v_delta;
  double __pyx_v_sqd;
  double __pyx_v_k;
  double __pyx_v_sol0;
  double __pyx_v_sol1;
  double __pyx_v_phi;
  double __pyx_v_L0;
  double __pyx_v_L1;
  double __pyx_v_v0;
  double __pyx_v_v1;
  double __pyx_v_A;
  double __pyx_v_B;
  double __pyx_v_ephiIn0;
  double __pyx_v_ephiIn1;
  int __pyx_v_Forbidbis;
  int __pyx_v_Forbid0;
  PyArrayObject *__pyx_v_SIn_ = 0;
  PyArrayObject *__pyx_v_SOut_ = 0;
  PyArrayObject *__pyx_v_VPerp_In = 0;
  PyArrayObject *__pyx_v_VPerp_Out = 0;
  PyArrayObject *__pyx_v_indIn_ = 0;
  PyArrayObject *__pyx_v_indOut_ = 0;
  __Pyx_memviewslice __pyx_v_SIn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_SOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_VPerpIn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_VPerpOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_indIn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_indOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_LocalBuf_ND __pyx_pybuffernd_SIn_;
  __Pyx_Buffer __pyx_pybuffer_SIn_;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_SOut_;
  __Pyx_Buffer __pyx_pybuffer_SOut_;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPerp_In;
  __Pyx_Buffer __pyx_pybuffer_VPerp_In;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPerp_Out;
  __Pyx_Buffer __pyx_pybuffer_VPerp_Out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indIn_;
  __Pyx_Buffer __pyx_pybuffer_indIn_;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indOut_;
  __Pyx_Buffer __pyx_pybuffer_indOut_;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_12;
  int __pyx_t_13;
  double __pyx_t_14;
  double __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_t_17;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  int __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  int __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  Py_ssize_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  int __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  double __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  Py_ssize_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  Py_ssize_t __pyx_t_138;
  Py_ssize_t __pyx_t_139;
  Py_ssize_t __pyx_t_140;
  Py_ssize_t __pyx_t_141;
  Py_ssize_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  Py_ssize_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  Py_ssize_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  Py_ssize_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  Py_ssize_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  Py_ssize_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  Py_ssize_t __pyx_t_154;
  Py_ssize_t __pyx_t_155;
  Py_ssize_t __pyx_t_156;
  Py_ssize_t __pyx_t_157;
  Py_ssize_t __pyx_t_158;
  Py_ssize_t __pyx_t_159;
  Py_ssize_t __pyx_t_160;
  Py_ssize_t __pyx_t_161;
  Py_ssize_t __pyx_t_162;
  Py_ssize_t __pyx_t_163;
  Py_ssize_t __pyx_t_164;
  Py_ssize_t __pyx_t_165;
  Py_ssize_t __pyx_t_166;
  Py_ssize_t __pyx_t_167;
  Py_ssize_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  Py_ssize_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  Py_ssize_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  Py_ssize_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  Py_ssize_t __pyx_t_176;
  Py_ssize_t __pyx_t_177;
  Py_ssize_t __pyx_t_178;
  Py_ssize_t __pyx_t_179;
  Py_ssize_t __pyx_t_180;
  Py_ssize_t __pyx_t_181;
  Py_ssize_t __pyx_t_182;
  Py_ssize_t __pyx_t_183;
  Py_ssize_t __pyx_t_184;
  Py_ssize_t __pyx_t_185;
  Py_ssize_t __pyx_t_186;
  Py_ssize_t __pyx_t_187;
  Py_ssize_t __pyx_t_188;
  Py_ssize_t __pyx_t_189;
  Py_ssize_t __pyx_t_190;
  Py_ssize_t __pyx_t_191;
  Py_ssize_t __pyx_t_192;
  Py_ssize_t __pyx_t_193;
  Py_ssize_t __pyx_t_194;
  Py_ssize_t __pyx_t_195;
  Py_ssize_t __pyx_t_196;
  Py_ssize_t __pyx_t_197;
  Py_ssize_t __pyx_t_198;
  Py_ssize_t __pyx_t_199;
  Py_ssize_t __pyx_t_200;
  Py_ssize_t __pyx_t_201;
  Py_ssize_t __pyx_t_202;
  Py_ssize_t __pyx_t_203;
  Py_ssize_t __pyx_t_204;
  Py_ssize_t __pyx_t_205;
  Py_ssize_t __pyx_t_206;
  Py_ssize_t __pyx_t_207;
  Py_ssize_t __pyx_t_208;
  Py_ssize_t __pyx_t_209;
  Py_ssize_t __pyx_t_210;
  Py_ssize_t __pyx_t_211;
  Py_ssize_t __pyx_t_212;
  Py_ssize_t __pyx_t_213;
  Py_ssize_t __pyx_t_214;
  Py_ssize_t __pyx_t_215;
  Py_ssize_t __pyx_t_216;
  Py_ssize_t __pyx_t_217;
  Py_ssize_t __pyx_t_218;
  Py_ssize_t __pyx_t_219;
  Py_ssize_t __pyx_t_220;
  Py_ssize_t __pyx_t_221;
  Py_ssize_t __pyx_t_222;
  Py_ssize_t __pyx_t_223;
  Py_ssize_t __pyx_t_224;
  Py_ssize_t __pyx_t_225;
  Py_ssize_t __pyx_t_226;
  Py_ssize_t __pyx_t_227;
  Py_ssize_t __pyx_t_228;
  Py_ssize_t __pyx_t_229;
  Py_ssize_t __pyx_t_230;
  Py_ssize_t __pyx_t_231;
  Py_ssize_t __pyx_t_232;
  Py_ssize_t __pyx_t_233;
  Py_ssize_t __pyx_t_234;
  Py_ssize_t __pyx_t_235;
  Py_ssize_t __pyx_t_236;
  Py_ssize_t __pyx_t_237;
  Py_ssize_t __pyx_t_238;
  Py_ssize_t __pyx_t_239;
  Py_ssize_t __pyx_t_240;
  Py_ssize_t __pyx_t_241;
  Py_ssize_t __pyx_t_242;
  Py_ssize_t __pyx_t_243;
  Py_ssize_t __pyx_t_244;
  Py_ssize_t __pyx_t_245;
  Py_ssize_t __pyx_t_246;
  Py_ssize_t __pyx_t_247;
  Py_ssize_t __pyx_t_248;
  Py_ssize_t __pyx_t_249;
  Py_ssize_t __pyx_t_250;
  Py_ssize_t __pyx_t_251;
  Py_ssize_t __pyx_t_252;
  Py_ssize_t __pyx_t_253;
  Py_ssize_t __pyx_t_254;
  Py_ssize_t __pyx_t_255;
  Py_ssize_t __pyx_t_256;
  Py_ssize_t __pyx_t_257;
  Py_ssize_t __pyx_t_258;
  Py_ssize_t __pyx_t_259;
  Py_ssize_t __pyx_t_260;
  Py_ssize_t __pyx_t_261;
  Py_ssize_t __pyx_t_262;
  Py_ssize_t __pyx_t_263;
  Py_ssize_t __pyx_t_264;
  Py_ssize_t __pyx_t_265;
  Py_ssize_t __pyx_t_266;
  Py_ssize_t __pyx_t_267;
  Py_ssize_t __pyx_t_268;
  Py_ssize_t __pyx_t_269;
  Py_ssize_t __pyx_t_270;
  Py_ssize_t __pyx_t_271;
  Py_ssize_t __pyx_t_272;
  Py_ssize_t __pyx_t_273;
  Py_ssize_t __pyx_t_274;
  Py_ssize_t __pyx_t_275;
  Py_ssize_t __pyx_t_276;
  Py_ssize_t __pyx_t_277;
  __Pyx_memviewslice __pyx_t_278 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_279;
  Py_ssize_t __pyx_t_280;
  Py_ssize_t __pyx_t_281;
  Py_ssize_t __pyx_t_282;
  Py_ssize_t __pyx_t_283;
  Py_ssize_t __pyx_t_284;
  Py_ssize_t __pyx_t_285;
  Py_ssize_t __pyx_t_286;
  Py_ssize_t __pyx_t_287;
  Py_ssize_t __pyx_t_288;
  Py_ssize_t __pyx_t_289;
  Py_ssize_t __pyx_t_290;
  Py_ssize_t __pyx_t_291;
  Py_ssize_t __pyx_t_292;
  Py_ssize_t __pyx_t_293;
  Py_ssize_t __pyx_t_294;
  Py_ssize_t __pyx_t_295;
  Py_ssize_t __pyx_t_296;
  Py_ssize_t __pyx_t_297;
  Py_ssize_t __pyx_t_298;
  Py_ssize_t __pyx_t_299;
  Py_ssize_t __pyx_t_300;
  Py_ssize_t __pyx_t_301;
  Py_ssize_t __pyx_t_302;
  Py_ssize_t __pyx_t_303;
  Py_ssize_t __pyx_t_304;
  Py_ssize_t __pyx_t_305;
  Py_ssize_t __pyx_t_306;
  Py_ssize_t __pyx_t_307;
  Py_ssize_t __pyx_t_308;
  Py_ssize_t __pyx_t_309;
  Py_ssize_t __pyx_t_310;
  Py_ssize_t __pyx_t_311;
  Py_ssize_t __pyx_t_312;
  Py_ssize_t __pyx_t_313;
  Py_ssize_t __pyx_t_314;
  Py_ssize_t __pyx_t_315;
  Py_ssize_t __pyx_t_316;
  Py_ssize_t __pyx_t_317;
  Py_ssize_t __pyx_t_318;
  Py_ssize_t __pyx_t_319;
  Py_ssize_t __pyx_t_320;
  Py_ssize_t __pyx_t_321;
  Py_ssize_t __pyx_t_322;
  Py_ssize_t __pyx_t_323;
  Py_ssize_t __pyx_t_324;
  Py_ssize_t __pyx_t_325;
  Py_ssize_t __pyx_t_326;
  Py_ssize_t __pyx_t_327;
  Py_ssize_t __pyx_t_328;
  Py_ssize_t __pyx_t_329;
  Py_ssize_t __pyx_t_330;
  Py_ssize_t __pyx_t_331;
  Py_ssize_t __pyx_t_332;
  Py_ssize_t __pyx_t_333;
  Py_ssize_t __pyx_t_334;
  Py_ssize_t __pyx_t_335;
  Py_ssize_t __pyx_t_336;
  Py_ssize_t __pyx_t_337;
  Py_ssize_t __pyx_t_338;
  Py_ssize_t __pyx_t_339;
  Py_ssize_t __pyx_t_340;
  Py_ssize_t __pyx_t_341;
  Py_ssize_t __pyx_t_342;
  Py_ssize_t __pyx_t_343;
  Py_ssize_t __pyx_t_344;
  Py_ssize_t __pyx_t_345;
  Py_ssize_t __pyx_t_346;
  Py_ssize_t __pyx_t_347;
  Py_ssize_t __pyx_t_348;
  Py_ssize_t __pyx_t_349;
  Py_ssize_t __pyx_t_350;
  Py_ssize_t __pyx_t_351;
  Py_ssize_t __pyx_t_352;
  Py_ssize_t __pyx_t_353;
  Py_ssize_t __pyx_t_354;
  Py_ssize_t __pyx_t_355;
  Py_ssize_t __pyx_t_356;
  Py_ssize_t __pyx_t_357;
  Py_ssize_t __pyx_t_358;
  Py_ssize_t __pyx_t_359;
  Py_ssize_t __pyx_t_360;
  Py_ssize_t __pyx_t_361;
  Py_ssize_t __pyx_t_362;
  Py_ssize_t __pyx_t_363;
  Py_ssize_t __pyx_t_364;
  Py_ssize_t __pyx_t_365;
  Py_ssize_t __pyx_t_366;
  Py_ssize_t __pyx_t_367;
  Py_ssize_t __pyx_t_368;
  Py_ssize_t __pyx_t_369;
  Py_ssize_t __pyx_t_370;
  Py_ssize_t __pyx_t_371;
  Py_ssize_t __pyx_t_372;
  Py_ssize_t __pyx_t_373;
  Py_ssize_t __pyx_t_374;
  Py_ssize_t __pyx_t_375;
  Py_ssize_t __pyx_t_376;
  Py_ssize_t __pyx_t_377;
  Py_ssize_t __pyx_t_378;
  Py_ssize_t __pyx_t_379;
  Py_ssize_t __pyx_t_380;
  Py_ssize_t __pyx_t_381;
  Py_ssize_t __pyx_t_382;
  Py_ssize_t __pyx_t_383;
  Py_ssize_t __pyx_t_384;
  Py_ssize_t __pyx_t_385;
  Py_ssize_t __pyx_t_386;
  Py_ssize_t __pyx_t_387;
  Py_ssize_t __pyx_t_388;
  Py_ssize_t __pyx_t_389;
  Py_ssize_t __pyx_t_390;
  Py_ssize_t __pyx_t_391;
  Py_ssize_t __pyx_t_392;
  Py_ssize_t __pyx_t_393;
  Py_ssize_t __pyx_t_394;
  Py_ssize_t __pyx_t_395;
  Py_ssize_t __pyx_t_396;
  Py_ssize_t __pyx_t_397;
  Py_ssize_t __pyx_t_398;
  Py_ssize_t __pyx_t_399;
  Py_ssize_t __pyx_t_400;
  Py_ssize_t __pyx_t_401;
  Py_ssize_t __pyx_t_402;
  Py_ssize_t __pyx_t_403;
  Py_ssize_t __pyx_t_404;
  PyObject *__pyx_t_405 = NULL;
  PyObject *__pyx_t_406 = NULL;
  __Pyx_RefNannySetupContext("Calc_LOS_PInOut_Tor", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_Lim = __pyx_optional_args->Lim;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_Forbid = __pyx_optional_args->Forbid;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_RMin = __pyx_optional_args->RMin;
          if (__pyx_optional_args->__pyx_n > 3) {
            __pyx_v_EpsUz = __pyx_optional_args->EpsUz;
            if (__pyx_optional_args->__pyx_n > 4) {
              __pyx_v_EpsVz = __pyx_optional_args->EpsVz;
              if (__pyx_optional_args->__pyx_n > 5) {
                __pyx_v_EpsA = __pyx_optional_args->EpsA;
                if (__pyx_optional_args->__pyx_n > 6) {
                  __pyx_v_EpsB = __pyx_optional_args->EpsB;
                  if (__pyx_optional_args->__pyx_n > 7) {
                    __pyx_v_EpsPlane = __pyx_optional_args->EpsPlane;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  __pyx_pybuffer_SIn_.pybuffer.buf = NULL;
  __pyx_pybuffer_SIn_.refcount = 0;
  __pyx_pybuffernd_SIn_.data = NULL;
  __pyx_pybuffernd_SIn_.rcbuffer = &__pyx_pybuffer_SIn_;
  __pyx_pybuffer_SOut_.pybuffer.buf = NULL;
  __pyx_pybuffer_SOut_.refcount = 0;
  __pyx_pybuffernd_SOut_.data = NULL;
  __pyx_pybuffernd_SOut_.rcbuffer = &__pyx_pybuffer_SOut_;
  __pyx_pybuffer_VPerp_In.pybuffer.buf = NULL;
  __pyx_pybuffer_VPerp_In.refcount = 0;
  __pyx_pybuffernd_VPerp_In.data = NULL;
  __pyx_pybuffernd_VPerp_In.rcbuffer = &__pyx_pybuffer_VPerp_In;
  __pyx_pybuffer_VPerp_Out.pybuffer.buf = NULL;
  __pyx_pybuffer_VPerp_Out.refcount = 0;
  __pyx_pybuffernd_VPerp_Out.data = NULL;
  __pyx_pybuffernd_VPerp_Out.rcbuffer = &__pyx_pybuffer_VPerp_Out;
  __pyx_pybuffer_indIn_.pybuffer.buf = NULL;
  __pyx_pybuffer_indIn_.refcount = 0;
  __pyx_pybuffernd_indIn_.data = NULL;
  __pyx_pybuffernd_indIn_.rcbuffer = &__pyx_pybuffer_indIn_;
  __pyx_pybuffer_indOut_.pybuffer.buf = NULL;
  __pyx_pybuffer_indOut_.refcount = 0;
  __pyx_pybuffernd_indOut_.data = NULL;
  __pyx_pybuffernd_indOut_.rcbuffer = &__pyx_pybuffer_indOut_;

  /* "tofu/geom/_GG03.pyx":1652
 *                          bool Forbid=True, RMin=None, double EpsUz=1.e-6, double EpsVz=1.e-9, double EpsA=1.e-9, double EpsB=1.e-9, double EpsPlane=1.e-9):
 * 
 *     cdef int ii, jj, Nl=Ds.shape[1], Ns=vIn.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double Rmin, upscaDp, upar2, Dpar2, Crit2, kout, kin
 *     cdef int indin=0, indout=0, Done=0
 */
  __pyx_v_Nl = (__pyx_v_Ds.shape[1]);
  __pyx_v_Ns = (__pyx_v_vIn.shape[1]);

  /* "tofu/geom/_GG03.pyx":1654
 *     cdef int ii, jj, Nl=Ds.shape[1], Ns=vIn.shape[1]
 *     cdef double Rmin, upscaDp, upar2, Dpar2, Crit2, kout, kin
 *     cdef int indin=0, indout=0, Done=0             # <<<<<<<<<<<<<<
 *     cdef double L, S1X=0., S1Y=0., S2X=0., S2Y=0., sca, sca0, sca1, sca2
 *     cdef double q, C, delta, sqd, k, sol0, sol1, phi=0., L0=0., L1=0.
 */
  __pyx_v_indin = 0;
  __pyx_v_indout = 0;
  __pyx_v_Done = 0;

  /* "tofu/geom/_GG03.pyx":1655
 *     cdef double Rmin, upscaDp, upar2, Dpar2, Crit2, kout, kin
 *     cdef int indin=0, indout=0, Done=0
 *     cdef double L, S1X=0., S1Y=0., S2X=0., S2Y=0., sca, sca0, sca1, sca2             # <<<<<<<<<<<<<<
 *     cdef double q, C, delta, sqd, k, sol0, sol1, phi=0., L0=0., L1=0.
 *     cdef double v0, v1, A, B, ephiIn0, ephiIn1
 */
  __pyx_v_S1X = 0.;
  __pyx_v_S1Y = 0.;
  __pyx_v_S2X = 0.;
  __pyx_v_S2Y = 0.;

  /* "tofu/geom/_GG03.pyx":1656
 *     cdef int indin=0, indout=0, Done=0
 *     cdef double L, S1X=0., S1Y=0., S2X=0., S2Y=0., sca, sca0, sca1, sca2
 *     cdef double q, C, delta, sqd, k, sol0, sol1, phi=0., L0=0., L1=0.             # <<<<<<<<<<<<<<
 *     cdef double v0, v1, A, B, ephiIn0, ephiIn1
 *     cdef int Forbidbis, Forbid0
 */
  __pyx_v_phi = 0.;
  __pyx_v_L0 = 0.;
  __pyx_v_L1 = 0.;

  /* "tofu/geom/_GG03.pyx":1659
 *     cdef double v0, v1, A, B, ephiIn0, ephiIn1
 *     cdef int Forbidbis, Forbid0
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1659, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SIn_.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_SIn_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1659, __pyx_L1_error)
    } else {__pyx_pybuffernd_SIn_.diminfo[0].strides = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SIn_.diminfo[0].shape = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SIn_.diminfo[1].strides = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SIn_.diminfo[1].shape = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_SIn_ = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ones); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1659, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1659, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1659, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_6);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SOut_.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_SOut_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1659, __pyx_L1_error)
    } else {__pyx_pybuffernd_SOut_.diminfo[0].strides = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SOut_.diminfo[0].shape = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SOut_.diminfo[1].strides = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SOut_.diminfo[1].shape = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_SOut_ = ((PyArrayObject *)__pyx_t_6);
  __pyx_t_6 = 0;

  /* "tofu/geom/_GG03.pyx":1660
 *     cdef int Forbidbis, Forbid0
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))
 * 
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_nan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1660, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_VPerp_In = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1660, __pyx_L1_error)
    } else {__pyx_pybuffernd_VPerp_In.diminfo[0].strides = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPerp_In.diminfo[0].shape = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPerp_In.diminfo[1].strides = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPerp_In.diminfo[1].shape = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_VPerp_In = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nan); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1660, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1660, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_2);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_VPerp_Out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1660, __pyx_L1_error)
    } else {__pyx_pybuffernd_VPerp_Out.diminfo[0].strides = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPerp_Out.diminfo[0].shape = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPerp_Out.diminfo[1].strides = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPerp_Out.diminfo[1].shape = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_VPerp_Out = ((PyArrayObject *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":1661
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))             # <<<<<<<<<<<<<<
 * 
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
  __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1661, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indIn_.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_indIn_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indIn_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1661, __pyx_L1_error)
    } else {__pyx_pybuffernd_indIn_.diminfo[0].strides = __pyx_pybuffernd_indIn_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indIn_.diminfo[0].shape = __pyx_pybuffernd_indIn_.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_indIn_ = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1661, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1661, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indOut_.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_indOut_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indOut_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1661, __pyx_L1_error)
    } else {__pyx_pybuffernd_indOut_.diminfo[0].strides = __pyx_pybuffernd_indOut_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indOut_.diminfo[0].shape = __pyx_pybuffernd_indOut_.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_indOut_ = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":1663
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))
 * 
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out             # <<<<<<<<<<<<<<
 *     cdef double[::1] indIn=indIn_, indOut=indOut_
 *     if Lim is not None:
 */
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_SIn_));
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __pyx_v_SIn = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_SOut_));
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __pyx_v_SOut = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VPerp_In));
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __pyx_v_VPerpIn = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;
  __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VPerp_Out));
  if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 1663, __pyx_L1_error)
  __pyx_v_VPerpOut = __pyx_t_10;
  __pyx_t_10.memview = NULL;
  __pyx_t_10.data = NULL;

  /* "tofu/geom/_GG03.pyx":1664
 * 
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out
 *     cdef double[::1] indIn=indIn_, indOut=indOut_             # <<<<<<<<<<<<<<
 *     if Lim is not None:
 *         L0 = Catan2(Csin(Lim[0]),Ccos(Lim[0]))
 */
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_indIn_));
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __pyx_v_indIn = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_indOut_));
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1664, __pyx_L1_error)
  __pyx_v_indOut = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "tofu/geom/_GG03.pyx":1665
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out
 *     cdef double[::1] indIn=indIn_, indOut=indOut_
 *     if Lim is not None:             # <<<<<<<<<<<<<<
 *         L0 = Catan2(Csin(Lim[0]),Ccos(Lim[0]))
 *         L1 = Catan2(Csin(Lim[1]),Ccos(Lim[1]))
 */
  __pyx_t_12 = (__pyx_v_Lim != Py_None);
  __pyx_t_13 = (__pyx_t_12 != 0);
  if (__pyx_t_13) {

    /* "tofu/geom/_GG03.pyx":1666
 *     cdef double[::1] indIn=indIn_, indOut=indOut_
 *     if Lim is not None:
 *         L0 = Catan2(Csin(Lim[0]),Ccos(Lim[0]))             # <<<<<<<<<<<<<<
 *         L1 = Catan2(Csin(Lim[1]),Ccos(Lim[1]))
 * 
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1666, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_L0 = atan2(sin(__pyx_t_14), cos(__pyx_t_15));

    /* "tofu/geom/_GG03.pyx":1667
 *     if Lim is not None:
 *         L0 = Catan2(Csin(Lim[0]),Ccos(Lim[0]))
 *         L1 = Catan2(Csin(Lim[1]),Ccos(Lim[1]))             # <<<<<<<<<<<<<<
 * 
 *     ################
 */
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1667, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_L1 = atan2(sin(__pyx_t_15), cos(__pyx_t_14));

    /* "tofu/geom/_GG03.pyx":1665
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out
 *     cdef double[::1] indIn=indIn_, indOut=indOut_
 *     if Lim is not None:             # <<<<<<<<<<<<<<
 *         L0 = Catan2(Csin(Lim[0]),Ccos(Lim[0]))
 *         L1 = Catan2(Csin(Lim[1]),Ccos(Lim[1]))
 */
  }

  /* "tofu/geom/_GG03.pyx":1671
 *     ################
 *     # Prepare input
 *     if RMin is None:             # <<<<<<<<<<<<<<
 *         Rmin = 0.95*min(np.min(VPoly[0,:]),np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *     else:
 */
  __pyx_t_13 = (__pyx_v_RMin == Py_None);
  __pyx_t_12 = (__pyx_t_13 != 0);
  if (__pyx_t_12) {

    /* "tofu/geom/_GG03.pyx":1672
 *     # Prepare input
 *     if RMin is None:
 *         Rmin = 0.95*min(np.min(VPoly[0,:]),np.min(np.hypot(Ds[0,:],Ds[1,:])))             # <<<<<<<<<<<<<<
 *     else:
 *         Rmin = RMin
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_min); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_hypot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_11.data = __pyx_v_Ds.data;
    __pyx_t_11.memview = __pyx_v_Ds.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_Ds.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_Ds.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1672, __pyx_L1_error)
    }
        __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_11.shape[0] = __pyx_v_Ds.shape[1];
__pyx_t_11.strides[0] = __pyx_v_Ds.strides[1];
    __pyx_t_11.suboffsets[0] = -1;

__pyx_t_6 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
    __pyx_t_11.memview = NULL;
    __pyx_t_11.data = NULL;
    __pyx_t_11.data = __pyx_v_Ds.data;
    __pyx_t_11.memview = __pyx_v_Ds.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 1;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_Ds.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_Ds.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1672, __pyx_L1_error)
    }
        __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_11.shape[0] = __pyx_v_Ds.shape[1];
__pyx_t_11.strides[0] = __pyx_v_Ds.strides[1];
    __pyx_t_11.suboffsets[0] = -1;

__pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
    __pyx_t_11.memview = NULL;
    __pyx_t_11.data = NULL;
    __pyx_t_16 = NULL;
    __pyx_t_17 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_17 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_6, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1672, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_16, __pyx_t_6, __pyx_t_3};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1672, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_18 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_17, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_17, __pyx_t_3);
      __pyx_t_6 = 0;
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1672, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_1};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else
      #endif
      {
        __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_min); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __pyx_t_11.data = __pyx_v_VPoly.data;
    __pyx_t_11.memview = __pyx_v_VPoly.memview;
    __PYX_INC_MEMVIEW(&__pyx_t_11, 0);
    {
    Py_ssize_t __pyx_tmp_idx = 0;
    Py_ssize_t __pyx_tmp_shape = __pyx_v_VPoly.shape[0];
    Py_ssize_t __pyx_tmp_stride = __pyx_v_VPoly.strides[0];
    if (0 && (__pyx_tmp_idx < 0))
        __pyx_tmp_idx += __pyx_tmp_shape;
    if (0 && (__pyx_tmp_idx < 0 || __pyx_tmp_idx >= __pyx_tmp_shape)) {
        PyErr_SetString(PyExc_IndexError, "Index out of bounds (axis 0)");
        __PYX_ERR(0, 1672, __pyx_L1_error)
    }
        __pyx_t_11.data += __pyx_tmp_idx * __pyx_tmp_stride;
}

__pyx_t_11.shape[0] = __pyx_v_VPoly.shape[1];
__pyx_t_11.strides[0] = __pyx_v_VPoly.strides[1];
    __pyx_t_11.suboffsets[0] = -1;

__pyx_t_18 = __pyx_memoryview_fromslice(__pyx_t_11, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_18);
    __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
    __pyx_t_11.memview = NULL;
    __pyx_t_11.data = NULL;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_18); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1672, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_18};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_18};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_18);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_18);
        __pyx_t_18 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1672, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_12) {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_t_4;
    } else {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = __pyx_t_2;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Multiply(__pyx_float_0_95, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_Rmin = __pyx_t_14;

    /* "tofu/geom/_GG03.pyx":1671
 *     ################
 *     # Prepare input
 *     if RMin is None:             # <<<<<<<<<<<<<<
 *         Rmin = 0.95*min(np.min(VPoly[0,:]),np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *     else:
 */
    goto __pyx_L4;
  }

  /* "tofu/geom/_GG03.pyx":1674
 *         Rmin = 0.95*min(np.min(VPoly[0,:]),np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *     else:
 *         Rmin = RMin             # <<<<<<<<<<<<<<
 * 
 *     ################
 */
  /*else*/ {
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_RMin); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1674, __pyx_L1_error)
    __pyx_v_Rmin = __pyx_t_14;
  }
  __pyx_L4:;

  /* "tofu/geom/_GG03.pyx":1678
 *     ################
 *     # Compute
 *     if Forbid:             # <<<<<<<<<<<<<<
 *         Forbid0, Forbidbis = 1, 1
 *     else:
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_Forbid)); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 1678, __pyx_L1_error)
  if (__pyx_t_12) {

    /* "tofu/geom/_GG03.pyx":1679
 *     # Compute
 *     if Forbid:
 *         Forbid0, Forbidbis = 1, 1             # <<<<<<<<<<<<<<
 *     else:
 *         Forbid0, Forbidbis = 0, 0
 */
    __pyx_t_17 = 1;
    __pyx_t_19 = 1;
    __pyx_v_Forbid0 = __pyx_t_17;
    __pyx_v_Forbidbis = __pyx_t_19;

    /* "tofu/geom/_GG03.pyx":1678
 *     ################
 *     # Compute
 *     if Forbid:             # <<<<<<<<<<<<<<
 *         Forbid0, Forbidbis = 1, 1
 *     else:
 */
    goto __pyx_L5;
  }

  /* "tofu/geom/_GG03.pyx":1681
 *         Forbid0, Forbidbis = 1, 1
 *     else:
 *         Forbid0, Forbidbis = 0, 0             # <<<<<<<<<<<<<<
 *     for ii in range(0,Nl):
 *         upscaDp = us[0,ii]*Ds[0,ii] + us[1,ii]*Ds[1,ii]
 */
  /*else*/ {
    __pyx_t_19 = 0;
    __pyx_t_17 = 0;
    __pyx_v_Forbid0 = __pyx_t_19;
    __pyx_v_Forbidbis = __pyx_t_17;
  }
  __pyx_L5:;

  /* "tofu/geom/_GG03.pyx":1682
 *     else:
 *         Forbid0, Forbidbis = 0, 0
 *     for ii in range(0,Nl):             # <<<<<<<<<<<<<<
 *         upscaDp = us[0,ii]*Ds[0,ii] + us[1,ii]*Ds[1,ii]
 *         upar2 = us[0,ii]**2 + us[1,ii]**2
 */
  __pyx_t_17 = __pyx_v_Nl;
  for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_17; __pyx_t_19+=1) {
    __pyx_v_ii = __pyx_t_19;

    /* "tofu/geom/_GG03.pyx":1683
 *         Forbid0, Forbidbis = 0, 0
 *     for ii in range(0,Nl):
 *         upscaDp = us[0,ii]*Ds[0,ii] + us[1,ii]*Ds[1,ii]             # <<<<<<<<<<<<<<
 *         upar2 = us[0,ii]**2 + us[1,ii]**2
 *         Dpar2 = Ds[0,ii]**2 + Ds[1,ii]**2
 */
    __pyx_t_20 = 0;
    __pyx_t_21 = __pyx_v_ii;
    __pyx_t_22 = 0;
    __pyx_t_23 = __pyx_v_ii;
    __pyx_t_24 = 1;
    __pyx_t_25 = __pyx_v_ii;
    __pyx_t_26 = 1;
    __pyx_t_27 = __pyx_v_ii;
    __pyx_v_upscaDp = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_20 * __pyx_v_us.strides[0]) )) + __pyx_t_21)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_22 * __pyx_v_Ds.strides[0]) )) + __pyx_t_23)) )))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_24 * __pyx_v_us.strides[0]) )) + __pyx_t_25)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_26 * __pyx_v_Ds.strides[0]) )) + __pyx_t_27)) )))));

    /* "tofu/geom/_GG03.pyx":1684
 *     for ii in range(0,Nl):
 *         upscaDp = us[0,ii]*Ds[0,ii] + us[1,ii]*Ds[1,ii]
 *         upar2 = us[0,ii]**2 + us[1,ii]**2             # <<<<<<<<<<<<<<
 *         Dpar2 = Ds[0,ii]**2 + Ds[1,ii]**2
 *         # Prepare in case Forbid is True
 */
    __pyx_t_28 = 0;
    __pyx_t_29 = __pyx_v_ii;
    __pyx_t_30 = 1;
    __pyx_t_31 = __pyx_v_ii;
    __pyx_v_upar2 = (pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_28 * __pyx_v_us.strides[0]) )) + __pyx_t_29)) ))), 2.0) + pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_30 * __pyx_v_us.strides[0]) )) + __pyx_t_31)) ))), 2.0));

    /* "tofu/geom/_GG03.pyx":1685
 *         upscaDp = us[0,ii]*Ds[0,ii] + us[1,ii]*Ds[1,ii]
 *         upar2 = us[0,ii]**2 + us[1,ii]**2
 *         Dpar2 = Ds[0,ii]**2 + Ds[1,ii]**2             # <<<<<<<<<<<<<<
 *         # Prepare in case Forbid is True
 *         if Forbid0 and not Dpar2>0:
 */
    __pyx_t_32 = 0;
    __pyx_t_33 = __pyx_v_ii;
    __pyx_t_34 = 1;
    __pyx_t_35 = __pyx_v_ii;
    __pyx_v_Dpar2 = (pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_32 * __pyx_v_Ds.strides[0]) )) + __pyx_t_33)) ))), 2.0) + pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_34 * __pyx_v_Ds.strides[0]) )) + __pyx_t_35)) ))), 2.0));

    /* "tofu/geom/_GG03.pyx":1687
 *         Dpar2 = Ds[0,ii]**2 + Ds[1,ii]**2
 *         # Prepare in case Forbid is True
 *         if Forbid0 and not Dpar2>0:             # <<<<<<<<<<<<<<
 *             Forbidbis = 0
 *         if Forbidbis:
 */
    __pyx_t_13 = (__pyx_v_Forbid0 != 0);
    if (__pyx_t_13) {
    } else {
      __pyx_t_12 = __pyx_t_13;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_13 = ((!((__pyx_v_Dpar2 > 0.0) != 0)) != 0);
    __pyx_t_12 = __pyx_t_13;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":1688
 *         # Prepare in case Forbid is True
 *         if Forbid0 and not Dpar2>0:
 *             Forbidbis = 0             # <<<<<<<<<<<<<<
 *         if Forbidbis:
 *             # Compute coordinates of the 2 points where the tangents touch the inner circle
 */
      __pyx_v_Forbidbis = 0;

      /* "tofu/geom/_GG03.pyx":1687
 *         Dpar2 = Ds[0,ii]**2 + Ds[1,ii]**2
 *         # Prepare in case Forbid is True
 *         if Forbid0 and not Dpar2>0:             # <<<<<<<<<<<<<<
 *             Forbidbis = 0
 *         if Forbidbis:
 */
    }

    /* "tofu/geom/_GG03.pyx":1689
 *         if Forbid0 and not Dpar2>0:
 *             Forbidbis = 0
 *         if Forbidbis:             # <<<<<<<<<<<<<<
 *             # Compute coordinates of the 2 points where the tangents touch the inner circle
 *             L = Csqrt(Dpar2-Rmin**2)
 */
    __pyx_t_12 = (__pyx_v_Forbidbis != 0);
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":1691
 *         if Forbidbis:
 *             # Compute coordinates of the 2 points where the tangents touch the inner circle
 *             L = Csqrt(Dpar2-Rmin**2)             # <<<<<<<<<<<<<<
 *             S1X = (Rmin**2*Ds[0,ii]+Rmin*Ds[1,ii]*L)/Dpar2
 *             S1Y = (Rmin**2*Ds[1,ii]-Rmin*Ds[0,ii]*L)/Dpar2
 */
      __pyx_v_L = sqrt((__pyx_v_Dpar2 - pow(__pyx_v_Rmin, 2.0)));

      /* "tofu/geom/_GG03.pyx":1692
 *             # Compute coordinates of the 2 points where the tangents touch the inner circle
 *             L = Csqrt(Dpar2-Rmin**2)
 *             S1X = (Rmin**2*Ds[0,ii]+Rmin*Ds[1,ii]*L)/Dpar2             # <<<<<<<<<<<<<<
 *             S1Y = (Rmin**2*Ds[1,ii]-Rmin*Ds[0,ii]*L)/Dpar2
 *             S2X = (Rmin**2*Ds[0,ii]-Rmin*Ds[1,ii]*L)/Dpar2
 */
      __pyx_t_36 = 0;
      __pyx_t_37 = __pyx_v_ii;
      __pyx_t_38 = 1;
      __pyx_t_39 = __pyx_v_ii;
      __pyx_v_S1X = (((pow(__pyx_v_Rmin, 2.0) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_36 * __pyx_v_Ds.strides[0]) )) + __pyx_t_37)) )))) + ((__pyx_v_Rmin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_38 * __pyx_v_Ds.strides[0]) )) + __pyx_t_39)) )))) * __pyx_v_L)) / __pyx_v_Dpar2);

      /* "tofu/geom/_GG03.pyx":1693
 *             L = Csqrt(Dpar2-Rmin**2)
 *             S1X = (Rmin**2*Ds[0,ii]+Rmin*Ds[1,ii]*L)/Dpar2
 *             S1Y = (Rmin**2*Ds[1,ii]-Rmin*Ds[0,ii]*L)/Dpar2             # <<<<<<<<<<<<<<
 *             S2X = (Rmin**2*Ds[0,ii]-Rmin*Ds[1,ii]*L)/Dpar2
 *             S2Y = (Rmin**2*Ds[1,ii]+Rmin*Ds[0,ii]*L)/Dpar2
 */
      __pyx_t_40 = 1;
      __pyx_t_41 = __pyx_v_ii;
      __pyx_t_42 = 0;
      __pyx_t_43 = __pyx_v_ii;
      __pyx_v_S1Y = (((pow(__pyx_v_Rmin, 2.0) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_40 * __pyx_v_Ds.strides[0]) )) + __pyx_t_41)) )))) - ((__pyx_v_Rmin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_42 * __pyx_v_Ds.strides[0]) )) + __pyx_t_43)) )))) * __pyx_v_L)) / __pyx_v_Dpar2);

      /* "tofu/geom/_GG03.pyx":1694
 *             S1X = (Rmin**2*Ds[0,ii]+Rmin*Ds[1,ii]*L)/Dpar2
 *             S1Y = (Rmin**2*Ds[1,ii]-Rmin*Ds[0,ii]*L)/Dpar2
 *             S2X = (Rmin**2*Ds[0,ii]-Rmin*Ds[1,ii]*L)/Dpar2             # <<<<<<<<<<<<<<
 *             S2Y = (Rmin**2*Ds[1,ii]+Rmin*Ds[0,ii]*L)/Dpar2
 * 
 */
      __pyx_t_44 = 0;
      __pyx_t_45 = __pyx_v_ii;
      __pyx_t_46 = 1;
      __pyx_t_47 = __pyx_v_ii;
      __pyx_v_S2X = (((pow(__pyx_v_Rmin, 2.0) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_44 * __pyx_v_Ds.strides[0]) )) + __pyx_t_45)) )))) - ((__pyx_v_Rmin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_46 * __pyx_v_Ds.strides[0]) )) + __pyx_t_47)) )))) * __pyx_v_L)) / __pyx_v_Dpar2);

      /* "tofu/geom/_GG03.pyx":1695
 *             S1Y = (Rmin**2*Ds[1,ii]-Rmin*Ds[0,ii]*L)/Dpar2
 *             S2X = (Rmin**2*Ds[0,ii]-Rmin*Ds[1,ii]*L)/Dpar2
 *             S2Y = (Rmin**2*Ds[1,ii]+Rmin*Ds[0,ii]*L)/Dpar2             # <<<<<<<<<<<<<<
 * 
 *         # Compute all solutions
 */
      __pyx_t_48 = 1;
      __pyx_t_49 = __pyx_v_ii;
      __pyx_t_50 = 0;
      __pyx_t_51 = __pyx_v_ii;
      __pyx_v_S2Y = (((pow(__pyx_v_Rmin, 2.0) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_48 * __pyx_v_Ds.strides[0]) )) + __pyx_t_49)) )))) + ((__pyx_v_Rmin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_50 * __pyx_v_Ds.strides[0]) )) + __pyx_t_51)) )))) * __pyx_v_L)) / __pyx_v_Dpar2);

      /* "tofu/geom/_GG03.pyx":1689
 *         if Forbid0 and not Dpar2>0:
 *             Forbidbis = 0
 *         if Forbidbis:             # <<<<<<<<<<<<<<
 *             # Compute coordinates of the 2 points where the tangents touch the inner circle
 *             L = Csqrt(Dpar2-Rmin**2)
 */
    }

    /* "tofu/geom/_GG03.pyx":1700
 *         # Set tolerance value for us[2,ii]
 *         # EpsUz is the tolerated DZ across 20m (max Tokamak size)
 *         Crit2 = EpsUz**2*upar2/400.             # <<<<<<<<<<<<<<
 *         kout, kin, Done = 1.e12, 1e12, 0
 *         # Case with horizontal semi-line
 */
    __pyx_v_Crit2 = ((pow(__pyx_v_EpsUz, 2.0) * __pyx_v_upar2) / 400.);

    /* "tofu/geom/_GG03.pyx":1701
 *         # EpsUz is the tolerated DZ across 20m (max Tokamak size)
 *         Crit2 = EpsUz**2*upar2/400.
 *         kout, kin, Done = 1.e12, 1e12, 0             # <<<<<<<<<<<<<<
 *         # Case with horizontal semi-line
 *         if us[2,ii]**2<Crit2:
 */
    __pyx_t_14 = 1.e12;
    __pyx_t_15 = 1e12;
    __pyx_t_52 = 0;
    __pyx_v_kout = __pyx_t_14;
    __pyx_v_kin = __pyx_t_15;
    __pyx_v_Done = __pyx_t_52;

    /* "tofu/geom/_GG03.pyx":1703
 *         kout, kin, Done = 1.e12, 1e12, 0
 *         # Case with horizontal semi-line
 *         if us[2,ii]**2<Crit2:             # <<<<<<<<<<<<<<
 *             for jj in range(0,Ns):
 *                 # Solutions exist only in the case with non-horizontal segment (i.e.: cone, not plane)
 */
    __pyx_t_53 = 2;
    __pyx_t_54 = __pyx_v_ii;
    __pyx_t_12 = ((pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_53 * __pyx_v_us.strides[0]) )) + __pyx_t_54)) ))), 2.0) < __pyx_v_Crit2) != 0);
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":1704
 *         # Case with horizontal semi-line
 *         if us[2,ii]**2<Crit2:
 *             for jj in range(0,Ns):             # <<<<<<<<<<<<<<
 *                 # Solutions exist only in the case with non-horizontal segment (i.e.: cone, not plane)
 *                 if (VPoly[1,jj+1]-VPoly[1,jj])**2>EpsVz**2:
 */
      __pyx_t_52 = __pyx_v_Ns;
      for (__pyx_t_55 = 0; __pyx_t_55 < __pyx_t_52; __pyx_t_55+=1) {
        __pyx_v_jj = __pyx_t_55;

        /* "tofu/geom/_GG03.pyx":1706
 *             for jj in range(0,Ns):
 *                 # Solutions exist only in the case with non-horizontal segment (i.e.: cone, not plane)
 *                 if (VPoly[1,jj+1]-VPoly[1,jj])**2>EpsVz**2:             # <<<<<<<<<<<<<<
 *                     q = (Ds[2,ii]-VPoly[1,jj])/(VPoly[1,jj+1]-VPoly[1,jj])
 *                     # The intersection must stand on the segment
 */
        __pyx_t_56 = 1;
        __pyx_t_57 = (__pyx_v_jj + 1);
        __pyx_t_58 = 1;
        __pyx_t_59 = __pyx_v_jj;
        __pyx_t_12 = ((pow(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_56 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_57)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_58 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_59)) )))), 2.0) > pow(__pyx_v_EpsVz, 2.0)) != 0);
        if (__pyx_t_12) {

          /* "tofu/geom/_GG03.pyx":1707
 *                 # Solutions exist only in the case with non-horizontal segment (i.e.: cone, not plane)
 *                 if (VPoly[1,jj+1]-VPoly[1,jj])**2>EpsVz**2:
 *                     q = (Ds[2,ii]-VPoly[1,jj])/(VPoly[1,jj+1]-VPoly[1,jj])             # <<<<<<<<<<<<<<
 *                     # The intersection must stand on the segment
 *                     if q>=0 and q<1:
 */
          __pyx_t_60 = 2;
          __pyx_t_61 = __pyx_v_ii;
          __pyx_t_62 = 1;
          __pyx_t_63 = __pyx_v_jj;
          __pyx_t_64 = 1;
          __pyx_t_65 = (__pyx_v_jj + 1);
          __pyx_t_66 = 1;
          __pyx_t_67 = __pyx_v_jj;
          __pyx_v_q = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_60 * __pyx_v_Ds.strides[0]) )) + __pyx_t_61)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_62 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_63)) )))) / ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_64 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_65)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_66 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_67)) )))));

          /* "tofu/geom/_GG03.pyx":1709
 *                     q = (Ds[2,ii]-VPoly[1,jj])/(VPoly[1,jj+1]-VPoly[1,jj])
 *                     # The intersection must stand on the segment
 *                     if q>=0 and q<1:             # <<<<<<<<<<<<<<
 *                         C = q**2*(VPoly[0,jj+1]-VPoly[0,jj])**2 + 2.*q*VPoly[0,jj]*(VPoly[0,jj+1]-VPoly[0,jj]) + VPoly[0,jj]**2
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)
 */
          __pyx_t_13 = ((__pyx_v_q >= 0.0) != 0);
          if (__pyx_t_13) {
          } else {
            __pyx_t_12 = __pyx_t_13;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_13 = ((__pyx_v_q < 1.0) != 0);
          __pyx_t_12 = __pyx_t_13;
          __pyx_L17_bool_binop_done:;
          if (__pyx_t_12) {

            /* "tofu/geom/_GG03.pyx":1710
 *                     # The intersection must stand on the segment
 *                     if q>=0 and q<1:
 *                         C = q**2*(VPoly[0,jj+1]-VPoly[0,jj])**2 + 2.*q*VPoly[0,jj]*(VPoly[0,jj+1]-VPoly[0,jj]) + VPoly[0,jj]**2             # <<<<<<<<<<<<<<
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)
 *                         if delta>0.:
 */
            __pyx_t_68 = 0;
            __pyx_t_69 = (__pyx_v_jj + 1);
            __pyx_t_70 = 0;
            __pyx_t_71 = __pyx_v_jj;
            __pyx_t_72 = 0;
            __pyx_t_73 = __pyx_v_jj;
            __pyx_t_74 = 0;
            __pyx_t_75 = (__pyx_v_jj + 1);
            __pyx_t_76 = 0;
            __pyx_t_77 = __pyx_v_jj;
            __pyx_t_78 = 0;
            __pyx_t_79 = __pyx_v_jj;
            __pyx_v_C = (((pow(__pyx_v_q, 2.0) * pow(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_68 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_69)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_70 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_71)) )))), 2.0)) + (((2. * __pyx_v_q) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_72 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_73)) )))) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_74 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_75)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_76 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_77)) )))))) + pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_78 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_79)) ))), 2.0));

            /* "tofu/geom/_GG03.pyx":1711
 *                     if q>=0 and q<1:
 *                         C = q**2*(VPoly[0,jj+1]-VPoly[0,jj])**2 + 2.*q*VPoly[0,jj]*(VPoly[0,jj+1]-VPoly[0,jj]) + VPoly[0,jj]**2
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)             # <<<<<<<<<<<<<<
 *                         if delta>0.:
 *                             sqd = Csqrt(delta)
 */
            __pyx_v_delta = (pow(__pyx_v_upscaDp, 2.0) - (__pyx_v_upar2 * (__pyx_v_Dpar2 - __pyx_v_C)));

            /* "tofu/geom/_GG03.pyx":1712
 *                         C = q**2*(VPoly[0,jj+1]-VPoly[0,jj])**2 + 2.*q*VPoly[0,jj]*(VPoly[0,jj+1]-VPoly[0,jj]) + VPoly[0,jj]**2
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)
 *                         if delta>0.:             # <<<<<<<<<<<<<<
 *                             sqd = Csqrt(delta)
 *                             # The intersection must be on the semi-line (i.e.: k>=0)
 */
            __pyx_t_12 = ((__pyx_v_delta > 0.) != 0);
            if (__pyx_t_12) {

              /* "tofu/geom/_GG03.pyx":1713
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)
 *                         if delta>0.:
 *                             sqd = Csqrt(delta)             # <<<<<<<<<<<<<<
 *                             # The intersection must be on the semi-line (i.e.: k>=0)
 *                             # First solution
 */
              __pyx_v_sqd = sqrt(__pyx_v_delta);

              /* "tofu/geom/_GG03.pyx":1716
 *                             # The intersection must be on the semi-line (i.e.: k>=0)
 *                             # First solution
 *                             if -upscaDp - sqd >=0:             # <<<<<<<<<<<<<<
 *                                 k = (-upscaDp - sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 */
              __pyx_t_12 = ((((-__pyx_v_upscaDp) - __pyx_v_sqd) >= 0.0) != 0);
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1717
 *                             # First solution
 *                             if -upscaDp - sqd >=0:
 *                                 k = (-upscaDp - sqd)/upar2             # <<<<<<<<<<<<<<
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:
 */
                __pyx_v_k = (((-__pyx_v_upscaDp) - __pyx_v_sqd) / __pyx_v_upar2);

                /* "tofu/geom/_GG03.pyx":1718
 *                             if -upscaDp - sqd >=0:
 *                                 k = (-upscaDp - sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]             # <<<<<<<<<<<<<<
 *                                 if Forbidbis:
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 */
                __pyx_t_80 = 0;
                __pyx_t_81 = __pyx_v_ii;
                __pyx_t_82 = 0;
                __pyx_t_83 = __pyx_v_ii;
                __pyx_t_15 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_80 * __pyx_v_Ds.strides[0]) )) + __pyx_t_81)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_82 * __pyx_v_us.strides[0]) )) + __pyx_t_83)) )))));
                __pyx_t_84 = 1;
                __pyx_t_85 = __pyx_v_ii;
                __pyx_t_86 = 1;
                __pyx_t_87 = __pyx_v_ii;
                __pyx_t_14 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_84 * __pyx_v_Ds.strides[0]) )) + __pyx_t_85)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_86 * __pyx_v_us.strides[0]) )) + __pyx_t_87)) )))));
                __pyx_v_sol0 = __pyx_t_15;
                __pyx_v_sol1 = __pyx_t_14;

                /* "tofu/geom/_GG03.pyx":1719
 *                                 k = (-upscaDp - sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:             # <<<<<<<<<<<<<<
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
                __pyx_t_12 = (__pyx_v_Forbidbis != 0);
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1720
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]             # <<<<<<<<<<<<<<
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 */
                  __pyx_t_88 = 0;
                  __pyx_t_89 = __pyx_v_ii;
                  __pyx_t_90 = 1;
                  __pyx_t_91 = __pyx_v_ii;
                  __pyx_v_sca0 = (((__pyx_v_sol0 - __pyx_v_S1X) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_88 * __pyx_v_Ds.strides[0]) )) + __pyx_t_89)) )))) + ((__pyx_v_sol1 - __pyx_v_S1Y) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_90 * __pyx_v_Ds.strides[0]) )) + __pyx_t_91)) )))));

                  /* "tofu/geom/_GG03.pyx":1721
 *                                 if Forbidbis:
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y             # <<<<<<<<<<<<<<
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 */
                  __pyx_v_sca1 = (((__pyx_v_sol0 - __pyx_v_S1X) * __pyx_v_S1X) + ((__pyx_v_sol1 - __pyx_v_S1Y) * __pyx_v_S1Y));

                  /* "tofu/geom/_GG03.pyx":1722
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y             # <<<<<<<<<<<<<<
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 *                                     # Get the normalized perpendicular vector at intersection
 */
                  __pyx_v_sca2 = (((__pyx_v_sol0 - __pyx_v_S2X) * __pyx_v_S2X) + ((__pyx_v_sol1 - __pyx_v_S2Y) * __pyx_v_S2Y));

                  /* "tofu/geom/_GG03.pyx":1719
 *                                 k = (-upscaDp - sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:             # <<<<<<<<<<<<<<
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
                }

                /* "tofu/geom/_GG03.pyx":1723
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)
 */
                __pyx_t_13 = ((!(__pyx_v_Forbidbis != 0)) != 0);
                if (!__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L23_bool_binop_done;
                }
                __pyx_t_13 = (__pyx_v_Forbidbis != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L23_bool_binop_done;
                }
                __pyx_t_92 = ((__pyx_v_sca0 < 0.0) != 0);
                if (__pyx_t_92) {
                } else {
                  __pyx_t_13 = __pyx_t_92;
                  goto __pyx_L26_bool_binop_done;
                }
                __pyx_t_92 = ((__pyx_v_sca1 < 0.0) != 0);
                if (__pyx_t_92) {
                } else {
                  __pyx_t_13 = __pyx_t_92;
                  goto __pyx_L26_bool_binop_done;
                }
                __pyx_t_92 = ((__pyx_v_sca2 < 0.0) != 0);
                __pyx_t_13 = __pyx_t_92;
                __pyx_L26_bool_binop_done:;
                __pyx_t_92 = ((!__pyx_t_13) != 0);
                __pyx_t_12 = __pyx_t_92;
                __pyx_L23_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1725
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)             # <<<<<<<<<<<<<<
 *                                     # Check sol inside the Lim
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 */
                  __pyx_v_phi = atan2(__pyx_v_sol1, __pyx_v_sol0);

                  /* "tofu/geom/_GG03.pyx":1727
 *                                     phi = Catan2(sol1,sol0)
 *                                     # Check sol inside the Lim
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                  __pyx_t_92 = (__pyx_v_Lim == Py_None);
                  __pyx_t_13 = (__pyx_t_92 != 0);
                  if (!__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L30_bool_binop_done;
                  }
                  __pyx_t_13 = (__pyx_v_Lim != Py_None);
                  __pyx_t_92 = (__pyx_t_13 != 0);
                  if (__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L30_bool_binop_done;
                  }
                  __pyx_t_92 = ((__pyx_v_L0 < __pyx_v_L1) != 0);
                  if (!__pyx_t_92) {
                    goto __pyx_L33_next_or;
                  } else {
                  }
                  __pyx_t_92 = ((__pyx_v_L0 <= __pyx_v_phi) != 0);
                  if (!__pyx_t_92) {
                    goto __pyx_L33_next_or;
                  } else {
                  }
                  __pyx_t_92 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                  if (!__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L30_bool_binop_done;
                  }
                  __pyx_L33_next_or:;
                  __pyx_t_92 = ((__pyx_v_L0 > __pyx_v_L1) != 0);
                  if (__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L30_bool_binop_done;
                  }
                  __pyx_t_92 = ((__pyx_v_phi >= __pyx_v_L0) != 0);
                  if (!__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L30_bool_binop_done;
                  }
                  __pyx_t_92 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                  __pyx_t_12 = __pyx_t_92;
                  __pyx_L30_bool_binop_done:;
                  if (__pyx_t_12) {

                    /* "tofu/geom/_GG03.pyx":1729
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]             # <<<<<<<<<<<<<<
 *                                         if sca<=0 and k<kout:
 *                                             kout = k
 */
                    __pyx_t_93 = 0;
                    __pyx_t_94 = __pyx_v_jj;
                    __pyx_t_95 = 0;
                    __pyx_t_96 = __pyx_v_ii;
                    __pyx_t_97 = 0;
                    __pyx_t_98 = __pyx_v_jj;
                    __pyx_t_99 = 1;
                    __pyx_t_100 = __pyx_v_ii;
                    __pyx_t_101 = 1;
                    __pyx_t_102 = __pyx_v_jj;
                    __pyx_t_103 = 2;
                    __pyx_t_104 = __pyx_v_ii;
                    __pyx_v_sca = ((((cos(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_93 * __pyx_v_vIn.strides[0]) )) + __pyx_t_94)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_95 * __pyx_v_us.strides[0]) )) + __pyx_t_96)) )))) + ((sin(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_97 * __pyx_v_vIn.strides[0]) )) + __pyx_t_98)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_99 * __pyx_v_us.strides[0]) )) + __pyx_t_100)) ))))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_101 * __pyx_v_vIn.strides[0]) )) + __pyx_t_102)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_103 * __pyx_v_us.strides[0]) )) + __pyx_t_104)) )))));

                    /* "tofu/geom/_GG03.pyx":1730
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                             kout = k
 *                                             indout = jj
 */
                    __pyx_t_92 = ((__pyx_v_sca <= 0.0) != 0);
                    if (__pyx_t_92) {
                    } else {
                      __pyx_t_12 = __pyx_t_92;
                      goto __pyx_L39_bool_binop_done;
                    }
                    __pyx_t_92 = ((__pyx_v_k < __pyx_v_kout) != 0);
                    __pyx_t_12 = __pyx_t_92;
                    __pyx_L39_bool_binop_done:;
                    if (__pyx_t_12) {

                      /* "tofu/geom/_GG03.pyx":1731
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                         if sca<=0 and k<kout:
 *                                             kout = k             # <<<<<<<<<<<<<<
 *                                             indout = jj
 *                                             Done = 1
 */
                      __pyx_v_kout = __pyx_v_k;

                      /* "tofu/geom/_GG03.pyx":1732
 *                                         if sca<=0 and k<kout:
 *                                             kout = k
 *                                             indout = jj             # <<<<<<<<<<<<<<
 *                                             Done = 1
 *                                             #print(1, k)
 */
                      __pyx_v_indout = __pyx_v_jj;

                      /* "tofu/geom/_GG03.pyx":1733
 *                                             kout = k
 *                                             indout = jj
 *                                             Done = 1             # <<<<<<<<<<<<<<
 *                                             #print(1, k)
 *                                         elif sca>=0 and k<min(kin,kout):
 */
                      __pyx_v_Done = 1;

                      /* "tofu/geom/_GG03.pyx":1730
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                             kout = k
 *                                             indout = jj
 */
                      goto __pyx_L38;
                    }

                    /* "tofu/geom/_GG03.pyx":1735
 *                                             Done = 1
 *                                             #print(1, k)
 *                                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                             kin = k
 *                                             indin = jj
 */
                    __pyx_t_92 = ((__pyx_v_sca >= 0.0) != 0);
                    if (__pyx_t_92) {
                    } else {
                      __pyx_t_12 = __pyx_t_92;
                      goto __pyx_L41_bool_binop_done;
                    }
                    __pyx_t_14 = __pyx_v_kout;
                    __pyx_t_15 = __pyx_v_kin;
                    if (((__pyx_t_14 < __pyx_t_15) != 0)) {
                      __pyx_t_105 = __pyx_t_14;
                    } else {
                      __pyx_t_105 = __pyx_t_15;
                    }
                    __pyx_t_92 = ((__pyx_v_k < __pyx_t_105) != 0);
                    __pyx_t_12 = __pyx_t_92;
                    __pyx_L41_bool_binop_done:;
                    if (__pyx_t_12) {

                      /* "tofu/geom/_GG03.pyx":1736
 *                                             #print(1, k)
 *                                         elif sca>=0 and k<min(kin,kout):
 *                                             kin = k             # <<<<<<<<<<<<<<
 *                                             indin = jj
 *                                             #print(2, k)
 */
                      __pyx_v_kin = __pyx_v_k;

                      /* "tofu/geom/_GG03.pyx":1737
 *                                         elif sca>=0 and k<min(kin,kout):
 *                                             kin = k
 *                                             indin = jj             # <<<<<<<<<<<<<<
 *                                             #print(2, k)
 * 
 */
                      __pyx_v_indin = __pyx_v_jj;

                      /* "tofu/geom/_GG03.pyx":1735
 *                                             Done = 1
 *                                             #print(1, k)
 *                                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                             kin = k
 *                                             indin = jj
 */
                    }
                    __pyx_L38:;

                    /* "tofu/geom/_GG03.pyx":1727
 *                                     phi = Catan2(sol1,sol0)
 *                                     # Check sol inside the Lim
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                  }

                  /* "tofu/geom/_GG03.pyx":1723
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)
 */
                }

                /* "tofu/geom/_GG03.pyx":1716
 *                             # The intersection must be on the semi-line (i.e.: k>=0)
 *                             # First solution
 *                             if -upscaDp - sqd >=0:             # <<<<<<<<<<<<<<
 *                                 k = (-upscaDp - sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 */
              }

              /* "tofu/geom/_GG03.pyx":1741
 * 
 *                             # Second solution
 *                             if -upscaDp + sqd >=0:             # <<<<<<<<<<<<<<
 *                                 k = (-upscaDp + sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 */
              __pyx_t_12 = ((((-__pyx_v_upscaDp) + __pyx_v_sqd) >= 0.0) != 0);
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1742
 *                             # Second solution
 *                             if -upscaDp + sqd >=0:
 *                                 k = (-upscaDp + sqd)/upar2             # <<<<<<<<<<<<<<
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:
 */
                __pyx_v_k = (((-__pyx_v_upscaDp) + __pyx_v_sqd) / __pyx_v_upar2);

                /* "tofu/geom/_GG03.pyx":1743
 *                             if -upscaDp + sqd >=0:
 *                                 k = (-upscaDp + sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]             # <<<<<<<<<<<<<<
 *                                 if Forbidbis:
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 */
                __pyx_t_106 = 0;
                __pyx_t_107 = __pyx_v_ii;
                __pyx_t_108 = 0;
                __pyx_t_109 = __pyx_v_ii;
                __pyx_t_105 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_106 * __pyx_v_Ds.strides[0]) )) + __pyx_t_107)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_108 * __pyx_v_us.strides[0]) )) + __pyx_t_109)) )))));
                __pyx_t_110 = 1;
                __pyx_t_111 = __pyx_v_ii;
                __pyx_t_112 = 1;
                __pyx_t_113 = __pyx_v_ii;
                __pyx_t_14 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_110 * __pyx_v_Ds.strides[0]) )) + __pyx_t_111)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_112 * __pyx_v_us.strides[0]) )) + __pyx_t_113)) )))));
                __pyx_v_sol0 = __pyx_t_105;
                __pyx_v_sol1 = __pyx_t_14;

                /* "tofu/geom/_GG03.pyx":1744
 *                                 k = (-upscaDp + sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:             # <<<<<<<<<<<<<<
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
                __pyx_t_12 = (__pyx_v_Forbidbis != 0);
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1745
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]             # <<<<<<<<<<<<<<
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 */
                  __pyx_t_114 = 0;
                  __pyx_t_115 = __pyx_v_ii;
                  __pyx_t_116 = 1;
                  __pyx_t_117 = __pyx_v_ii;
                  __pyx_v_sca0 = (((__pyx_v_sol0 - __pyx_v_S1X) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_114 * __pyx_v_Ds.strides[0]) )) + __pyx_t_115)) )))) + ((__pyx_v_sol1 - __pyx_v_S1Y) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_116 * __pyx_v_Ds.strides[0]) )) + __pyx_t_117)) )))));

                  /* "tofu/geom/_GG03.pyx":1746
 *                                 if Forbidbis:
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y             # <<<<<<<<<<<<<<
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 */
                  __pyx_v_sca1 = (((__pyx_v_sol0 - __pyx_v_S1X) * __pyx_v_S1X) + ((__pyx_v_sol1 - __pyx_v_S1Y) * __pyx_v_S1Y));

                  /* "tofu/geom/_GG03.pyx":1747
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y             # <<<<<<<<<<<<<<
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 *                                     # Get the normalized perpendicular vector at intersection
 */
                  __pyx_v_sca2 = (((__pyx_v_sol0 - __pyx_v_S2X) * __pyx_v_S2X) + ((__pyx_v_sol1 - __pyx_v_S2Y) * __pyx_v_S2Y));

                  /* "tofu/geom/_GG03.pyx":1744
 *                                 k = (-upscaDp + sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                                 if Forbidbis:             # <<<<<<<<<<<<<<
 *                                     sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
                }

                /* "tofu/geom/_GG03.pyx":1748
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)
 */
                __pyx_t_92 = ((!(__pyx_v_Forbidbis != 0)) != 0);
                if (!__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L46_bool_binop_done;
                }
                __pyx_t_92 = (__pyx_v_Forbidbis != 0);
                if (__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L46_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_sca0 < 0.0) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_92 = __pyx_t_13;
                  goto __pyx_L49_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_sca1 < 0.0) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_92 = __pyx_t_13;
                  goto __pyx_L49_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_sca2 < 0.0) != 0);
                __pyx_t_92 = __pyx_t_13;
                __pyx_L49_bool_binop_done:;
                __pyx_t_13 = ((!__pyx_t_92) != 0);
                __pyx_t_12 = __pyx_t_13;
                __pyx_L46_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1750
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)             # <<<<<<<<<<<<<<
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                         # Get the scalar product to determine entry or exit point
 */
                  __pyx_v_phi = atan2(__pyx_v_sol1, __pyx_v_sol0);

                  /* "tofu/geom/_GG03.pyx":1751
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                  __pyx_t_13 = (__pyx_v_Lim == Py_None);
                  __pyx_t_92 = (__pyx_t_13 != 0);
                  if (!__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L53_bool_binop_done;
                  }
                  __pyx_t_92 = (__pyx_v_Lim != Py_None);
                  __pyx_t_13 = (__pyx_t_92 != 0);
                  if (__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L53_bool_binop_done;
                  }
                  __pyx_t_13 = ((__pyx_v_L0 < __pyx_v_L1) != 0);
                  if (!__pyx_t_13) {
                    goto __pyx_L56_next_or;
                  } else {
                  }
                  __pyx_t_13 = ((__pyx_v_L0 <= __pyx_v_phi) != 0);
                  if (!__pyx_t_13) {
                    goto __pyx_L56_next_or;
                  } else {
                  }
                  __pyx_t_13 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                  if (!__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L53_bool_binop_done;
                  }
                  __pyx_L56_next_or:;
                  __pyx_t_13 = ((__pyx_v_L0 > __pyx_v_L1) != 0);
                  if (__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L53_bool_binop_done;
                  }
                  __pyx_t_13 = ((__pyx_v_phi >= __pyx_v_L0) != 0);
                  if (!__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L53_bool_binop_done;
                  }
                  __pyx_t_13 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                  __pyx_t_12 = __pyx_t_13;
                  __pyx_L53_bool_binop_done:;
                  if (__pyx_t_12) {

                    /* "tofu/geom/_GG03.pyx":1753
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]             # <<<<<<<<<<<<<<
 *                                         if sca<=0 and k<kout:
 *                                             kout = k
 */
                    __pyx_t_118 = 0;
                    __pyx_t_119 = __pyx_v_jj;
                    __pyx_t_120 = 0;
                    __pyx_t_121 = __pyx_v_ii;
                    __pyx_t_122 = 0;
                    __pyx_t_123 = __pyx_v_jj;
                    __pyx_t_124 = 1;
                    __pyx_t_125 = __pyx_v_ii;
                    __pyx_t_126 = 1;
                    __pyx_t_127 = __pyx_v_jj;
                    __pyx_t_128 = 2;
                    __pyx_t_129 = __pyx_v_ii;
                    __pyx_v_sca = ((((cos(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_118 * __pyx_v_vIn.strides[0]) )) + __pyx_t_119)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_120 * __pyx_v_us.strides[0]) )) + __pyx_t_121)) )))) + ((sin(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_122 * __pyx_v_vIn.strides[0]) )) + __pyx_t_123)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_124 * __pyx_v_us.strides[0]) )) + __pyx_t_125)) ))))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_126 * __pyx_v_vIn.strides[0]) )) + __pyx_t_127)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_128 * __pyx_v_us.strides[0]) )) + __pyx_t_129)) )))));

                    /* "tofu/geom/_GG03.pyx":1754
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                             kout = k
 *                                             indout = jj
 */
                    __pyx_t_13 = ((__pyx_v_sca <= 0.0) != 0);
                    if (__pyx_t_13) {
                    } else {
                      __pyx_t_12 = __pyx_t_13;
                      goto __pyx_L62_bool_binop_done;
                    }
                    __pyx_t_13 = ((__pyx_v_k < __pyx_v_kout) != 0);
                    __pyx_t_12 = __pyx_t_13;
                    __pyx_L62_bool_binop_done:;
                    if (__pyx_t_12) {

                      /* "tofu/geom/_GG03.pyx":1755
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                         if sca<=0 and k<kout:
 *                                             kout = k             # <<<<<<<<<<<<<<
 *                                             indout = jj
 *                                             Done = 1
 */
                      __pyx_v_kout = __pyx_v_k;

                      /* "tofu/geom/_GG03.pyx":1756
 *                                         if sca<=0 and k<kout:
 *                                             kout = k
 *                                             indout = jj             # <<<<<<<<<<<<<<
 *                                             Done = 1
 *                                             #print(3, k)
 */
                      __pyx_v_indout = __pyx_v_jj;

                      /* "tofu/geom/_GG03.pyx":1757
 *                                             kout = k
 *                                             indout = jj
 *                                             Done = 1             # <<<<<<<<<<<<<<
 *                                             #print(3, k)
 *                                         elif sca>=0 and k<min(kin,kout):
 */
                      __pyx_v_Done = 1;

                      /* "tofu/geom/_GG03.pyx":1754
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                             kout = k
 *                                             indout = jj
 */
                      goto __pyx_L61;
                    }

                    /* "tofu/geom/_GG03.pyx":1759
 *                                             Done = 1
 *                                             #print(3, k)
 *                                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                             kin = k
 *                                             indin = jj
 */
                    __pyx_t_13 = ((__pyx_v_sca >= 0.0) != 0);
                    if (__pyx_t_13) {
                    } else {
                      __pyx_t_12 = __pyx_t_13;
                      goto __pyx_L64_bool_binop_done;
                    }
                    __pyx_t_14 = __pyx_v_kout;
                    __pyx_t_105 = __pyx_v_kin;
                    if (((__pyx_t_14 < __pyx_t_105) != 0)) {
                      __pyx_t_15 = __pyx_t_14;
                    } else {
                      __pyx_t_15 = __pyx_t_105;
                    }
                    __pyx_t_13 = ((__pyx_v_k < __pyx_t_15) != 0);
                    __pyx_t_12 = __pyx_t_13;
                    __pyx_L64_bool_binop_done:;
                    if (__pyx_t_12) {

                      /* "tofu/geom/_GG03.pyx":1760
 *                                             #print(3, k)
 *                                         elif sca>=0 and k<min(kin,kout):
 *                                             kin = k             # <<<<<<<<<<<<<<
 *                                             indin = jj
 *                                             #print(4, k)
 */
                      __pyx_v_kin = __pyx_v_k;

                      /* "tofu/geom/_GG03.pyx":1761
 *                                         elif sca>=0 and k<min(kin,kout):
 *                                             kin = k
 *                                             indin = jj             # <<<<<<<<<<<<<<
 *                                             #print(4, k)
 * 
 */
                      __pyx_v_indin = __pyx_v_jj;

                      /* "tofu/geom/_GG03.pyx":1759
 *                                             Done = 1
 *                                             #print(3, k)
 *                                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                             kin = k
 *                                             indin = jj
 */
                    }
                    __pyx_L61:;

                    /* "tofu/geom/_GG03.pyx":1751
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)
 *                                     if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                         # Get the scalar product to determine entry or exit point
 *                                         sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                  }

                  /* "tofu/geom/_GG03.pyx":1748
 *                                     sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                     sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                     # Get the normalized perpendicular vector at intersection
 *                                     phi = Catan2(sol1,sol0)
 */
                }

                /* "tofu/geom/_GG03.pyx":1741
 * 
 *                             # Second solution
 *                             if -upscaDp + sqd >=0:             # <<<<<<<<<<<<<<
 *                                 k = (-upscaDp + sqd)/upar2
 *                                 sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 */
              }

              /* "tofu/geom/_GG03.pyx":1712
 *                         C = q**2*(VPoly[0,jj+1]-VPoly[0,jj])**2 + 2.*q*VPoly[0,jj]*(VPoly[0,jj+1]-VPoly[0,jj]) + VPoly[0,jj]**2
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)
 *                         if delta>0.:             # <<<<<<<<<<<<<<
 *                             sqd = Csqrt(delta)
 *                             # The intersection must be on the semi-line (i.e.: k>=0)
 */
            }

            /* "tofu/geom/_GG03.pyx":1709
 *                     q = (Ds[2,ii]-VPoly[1,jj])/(VPoly[1,jj+1]-VPoly[1,jj])
 *                     # The intersection must stand on the segment
 *                     if q>=0 and q<1:             # <<<<<<<<<<<<<<
 *                         C = q**2*(VPoly[0,jj+1]-VPoly[0,jj])**2 + 2.*q*VPoly[0,jj]*(VPoly[0,jj+1]-VPoly[0,jj]) + VPoly[0,jj]**2
 *                         delta = upscaDp**2 - upar2*(Dpar2-C)
 */
          }

          /* "tofu/geom/_GG03.pyx":1706
 *             for jj in range(0,Ns):
 *                 # Solutions exist only in the case with non-horizontal segment (i.e.: cone, not plane)
 *                 if (VPoly[1,jj+1]-VPoly[1,jj])**2>EpsVz**2:             # <<<<<<<<<<<<<<
 *                     q = (Ds[2,ii]-VPoly[1,jj])/(VPoly[1,jj+1]-VPoly[1,jj])
 *                     # The intersection must stand on the segment
 */
        }
      }

      /* "tofu/geom/_GG03.pyx":1703
 *         kout, kin, Done = 1.e12, 1e12, 0
 *         # Case with horizontal semi-line
 *         if us[2,ii]**2<Crit2:             # <<<<<<<<<<<<<<
 *             for jj in range(0,Ns):
 *                 # Solutions exist only in the case with non-horizontal segment (i.e.: cone, not plane)
 */
      goto __pyx_L12;
    }

    /* "tofu/geom/_GG03.pyx":1766
 *         # More general non-horizontal semi-line case
 *         else:
 *             for jj in range(Ns):             # <<<<<<<<<<<<<<
 *                 v0, v1 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]
 *                 A = v0**2 - upar2*(v1/us[2,ii])**2
 */
    /*else*/ {
      __pyx_t_52 = __pyx_v_Ns;
      for (__pyx_t_55 = 0; __pyx_t_55 < __pyx_t_52; __pyx_t_55+=1) {
        __pyx_v_jj = __pyx_t_55;

        /* "tofu/geom/_GG03.pyx":1767
 *         else:
 *             for jj in range(Ns):
 *                 v0, v1 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]             # <<<<<<<<<<<<<<
 *                 A = v0**2 - upar2*(v1/us[2,ii])**2
 *                 B = VPoly[0,jj]*v0 + v1*(Ds[2,ii]-VPoly[1,jj])*upar2/us[2,ii]**2 - upscaDp*v1/us[2,ii]
 */
        __pyx_t_130 = 0;
        __pyx_t_131 = (__pyx_v_jj + 1);
        __pyx_t_132 = 0;
        __pyx_t_133 = __pyx_v_jj;
        __pyx_t_15 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_130 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_131)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_132 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_133)) ))));
        __pyx_t_134 = 1;
        __pyx_t_135 = (__pyx_v_jj + 1);
        __pyx_t_136 = 1;
        __pyx_t_137 = __pyx_v_jj;
        __pyx_t_14 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_134 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_135)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_136 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_137)) ))));
        __pyx_v_v0 = __pyx_t_15;
        __pyx_v_v1 = __pyx_t_14;

        /* "tofu/geom/_GG03.pyx":1768
 *             for jj in range(Ns):
 *                 v0, v1 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]
 *                 A = v0**2 - upar2*(v1/us[2,ii])**2             # <<<<<<<<<<<<<<
 *                 B = VPoly[0,jj]*v0 + v1*(Ds[2,ii]-VPoly[1,jj])*upar2/us[2,ii]**2 - upscaDp*v1/us[2,ii]
 *                 C = -upar2*(Ds[2,ii]-VPoly[1,jj])**2/us[2,ii]**2 + 2.*upscaDp*(Ds[2,ii]-VPoly[1,jj])/us[2,ii] - Dpar2 + VPoly[0,jj]**2
 */
        __pyx_t_138 = 2;
        __pyx_t_139 = __pyx_v_ii;
        __pyx_v_A = (pow(__pyx_v_v0, 2.0) - (__pyx_v_upar2 * pow((__pyx_v_v1 / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_138 * __pyx_v_us.strides[0]) )) + __pyx_t_139)) )))), 2.0)));

        /* "tofu/geom/_GG03.pyx":1769
 *                 v0, v1 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]
 *                 A = v0**2 - upar2*(v1/us[2,ii])**2
 *                 B = VPoly[0,jj]*v0 + v1*(Ds[2,ii]-VPoly[1,jj])*upar2/us[2,ii]**2 - upscaDp*v1/us[2,ii]             # <<<<<<<<<<<<<<
 *                 C = -upar2*(Ds[2,ii]-VPoly[1,jj])**2/us[2,ii]**2 + 2.*upscaDp*(Ds[2,ii]-VPoly[1,jj])/us[2,ii] - Dpar2 + VPoly[0,jj]**2
 * 
 */
        __pyx_t_140 = 0;
        __pyx_t_141 = __pyx_v_jj;
        __pyx_t_142 = 2;
        __pyx_t_143 = __pyx_v_ii;
        __pyx_t_144 = 1;
        __pyx_t_145 = __pyx_v_jj;
        __pyx_t_146 = 2;
        __pyx_t_147 = __pyx_v_ii;
        __pyx_t_148 = 2;
        __pyx_t_149 = __pyx_v_ii;
        __pyx_v_B = ((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_140 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_141)) ))) * __pyx_v_v0) + (((__pyx_v_v1 * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_142 * __pyx_v_Ds.strides[0]) )) + __pyx_t_143)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_144 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_145)) ))))) * __pyx_v_upar2) / pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_146 * __pyx_v_us.strides[0]) )) + __pyx_t_147)) ))), 2.0))) - ((__pyx_v_upscaDp * __pyx_v_v1) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_148 * __pyx_v_us.strides[0]) )) + __pyx_t_149)) )))));

        /* "tofu/geom/_GG03.pyx":1770
 *                 A = v0**2 - upar2*(v1/us[2,ii])**2
 *                 B = VPoly[0,jj]*v0 + v1*(Ds[2,ii]-VPoly[1,jj])*upar2/us[2,ii]**2 - upscaDp*v1/us[2,ii]
 *                 C = -upar2*(Ds[2,ii]-VPoly[1,jj])**2/us[2,ii]**2 + 2.*upscaDp*(Ds[2,ii]-VPoly[1,jj])/us[2,ii] - Dpar2 + VPoly[0,jj]**2             # <<<<<<<<<<<<<<
 * 
 *                 if A**2<EpsA**2 and B**2>EpsB**2:
 */
        __pyx_t_150 = 2;
        __pyx_t_151 = __pyx_v_ii;
        __pyx_t_152 = 1;
        __pyx_t_153 = __pyx_v_jj;
        __pyx_t_154 = 2;
        __pyx_t_155 = __pyx_v_ii;
        __pyx_t_156 = 2;
        __pyx_t_157 = __pyx_v_ii;
        __pyx_t_158 = 1;
        __pyx_t_159 = __pyx_v_jj;
        __pyx_t_160 = 2;
        __pyx_t_161 = __pyx_v_ii;
        __pyx_t_162 = 0;
        __pyx_t_163 = __pyx_v_jj;
        __pyx_v_C = ((((((-__pyx_v_upar2) * pow(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_150 * __pyx_v_Ds.strides[0]) )) + __pyx_t_151)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_152 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_153)) )))), 2.0)) / pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_154 * __pyx_v_us.strides[0]) )) + __pyx_t_155)) ))), 2.0)) + (((2. * __pyx_v_upscaDp) * ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_156 * __pyx_v_Ds.strides[0]) )) + __pyx_t_157)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_158 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_159)) ))))) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_160 * __pyx_v_us.strides[0]) )) + __pyx_t_161)) ))))) - __pyx_v_Dpar2) + pow((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_162 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_163)) ))), 2.0));

        /* "tofu/geom/_GG03.pyx":1772
 *                 C = -upar2*(Ds[2,ii]-VPoly[1,jj])**2/us[2,ii]**2 + 2.*upscaDp*(Ds[2,ii]-VPoly[1,jj])/us[2,ii] - Dpar2 + VPoly[0,jj]**2
 * 
 *                 if A**2<EpsA**2 and B**2>EpsB**2:             # <<<<<<<<<<<<<<
 *                     q = -C/(2.*B)
 *                     if q>=0. and q<1.:
 */
        __pyx_t_13 = ((pow(__pyx_v_A, 2.0) < pow(__pyx_v_EpsA, 2.0)) != 0);
        if (__pyx_t_13) {
        } else {
          __pyx_t_12 = __pyx_t_13;
          goto __pyx_L69_bool_binop_done;
        }
        __pyx_t_13 = ((pow(__pyx_v_B, 2.0) > pow(__pyx_v_EpsB, 2.0)) != 0);
        __pyx_t_12 = __pyx_t_13;
        __pyx_L69_bool_binop_done:;
        if (__pyx_t_12) {

          /* "tofu/geom/_GG03.pyx":1773
 * 
 *                 if A**2<EpsA**2 and B**2>EpsB**2:
 *                     q = -C/(2.*B)             # <<<<<<<<<<<<<<
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 */
          __pyx_v_q = ((-__pyx_v_C) / (2. * __pyx_v_B));

          /* "tofu/geom/_GG03.pyx":1774
 *                 if A**2<EpsA**2 and B**2>EpsB**2:
 *                     q = -C/(2.*B)
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0:
 */
          __pyx_t_13 = ((__pyx_v_q >= 0.) != 0);
          if (__pyx_t_13) {
          } else {
            __pyx_t_12 = __pyx_t_13;
            goto __pyx_L72_bool_binop_done;
          }
          __pyx_t_13 = ((__pyx_v_q < 1.) != 0);
          __pyx_t_12 = __pyx_t_13;
          __pyx_L72_bool_binop_done:;
          if (__pyx_t_12) {

            /* "tofu/geom/_GG03.pyx":1775
 *                     q = -C/(2.*B)
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]             # <<<<<<<<<<<<<<
 *                         if k>=0:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 */
            __pyx_t_164 = 2;
            __pyx_t_165 = __pyx_v_ii;
            __pyx_t_166 = 1;
            __pyx_t_167 = __pyx_v_jj;
            __pyx_t_168 = 2;
            __pyx_t_169 = __pyx_v_ii;
            __pyx_v_k = (((__pyx_v_q * __pyx_v_v1) - ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_164 * __pyx_v_Ds.strides[0]) )) + __pyx_t_165)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_166 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_167)) ))))) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_168 * __pyx_v_us.strides[0]) )) + __pyx_t_169)) ))));

            /* "tofu/geom/_GG03.pyx":1776
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0:             # <<<<<<<<<<<<<<
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 */
            __pyx_t_12 = ((__pyx_v_k >= 0.0) != 0);
            if (__pyx_t_12) {

              /* "tofu/geom/_GG03.pyx":1777
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]             # <<<<<<<<<<<<<<
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 */
              __pyx_t_170 = 0;
              __pyx_t_171 = __pyx_v_ii;
              __pyx_t_172 = 0;
              __pyx_t_173 = __pyx_v_ii;
              __pyx_t_14 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_170 * __pyx_v_Ds.strides[0]) )) + __pyx_t_171)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_172 * __pyx_v_us.strides[0]) )) + __pyx_t_173)) )))));
              __pyx_t_174 = 1;
              __pyx_t_175 = __pyx_v_ii;
              __pyx_t_176 = 1;
              __pyx_t_177 = __pyx_v_ii;
              __pyx_t_15 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_174 * __pyx_v_Ds.strides[0]) )) + __pyx_t_175)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_176 * __pyx_v_us.strides[0]) )) + __pyx_t_177)) )))));
              __pyx_v_sol0 = __pyx_t_14;
              __pyx_v_sol1 = __pyx_t_15;

              /* "tofu/geom/_GG03.pyx":1778
 *                         if k>=0:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:             # <<<<<<<<<<<<<<
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
              __pyx_t_12 = (__pyx_v_Forbidbis != 0);
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1779
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]             # <<<<<<<<<<<<<<
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 */
                __pyx_t_178 = 0;
                __pyx_t_179 = __pyx_v_ii;
                __pyx_t_180 = 1;
                __pyx_t_181 = __pyx_v_ii;
                __pyx_v_sca0 = (((__pyx_v_sol0 - __pyx_v_S1X) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_178 * __pyx_v_Ds.strides[0]) )) + __pyx_t_179)) )))) + ((__pyx_v_sol1 - __pyx_v_S1Y) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_180 * __pyx_v_Ds.strides[0]) )) + __pyx_t_181)) )))));

                /* "tofu/geom/_GG03.pyx":1780
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y             # <<<<<<<<<<<<<<
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 1, k, kout, sca0, sca1, sca2
 */
                __pyx_v_sca1 = (((__pyx_v_sol0 - __pyx_v_S1X) * __pyx_v_S1X) + ((__pyx_v_sol1 - __pyx_v_S1Y) * __pyx_v_S1Y));

                /* "tofu/geom/_GG03.pyx":1781
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y             # <<<<<<<<<<<<<<
 *                                 #print 1, k, kout, sca0, sca1, sca2
 *                                 if sca0<0 and sca1<0 and sca2<0:
 */
                __pyx_v_sca2 = (((__pyx_v_sol0 - __pyx_v_S2X) * __pyx_v_S2X) + ((__pyx_v_sol1 - __pyx_v_S2Y) * __pyx_v_S2Y));

                /* "tofu/geom/_GG03.pyx":1783
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 1, k, kout, sca0, sca1, sca2
 *                                 if sca0<0 and sca1<0 and sca2<0:             # <<<<<<<<<<<<<<
 *                                     continue
 *                             # Get the normalized perpendicular vector at intersection
 */
                __pyx_t_13 = ((__pyx_v_sca0 < 0.0) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L77_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_sca1 < 0.0) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L77_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_sca2 < 0.0) != 0);
                __pyx_t_12 = __pyx_t_13;
                __pyx_L77_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1784
 *                                 #print 1, k, kout, sca0, sca1, sca2
 *                                 if sca0<0 and sca1<0 and sca2<0:
 *                                     continue             # <<<<<<<<<<<<<<
 *                             # Get the normalized perpendicular vector at intersection
 *                             phi = Catan2(sol1,sol0)
 */
                  goto __pyx_L66_continue;

                  /* "tofu/geom/_GG03.pyx":1783
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 1, k, kout, sca0, sca1, sca2
 *                                 if sca0<0 and sca1<0 and sca2<0:             # <<<<<<<<<<<<<<
 *                                     continue
 *                             # Get the normalized perpendicular vector at intersection
 */
                }

                /* "tofu/geom/_GG03.pyx":1778
 *                         if k>=0:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:             # <<<<<<<<<<<<<<
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
              }

              /* "tofu/geom/_GG03.pyx":1786
 *                                     continue
 *                             # Get the normalized perpendicular vector at intersection
 *                             phi = Catan2(sol1,sol0)             # <<<<<<<<<<<<<<
 *                             if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                 # Get the scalar product to determine entry or exit point
 */
              __pyx_v_phi = atan2(__pyx_v_sol1, __pyx_v_sol0);

              /* "tofu/geom/_GG03.pyx":1787
 *                             # Get the normalized perpendicular vector at intersection
 *                             phi = Catan2(sol1,sol0)
 *                             if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                 # Get the scalar product to determine entry or exit point
 *                                 sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
              __pyx_t_13 = (__pyx_v_Lim == Py_None);
              __pyx_t_92 = (__pyx_t_13 != 0);
              if (!__pyx_t_92) {
              } else {
                __pyx_t_12 = __pyx_t_92;
                goto __pyx_L81_bool_binop_done;
              }
              __pyx_t_92 = (__pyx_v_Lim != Py_None);
              __pyx_t_13 = (__pyx_t_92 != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_12 = __pyx_t_13;
                goto __pyx_L81_bool_binop_done;
              }
              __pyx_t_13 = ((__pyx_v_L0 < __pyx_v_L1) != 0);
              if (!__pyx_t_13) {
                goto __pyx_L84_next_or;
              } else {
              }
              __pyx_t_13 = ((__pyx_v_L0 <= __pyx_v_phi) != 0);
              if (!__pyx_t_13) {
                goto __pyx_L84_next_or;
              } else {
              }
              __pyx_t_13 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
              if (!__pyx_t_13) {
              } else {
                __pyx_t_12 = __pyx_t_13;
                goto __pyx_L81_bool_binop_done;
              }
              __pyx_L84_next_or:;
              __pyx_t_13 = ((__pyx_v_L0 > __pyx_v_L1) != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_12 = __pyx_t_13;
                goto __pyx_L81_bool_binop_done;
              }
              __pyx_t_13 = ((__pyx_v_phi >= __pyx_v_L0) != 0);
              if (!__pyx_t_13) {
              } else {
                __pyx_t_12 = __pyx_t_13;
                goto __pyx_L81_bool_binop_done;
              }
              __pyx_t_13 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
              __pyx_t_12 = __pyx_t_13;
              __pyx_L81_bool_binop_done:;
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1789
 *                             if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                 # Get the scalar product to determine entry or exit point
 *                                 sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]             # <<<<<<<<<<<<<<
 *                                 if sca<=0 and k<kout:
 *                                     kout = k
 */
                __pyx_t_182 = 0;
                __pyx_t_183 = __pyx_v_jj;
                __pyx_t_184 = 0;
                __pyx_t_185 = __pyx_v_ii;
                __pyx_t_186 = 0;
                __pyx_t_187 = __pyx_v_jj;
                __pyx_t_188 = 1;
                __pyx_t_189 = __pyx_v_ii;
                __pyx_t_190 = 1;
                __pyx_t_191 = __pyx_v_jj;
                __pyx_t_192 = 2;
                __pyx_t_193 = __pyx_v_ii;
                __pyx_v_sca = ((((cos(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_182 * __pyx_v_vIn.strides[0]) )) + __pyx_t_183)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_184 * __pyx_v_us.strides[0]) )) + __pyx_t_185)) )))) + ((sin(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_186 * __pyx_v_vIn.strides[0]) )) + __pyx_t_187)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_188 * __pyx_v_us.strides[0]) )) + __pyx_t_189)) ))))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_190 * __pyx_v_vIn.strides[0]) )) + __pyx_t_191)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_192 * __pyx_v_us.strides[0]) )) + __pyx_t_193)) )))));

                /* "tofu/geom/_GG03.pyx":1790
 *                                 # Get the scalar product to determine entry or exit point
 *                                 sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                 if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                     kout = k
 *                                     indout = jj
 */
                __pyx_t_13 = ((__pyx_v_sca <= 0.0) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L90_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_k < __pyx_v_kout) != 0);
                __pyx_t_12 = __pyx_t_13;
                __pyx_L90_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1791
 *                                 sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                 if sca<=0 and k<kout:
 *                                     kout = k             # <<<<<<<<<<<<<<
 *                                     indout = jj
 *                                     Done = 1
 */
                  __pyx_v_kout = __pyx_v_k;

                  /* "tofu/geom/_GG03.pyx":1792
 *                                 if sca<=0 and k<kout:
 *                                     kout = k
 *                                     indout = jj             # <<<<<<<<<<<<<<
 *                                     Done = 1
 *                                     #print(5, k)
 */
                  __pyx_v_indout = __pyx_v_jj;

                  /* "tofu/geom/_GG03.pyx":1793
 *                                     kout = k
 *                                     indout = jj
 *                                     Done = 1             # <<<<<<<<<<<<<<
 *                                     #print(5, k)
 *                                 elif sca>=0 and k<min(kin,kout):
 */
                  __pyx_v_Done = 1;

                  /* "tofu/geom/_GG03.pyx":1790
 *                                 # Get the scalar product to determine entry or exit point
 *                                 sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                 if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                     kout = k
 *                                     indout = jj
 */
                  goto __pyx_L89;
                }

                /* "tofu/geom/_GG03.pyx":1795
 *                                     Done = 1
 *                                     #print(5, k)
 *                                 elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                     kin = k
 *                                     indin = jj
 */
                __pyx_t_13 = ((__pyx_v_sca >= 0.0) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L92_bool_binop_done;
                }
                __pyx_t_15 = __pyx_v_kout;
                __pyx_t_14 = __pyx_v_kin;
                if (((__pyx_t_15 < __pyx_t_14) != 0)) {
                  __pyx_t_105 = __pyx_t_15;
                } else {
                  __pyx_t_105 = __pyx_t_14;
                }
                __pyx_t_13 = ((__pyx_v_k < __pyx_t_105) != 0);
                __pyx_t_12 = __pyx_t_13;
                __pyx_L92_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1796
 *                                     #print(5, k)
 *                                 elif sca>=0 and k<min(kin,kout):
 *                                     kin = k             # <<<<<<<<<<<<<<
 *                                     indin = jj
 *                                     #print(6, k)
 */
                  __pyx_v_kin = __pyx_v_k;

                  /* "tofu/geom/_GG03.pyx":1797
 *                                 elif sca>=0 and k<min(kin,kout):
 *                                     kin = k
 *                                     indin = jj             # <<<<<<<<<<<<<<
 *                                     #print(6, k)
 * 
 */
                  __pyx_v_indin = __pyx_v_jj;

                  /* "tofu/geom/_GG03.pyx":1795
 *                                     Done = 1
 *                                     #print(5, k)
 *                                 elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                     kin = k
 *                                     indin = jj
 */
                }
                __pyx_L89:;

                /* "tofu/geom/_GG03.pyx":1787
 *                             # Get the normalized perpendicular vector at intersection
 *                             phi = Catan2(sol1,sol0)
 *                             if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                 # Get the scalar product to determine entry or exit point
 *                                 sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
              }

              /* "tofu/geom/_GG03.pyx":1776
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0:             # <<<<<<<<<<<<<<
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 */
            }

            /* "tofu/geom/_GG03.pyx":1774
 *                 if A**2<EpsA**2 and B**2>EpsB**2:
 *                     q = -C/(2.*B)
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0:
 */
          }

          /* "tofu/geom/_GG03.pyx":1772
 *                 C = -upar2*(Ds[2,ii]-VPoly[1,jj])**2/us[2,ii]**2 + 2.*upscaDp*(Ds[2,ii]-VPoly[1,jj])/us[2,ii] - Dpar2 + VPoly[0,jj]**2
 * 
 *                 if A**2<EpsA**2 and B**2>EpsB**2:             # <<<<<<<<<<<<<<
 *                     q = -C/(2.*B)
 *                     if q>=0. and q<1.:
 */
          goto __pyx_L68;
        }

        /* "tofu/geom/_GG03.pyx":1800
 *                                     #print(6, k)
 * 
 *                 elif A**2>=EpsA**2 and B**2>A*C:             # <<<<<<<<<<<<<<
 *                     sqd = Csqrt(B**2-A*C)
 *                     # First solution
 */
        __pyx_t_13 = ((pow(__pyx_v_A, 2.0) >= pow(__pyx_v_EpsA, 2.0)) != 0);
        if (__pyx_t_13) {
        } else {
          __pyx_t_12 = __pyx_t_13;
          goto __pyx_L94_bool_binop_done;
        }
        __pyx_t_13 = ((pow(__pyx_v_B, 2.0) > (__pyx_v_A * __pyx_v_C)) != 0);
        __pyx_t_12 = __pyx_t_13;
        __pyx_L94_bool_binop_done:;
        if (__pyx_t_12) {

          /* "tofu/geom/_GG03.pyx":1801
 * 
 *                 elif A**2>=EpsA**2 and B**2>A*C:
 *                     sqd = Csqrt(B**2-A*C)             # <<<<<<<<<<<<<<
 *                     # First solution
 *                     q = (-B + sqd)/A
 */
          __pyx_v_sqd = sqrt((pow(__pyx_v_B, 2.0) - (__pyx_v_A * __pyx_v_C)));

          /* "tofu/geom/_GG03.pyx":1803
 *                     sqd = Csqrt(B**2-A*C)
 *                     # First solution
 *                     q = (-B + sqd)/A             # <<<<<<<<<<<<<<
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 */
          __pyx_v_q = (((-__pyx_v_B) + __pyx_v_sqd) / __pyx_v_A);

          /* "tofu/geom/_GG03.pyx":1804
 *                     # First solution
 *                     q = (-B + sqd)/A
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0.:
 */
          __pyx_t_13 = ((__pyx_v_q >= 0.) != 0);
          if (__pyx_t_13) {
          } else {
            __pyx_t_12 = __pyx_t_13;
            goto __pyx_L97_bool_binop_done;
          }
          __pyx_t_13 = ((__pyx_v_q < 1.) != 0);
          __pyx_t_12 = __pyx_t_13;
          __pyx_L97_bool_binop_done:;
          if (__pyx_t_12) {

            /* "tofu/geom/_GG03.pyx":1805
 *                     q = (-B + sqd)/A
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]             # <<<<<<<<<<<<<<
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 */
            __pyx_t_194 = 2;
            __pyx_t_195 = __pyx_v_ii;
            __pyx_t_196 = 1;
            __pyx_t_197 = __pyx_v_jj;
            __pyx_t_198 = 2;
            __pyx_t_199 = __pyx_v_ii;
            __pyx_v_k = (((__pyx_v_q * __pyx_v_v1) - ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_194 * __pyx_v_Ds.strides[0]) )) + __pyx_t_195)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_196 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_197)) ))))) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_198 * __pyx_v_us.strides[0]) )) + __pyx_t_199)) ))));

            /* "tofu/geom/_GG03.pyx":1806
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0.:             # <<<<<<<<<<<<<<
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 */
            __pyx_t_12 = ((__pyx_v_k >= 0.) != 0);
            if (__pyx_t_12) {

              /* "tofu/geom/_GG03.pyx":1807
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]             # <<<<<<<<<<<<<<
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 */
              __pyx_t_200 = 0;
              __pyx_t_201 = __pyx_v_ii;
              __pyx_t_202 = 0;
              __pyx_t_203 = __pyx_v_ii;
              __pyx_t_105 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_200 * __pyx_v_Ds.strides[0]) )) + __pyx_t_201)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_202 * __pyx_v_us.strides[0]) )) + __pyx_t_203)) )))));
              __pyx_t_204 = 1;
              __pyx_t_205 = __pyx_v_ii;
              __pyx_t_206 = 1;
              __pyx_t_207 = __pyx_v_ii;
              __pyx_t_15 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_204 * __pyx_v_Ds.strides[0]) )) + __pyx_t_205)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_206 * __pyx_v_us.strides[0]) )) + __pyx_t_207)) )))));
              __pyx_v_sol0 = __pyx_t_105;
              __pyx_v_sol1 = __pyx_t_15;

              /* "tofu/geom/_GG03.pyx":1808
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:             # <<<<<<<<<<<<<<
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
              __pyx_t_12 = (__pyx_v_Forbidbis != 0);
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1809
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]             # <<<<<<<<<<<<<<
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 */
                __pyx_t_208 = 0;
                __pyx_t_209 = __pyx_v_ii;
                __pyx_t_210 = 1;
                __pyx_t_211 = __pyx_v_ii;
                __pyx_v_sca0 = (((__pyx_v_sol0 - __pyx_v_S1X) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_208 * __pyx_v_Ds.strides[0]) )) + __pyx_t_209)) )))) + ((__pyx_v_sol1 - __pyx_v_S1Y) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_210 * __pyx_v_Ds.strides[0]) )) + __pyx_t_211)) )))));

                /* "tofu/geom/_GG03.pyx":1810
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y             # <<<<<<<<<<<<<<
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 2, k, kout, sca0, sca1, sca2
 */
                __pyx_v_sca1 = (((__pyx_v_sol0 - __pyx_v_S1X) * __pyx_v_S1X) + ((__pyx_v_sol1 - __pyx_v_S1Y) * __pyx_v_S1Y));

                /* "tofu/geom/_GG03.pyx":1811
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y             # <<<<<<<<<<<<<<
 *                                 #print 2, k, kout, sca0, sca1, sca2
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 */
                __pyx_v_sca2 = (((__pyx_v_sol0 - __pyx_v_S2X) * __pyx_v_S2X) + ((__pyx_v_sol1 - __pyx_v_S2Y) * __pyx_v_S2Y));

                /* "tofu/geom/_GG03.pyx":1808
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:             # <<<<<<<<<<<<<<
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
              }

              /* "tofu/geom/_GG03.pyx":1813
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 2, k, kout, sca0, sca1, sca2
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 */
              __pyx_t_13 = ((!(__pyx_v_Forbidbis != 0)) != 0);
              if (!__pyx_t_13) {
              } else {
                __pyx_t_12 = __pyx_t_13;
                goto __pyx_L102_bool_binop_done;
              }
              __pyx_t_13 = (__pyx_v_Forbidbis != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_12 = __pyx_t_13;
                goto __pyx_L102_bool_binop_done;
              }
              __pyx_t_92 = ((__pyx_v_sca0 < 0.0) != 0);
              if (__pyx_t_92) {
              } else {
                __pyx_t_13 = __pyx_t_92;
                goto __pyx_L105_bool_binop_done;
              }
              __pyx_t_92 = ((__pyx_v_sca1 < 0.0) != 0);
              if (__pyx_t_92) {
              } else {
                __pyx_t_13 = __pyx_t_92;
                goto __pyx_L105_bool_binop_done;
              }
              __pyx_t_92 = ((__pyx_v_sca2 < 0.0) != 0);
              __pyx_t_13 = __pyx_t_92;
              __pyx_L105_bool_binop_done:;
              __pyx_t_92 = ((!__pyx_t_13) != 0);
              __pyx_t_12 = __pyx_t_92;
              __pyx_L102_bool_binop_done:;
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1815
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)             # <<<<<<<<<<<<<<
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                     # Get the scalar product to determine entry or exit point
 */
                __pyx_v_phi = atan2(__pyx_v_sol1, __pyx_v_sol0);

                /* "tofu/geom/_GG03.pyx":1816
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                __pyx_t_92 = (__pyx_v_Lim == Py_None);
                __pyx_t_13 = (__pyx_t_92 != 0);
                if (!__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L109_bool_binop_done;
                }
                __pyx_t_13 = (__pyx_v_Lim != Py_None);
                __pyx_t_92 = (__pyx_t_13 != 0);
                if (__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L109_bool_binop_done;
                }
                __pyx_t_92 = ((__pyx_v_L0 < __pyx_v_L1) != 0);
                if (!__pyx_t_92) {
                  goto __pyx_L112_next_or;
                } else {
                }
                __pyx_t_92 = ((__pyx_v_L0 <= __pyx_v_phi) != 0);
                if (!__pyx_t_92) {
                  goto __pyx_L112_next_or;
                } else {
                }
                __pyx_t_92 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                if (!__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L109_bool_binop_done;
                }
                __pyx_L112_next_or:;
                __pyx_t_92 = ((__pyx_v_L0 > __pyx_v_L1) != 0);
                if (__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L109_bool_binop_done;
                }
                __pyx_t_92 = ((__pyx_v_phi >= __pyx_v_L0) != 0);
                if (!__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L109_bool_binop_done;
                }
                __pyx_t_92 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                __pyx_t_12 = __pyx_t_92;
                __pyx_L109_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1818
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]             # <<<<<<<<<<<<<<
 *                                     if sca<=0 and k<kout:
 *                                         kout = k
 */
                  __pyx_t_212 = 0;
                  __pyx_t_213 = __pyx_v_jj;
                  __pyx_t_214 = 0;
                  __pyx_t_215 = __pyx_v_ii;
                  __pyx_t_216 = 0;
                  __pyx_t_217 = __pyx_v_jj;
                  __pyx_t_218 = 1;
                  __pyx_t_219 = __pyx_v_ii;
                  __pyx_t_220 = 1;
                  __pyx_t_221 = __pyx_v_jj;
                  __pyx_t_222 = 2;
                  __pyx_t_223 = __pyx_v_ii;
                  __pyx_v_sca = ((((cos(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_212 * __pyx_v_vIn.strides[0]) )) + __pyx_t_213)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_214 * __pyx_v_us.strides[0]) )) + __pyx_t_215)) )))) + ((sin(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_216 * __pyx_v_vIn.strides[0]) )) + __pyx_t_217)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_218 * __pyx_v_us.strides[0]) )) + __pyx_t_219)) ))))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_220 * __pyx_v_vIn.strides[0]) )) + __pyx_t_221)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_222 * __pyx_v_us.strides[0]) )) + __pyx_t_223)) )))));

                  /* "tofu/geom/_GG03.pyx":1819
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                     if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                         kout = k
 *                                         indout = jj
 */
                  __pyx_t_92 = ((__pyx_v_sca <= 0.0) != 0);
                  if (__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L118_bool_binop_done;
                  }
                  __pyx_t_92 = ((__pyx_v_k < __pyx_v_kout) != 0);
                  __pyx_t_12 = __pyx_t_92;
                  __pyx_L118_bool_binop_done:;
                  if (__pyx_t_12) {

                    /* "tofu/geom/_GG03.pyx":1820
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                     if sca<=0 and k<kout:
 *                                         kout = k             # <<<<<<<<<<<<<<
 *                                         indout = jj
 *                                         Done = 1
 */
                    __pyx_v_kout = __pyx_v_k;

                    /* "tofu/geom/_GG03.pyx":1821
 *                                     if sca<=0 and k<kout:
 *                                         kout = k
 *                                         indout = jj             # <<<<<<<<<<<<<<
 *                                         Done = 1
 *                                         #print(7, k, q, A, B, C, sqd)
 */
                    __pyx_v_indout = __pyx_v_jj;

                    /* "tofu/geom/_GG03.pyx":1822
 *                                         kout = k
 *                                         indout = jj
 *                                         Done = 1             # <<<<<<<<<<<<<<
 *                                         #print(7, k, q, A, B, C, sqd)
 *                                     elif sca>=0 and k<min(kin,kout):
 */
                    __pyx_v_Done = 1;

                    /* "tofu/geom/_GG03.pyx":1819
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                     if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                         kout = k
 *                                         indout = jj
 */
                    goto __pyx_L117;
                  }

                  /* "tofu/geom/_GG03.pyx":1824
 *                                         Done = 1
 *                                         #print(7, k, q, A, B, C, sqd)
 *                                     elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                         kin = k
 *                                         indin = jj
 */
                  __pyx_t_92 = ((__pyx_v_sca >= 0.0) != 0);
                  if (__pyx_t_92) {
                  } else {
                    __pyx_t_12 = __pyx_t_92;
                    goto __pyx_L120_bool_binop_done;
                  }
                  __pyx_t_15 = __pyx_v_kout;
                  __pyx_t_105 = __pyx_v_kin;
                  if (((__pyx_t_15 < __pyx_t_105) != 0)) {
                    __pyx_t_14 = __pyx_t_15;
                  } else {
                    __pyx_t_14 = __pyx_t_105;
                  }
                  __pyx_t_92 = ((__pyx_v_k < __pyx_t_14) != 0);
                  __pyx_t_12 = __pyx_t_92;
                  __pyx_L120_bool_binop_done:;
                  if (__pyx_t_12) {

                    /* "tofu/geom/_GG03.pyx":1825
 *                                         #print(7, k, q, A, B, C, sqd)
 *                                     elif sca>=0 and k<min(kin,kout):
 *                                         kin = k             # <<<<<<<<<<<<<<
 *                                         indin = jj
 *                                         #print(8, k, jj)
 */
                    __pyx_v_kin = __pyx_v_k;

                    /* "tofu/geom/_GG03.pyx":1826
 *                                     elif sca>=0 and k<min(kin,kout):
 *                                         kin = k
 *                                         indin = jj             # <<<<<<<<<<<<<<
 *                                         #print(8, k, jj)
 * 
 */
                    __pyx_v_indin = __pyx_v_jj;

                    /* "tofu/geom/_GG03.pyx":1824
 *                                         Done = 1
 *                                         #print(7, k, q, A, B, C, sqd)
 *                                     elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                         kin = k
 *                                         indin = jj
 */
                  }
                  __pyx_L117:;

                  /* "tofu/geom/_GG03.pyx":1816
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                }

                /* "tofu/geom/_GG03.pyx":1813
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 2, k, kout, sca0, sca1, sca2
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 */
              }

              /* "tofu/geom/_GG03.pyx":1806
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0.:             # <<<<<<<<<<<<<<
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 */
            }

            /* "tofu/geom/_GG03.pyx":1804
 *                     # First solution
 *                     q = (-B + sqd)/A
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 *                         if k>=0.:
 */
          }

          /* "tofu/geom/_GG03.pyx":1830
 * 
 *                     # Second solution
 *                     q = (-B - sqd)/A             # <<<<<<<<<<<<<<
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 */
          __pyx_v_q = (((-__pyx_v_B) - __pyx_v_sqd) / __pyx_v_A);

          /* "tofu/geom/_GG03.pyx":1831
 *                     # Second solution
 *                     q = (-B - sqd)/A
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 * 
 */
          __pyx_t_92 = ((__pyx_v_q >= 0.) != 0);
          if (__pyx_t_92) {
          } else {
            __pyx_t_12 = __pyx_t_92;
            goto __pyx_L123_bool_binop_done;
          }
          __pyx_t_92 = ((__pyx_v_q < 1.) != 0);
          __pyx_t_12 = __pyx_t_92;
          __pyx_L123_bool_binop_done:;
          if (__pyx_t_12) {

            /* "tofu/geom/_GG03.pyx":1832
 *                     q = (-B - sqd)/A
 *                     if q>=0. and q<1.:
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]             # <<<<<<<<<<<<<<
 * 
 *                         if k>=0.:
 */
            __pyx_t_224 = 2;
            __pyx_t_225 = __pyx_v_ii;
            __pyx_t_226 = 1;
            __pyx_t_227 = __pyx_v_jj;
            __pyx_t_228 = 2;
            __pyx_t_229 = __pyx_v_ii;
            __pyx_v_k = (((__pyx_v_q * __pyx_v_v1) - ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_224 * __pyx_v_Ds.strides[0]) )) + __pyx_t_225)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_226 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_227)) ))))) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_228 * __pyx_v_us.strides[0]) )) + __pyx_t_229)) ))));

            /* "tofu/geom/_GG03.pyx":1834
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 * 
 *                         if k>=0.:             # <<<<<<<<<<<<<<
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 */
            __pyx_t_12 = ((__pyx_v_k >= 0.) != 0);
            if (__pyx_t_12) {

              /* "tofu/geom/_GG03.pyx":1835
 * 
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]             # <<<<<<<<<<<<<<
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 */
              __pyx_t_230 = 0;
              __pyx_t_231 = __pyx_v_ii;
              __pyx_t_232 = 0;
              __pyx_t_233 = __pyx_v_ii;
              __pyx_t_14 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_230 * __pyx_v_Ds.strides[0]) )) + __pyx_t_231)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_232 * __pyx_v_us.strides[0]) )) + __pyx_t_233)) )))));
              __pyx_t_234 = 1;
              __pyx_t_235 = __pyx_v_ii;
              __pyx_t_236 = 1;
              __pyx_t_237 = __pyx_v_ii;
              __pyx_t_15 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_234 * __pyx_v_Ds.strides[0]) )) + __pyx_t_235)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_236 * __pyx_v_us.strides[0]) )) + __pyx_t_237)) )))));
              __pyx_v_sol0 = __pyx_t_14;
              __pyx_v_sol1 = __pyx_t_15;

              /* "tofu/geom/_GG03.pyx":1836
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:             # <<<<<<<<<<<<<<
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
              __pyx_t_12 = (__pyx_v_Forbidbis != 0);
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1837
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]             # <<<<<<<<<<<<<<
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 */
                __pyx_t_238 = 0;
                __pyx_t_239 = __pyx_v_ii;
                __pyx_t_240 = 1;
                __pyx_t_241 = __pyx_v_ii;
                __pyx_v_sca0 = (((__pyx_v_sol0 - __pyx_v_S1X) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_238 * __pyx_v_Ds.strides[0]) )) + __pyx_t_239)) )))) + ((__pyx_v_sol1 - __pyx_v_S1Y) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_240 * __pyx_v_Ds.strides[0]) )) + __pyx_t_241)) )))));

                /* "tofu/geom/_GG03.pyx":1838
 *                             if Forbidbis:
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y             # <<<<<<<<<<<<<<
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 3, k, kout, sca0, sca1, sca2
 */
                __pyx_v_sca1 = (((__pyx_v_sol0 - __pyx_v_S1X) * __pyx_v_S1X) + ((__pyx_v_sol1 - __pyx_v_S1Y) * __pyx_v_S1Y));

                /* "tofu/geom/_GG03.pyx":1839
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y             # <<<<<<<<<<<<<<
 *                                 #print 3, k, kout, sca0, sca1, sca2
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 */
                __pyx_v_sca2 = (((__pyx_v_sol0 - __pyx_v_S2X) * __pyx_v_S2X) + ((__pyx_v_sol1 - __pyx_v_S2Y) * __pyx_v_S2Y));

                /* "tofu/geom/_GG03.pyx":1836
 *                         if k>=0.:
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:             # <<<<<<<<<<<<<<
 *                                 sca0 = (sol0-S1X)*Ds[0,ii] + (sol1-S1Y)*Ds[1,ii]
 *                                 sca1 = (sol0-S1X)*S1X + (sol1-S1Y)*S1Y
 */
              }

              /* "tofu/geom/_GG03.pyx":1841
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 3, k, kout, sca0, sca1, sca2
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 */
              __pyx_t_92 = ((!(__pyx_v_Forbidbis != 0)) != 0);
              if (!__pyx_t_92) {
              } else {
                __pyx_t_12 = __pyx_t_92;
                goto __pyx_L128_bool_binop_done;
              }
              __pyx_t_92 = (__pyx_v_Forbidbis != 0);
              if (__pyx_t_92) {
              } else {
                __pyx_t_12 = __pyx_t_92;
                goto __pyx_L128_bool_binop_done;
              }
              __pyx_t_13 = ((__pyx_v_sca0 < 0.0) != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_92 = __pyx_t_13;
                goto __pyx_L131_bool_binop_done;
              }
              __pyx_t_13 = ((__pyx_v_sca1 < 0.0) != 0);
              if (__pyx_t_13) {
              } else {
                __pyx_t_92 = __pyx_t_13;
                goto __pyx_L131_bool_binop_done;
              }
              __pyx_t_13 = ((__pyx_v_sca2 < 0.0) != 0);
              __pyx_t_92 = __pyx_t_13;
              __pyx_L131_bool_binop_done:;
              __pyx_t_13 = ((!__pyx_t_92) != 0);
              __pyx_t_12 = __pyx_t_13;
              __pyx_L128_bool_binop_done:;
              if (__pyx_t_12) {

                /* "tofu/geom/_GG03.pyx":1843
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)             # <<<<<<<<<<<<<<
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                     # Get the scalar product to determine entry or exit point
 */
                __pyx_v_phi = atan2(__pyx_v_sol1, __pyx_v_sol0);

                /* "tofu/geom/_GG03.pyx":1844
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                __pyx_t_13 = (__pyx_v_Lim == Py_None);
                __pyx_t_92 = (__pyx_t_13 != 0);
                if (!__pyx_t_92) {
                } else {
                  __pyx_t_12 = __pyx_t_92;
                  goto __pyx_L135_bool_binop_done;
                }
                __pyx_t_92 = (__pyx_v_Lim != Py_None);
                __pyx_t_13 = (__pyx_t_92 != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L135_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_L0 < __pyx_v_L1) != 0);
                if (!__pyx_t_13) {
                  goto __pyx_L138_next_or;
                } else {
                }
                __pyx_t_13 = ((__pyx_v_L0 <= __pyx_v_phi) != 0);
                if (!__pyx_t_13) {
                  goto __pyx_L138_next_or;
                } else {
                }
                __pyx_t_13 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                if (!__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L135_bool_binop_done;
                }
                __pyx_L138_next_or:;
                __pyx_t_13 = ((__pyx_v_L0 > __pyx_v_L1) != 0);
                if (__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L135_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_phi >= __pyx_v_L0) != 0);
                if (!__pyx_t_13) {
                } else {
                  __pyx_t_12 = __pyx_t_13;
                  goto __pyx_L135_bool_binop_done;
                }
                __pyx_t_13 = ((__pyx_v_phi <= __pyx_v_L1) != 0);
                __pyx_t_12 = __pyx_t_13;
                __pyx_L135_bool_binop_done:;
                if (__pyx_t_12) {

                  /* "tofu/geom/_GG03.pyx":1846
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]             # <<<<<<<<<<<<<<
 *                                     if sca<=0 and k<kout:
 *                                         kout = k
 */
                  __pyx_t_242 = 0;
                  __pyx_t_243 = __pyx_v_jj;
                  __pyx_t_244 = 0;
                  __pyx_t_245 = __pyx_v_ii;
                  __pyx_t_246 = 0;
                  __pyx_t_247 = __pyx_v_jj;
                  __pyx_t_248 = 1;
                  __pyx_t_249 = __pyx_v_ii;
                  __pyx_t_250 = 1;
                  __pyx_t_251 = __pyx_v_jj;
                  __pyx_t_252 = 2;
                  __pyx_t_253 = __pyx_v_ii;
                  __pyx_v_sca = ((((cos(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_242 * __pyx_v_vIn.strides[0]) )) + __pyx_t_243)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_244 * __pyx_v_us.strides[0]) )) + __pyx_t_245)) )))) + ((sin(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_246 * __pyx_v_vIn.strides[0]) )) + __pyx_t_247)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_248 * __pyx_v_us.strides[0]) )) + __pyx_t_249)) ))))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_250 * __pyx_v_vIn.strides[0]) )) + __pyx_t_251)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_252 * __pyx_v_us.strides[0]) )) + __pyx_t_253)) )))));

                  /* "tofu/geom/_GG03.pyx":1847
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                     if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                         kout = k
 *                                         indout = jj
 */
                  __pyx_t_13 = ((__pyx_v_sca <= 0.0) != 0);
                  if (__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L144_bool_binop_done;
                  }
                  __pyx_t_13 = ((__pyx_v_k < __pyx_v_kout) != 0);
                  __pyx_t_12 = __pyx_t_13;
                  __pyx_L144_bool_binop_done:;
                  if (__pyx_t_12) {

                    /* "tofu/geom/_GG03.pyx":1848
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                     if sca<=0 and k<kout:
 *                                         kout = k             # <<<<<<<<<<<<<<
 *                                         indout = jj
 *                                         Done = 1
 */
                    __pyx_v_kout = __pyx_v_k;

                    /* "tofu/geom/_GG03.pyx":1849
 *                                     if sca<=0 and k<kout:
 *                                         kout = k
 *                                         indout = jj             # <<<<<<<<<<<<<<
 *                                         Done = 1
 *                                         #print(9, k, jj)
 */
                    __pyx_v_indout = __pyx_v_jj;

                    /* "tofu/geom/_GG03.pyx":1850
 *                                         kout = k
 *                                         indout = jj
 *                                         Done = 1             # <<<<<<<<<<<<<<
 *                                         #print(9, k, jj)
 *                                     elif sca>=0 and k<min(kin,kout):
 */
                    __pyx_v_Done = 1;

                    /* "tofu/geom/_GG03.pyx":1847
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 *                                     if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                         kout = k
 *                                         indout = jj
 */
                    goto __pyx_L143;
                  }

                  /* "tofu/geom/_GG03.pyx":1852
 *                                         Done = 1
 *                                         #print(9, k, jj)
 *                                     elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                         kin = k
 *                                         indin = jj
 */
                  __pyx_t_13 = ((__pyx_v_sca >= 0.0) != 0);
                  if (__pyx_t_13) {
                  } else {
                    __pyx_t_12 = __pyx_t_13;
                    goto __pyx_L146_bool_binop_done;
                  }
                  __pyx_t_15 = __pyx_v_kout;
                  __pyx_t_14 = __pyx_v_kin;
                  if (((__pyx_t_15 < __pyx_t_14) != 0)) {
                    __pyx_t_105 = __pyx_t_15;
                  } else {
                    __pyx_t_105 = __pyx_t_14;
                  }
                  __pyx_t_13 = ((__pyx_v_k < __pyx_t_105) != 0);
                  __pyx_t_12 = __pyx_t_13;
                  __pyx_L146_bool_binop_done:;
                  if (__pyx_t_12) {

                    /* "tofu/geom/_GG03.pyx":1853
 *                                         #print(9, k, jj)
 *                                     elif sca>=0 and k<min(kin,kout):
 *                                         kin = k             # <<<<<<<<<<<<<<
 *                                         indin = jj
 *                                         #print(10, k, q, A, B, C, sqd, v0, v1, jj)
 */
                    __pyx_v_kin = __pyx_v_k;

                    /* "tofu/geom/_GG03.pyx":1854
 *                                     elif sca>=0 and k<min(kin,kout):
 *                                         kin = k
 *                                         indin = jj             # <<<<<<<<<<<<<<
 *                                         #print(10, k, q, A, B, C, sqd, v0, v1, jj)
 * 
 */
                    __pyx_v_indin = __pyx_v_jj;

                    /* "tofu/geom/_GG03.pyx":1852
 *                                         Done = 1
 *                                         #print(9, k, jj)
 *                                     elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                         kin = k
 *                                         indin = jj
 */
                  }
                  __pyx_L143:;

                  /* "tofu/geom/_GG03.pyx":1844
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 *                                 if Lim is None or (Lim is not None and ((L0<L1 and L0<=phi and phi<=L1) or (L0>L1 and (phi>=L0 or phi<=L1)))):             # <<<<<<<<<<<<<<
 *                                     # Get the scalar product to determine entry or exit point
 *                                     sca = Ccos(phi)*vIn[0,jj]*us[0,ii] + Csin(phi)*vIn[0,jj]*us[1,ii] + vIn[1,jj]*us[2,ii]
 */
                }

                /* "tofu/geom/_GG03.pyx":1841
 *                                 sca2 = (sol0-S2X)*S2X + (sol1-S2Y)*S2Y
 *                                 #print 3, k, kout, sca0, sca1, sca2
 *                             if not Forbidbis or (Forbidbis and not (sca0<0 and sca1<0 and sca2<0)):             # <<<<<<<<<<<<<<
 *                                 # Get the normalized perpendicular vector at intersection
 *                                 phi = Catan2(sol1,sol0)
 */
              }

              /* "tofu/geom/_GG03.pyx":1834
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 * 
 *                         if k>=0.:             # <<<<<<<<<<<<<<
 *                             sol0, sol1 = Ds[0,ii] + k*us[0,ii], Ds[1,ii] + k*us[1,ii]
 *                             if Forbidbis:
 */
            }

            /* "tofu/geom/_GG03.pyx":1831
 *                     # Second solution
 *                     q = (-B - sqd)/A
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         k = (q*v1 - (Ds[2,ii]-VPoly[1,jj]))/us[2,ii]
 * 
 */
          }

          /* "tofu/geom/_GG03.pyx":1800
 *                                     #print(6, k)
 * 
 *                 elif A**2>=EpsA**2 and B**2>A*C:             # <<<<<<<<<<<<<<
 *                     sqd = Csqrt(B**2-A*C)
 *                     # First solution
 */
        }
        __pyx_L68:;
        __pyx_L66_continue:;
      }
    }
    __pyx_L12:;

    /* "tofu/geom/_GG03.pyx":1857
 *                                         #print(10, k, q, A, B, C, sqd, v0, v1, jj)
 * 
 *         if Lim is not None:             # <<<<<<<<<<<<<<
 *             ephiIn0, ephiIn1 = -Csin(L0), Ccos(L0)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 */
    __pyx_t_12 = (__pyx_v_Lim != Py_None);
    __pyx_t_13 = (__pyx_t_12 != 0);
    if (__pyx_t_13) {

      /* "tofu/geom/_GG03.pyx":1858
 * 
 *         if Lim is not None:
 *             ephiIn0, ephiIn1 = -Csin(L0), Ccos(L0)             # <<<<<<<<<<<<<<
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 */
      __pyx_t_105 = (-sin(__pyx_v_L0));
      __pyx_t_15 = cos(__pyx_v_L0);
      __pyx_v_ephiIn0 = __pyx_t_105;
      __pyx_v_ephiIn1 = __pyx_t_15;

      /* "tofu/geom/_GG03.pyx":1859
 *         if Lim is not None:
 *             ephiIn0, ephiIn1 = -Csin(L0), Ccos(L0)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:             # <<<<<<<<<<<<<<
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:
 */
      __pyx_t_254 = 0;
      __pyx_t_255 = __pyx_v_ii;
      __pyx_t_256 = 1;
      __pyx_t_257 = __pyx_v_ii;
      __pyx_t_13 = ((fabs((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_254 * __pyx_v_us.strides[0]) )) + __pyx_t_255)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_256 * __pyx_v_us.strides[0]) )) + __pyx_t_257)) ))) * __pyx_v_ephiIn1))) > __pyx_v_EpsPlane) != 0);
      if (__pyx_t_13) {

        /* "tofu/geom/_GG03.pyx":1860
 *             ephiIn0, ephiIn1 = -Csin(L0), Ccos(L0)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)             # <<<<<<<<<<<<<<
 *                 if k>=0:
 *                     # Check if in VPoly
 */
        __pyx_t_258 = 0;
        __pyx_t_259 = __pyx_v_ii;
        __pyx_t_260 = 1;
        __pyx_t_261 = __pyx_v_ii;
        __pyx_t_262 = 0;
        __pyx_t_263 = __pyx_v_ii;
        __pyx_t_264 = 1;
        __pyx_t_265 = __pyx_v_ii;
        __pyx_v_k = ((-(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_258 * __pyx_v_Ds.strides[0]) )) + __pyx_t_259)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_260 * __pyx_v_Ds.strides[0]) )) + __pyx_t_261)) ))) * __pyx_v_ephiIn1))) / (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_262 * __pyx_v_us.strides[0]) )) + __pyx_t_263)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_264 * __pyx_v_us.strides[0]) )) + __pyx_t_265)) ))) * __pyx_v_ephiIn1)));

        /* "tofu/geom/_GG03.pyx":1861
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:             # <<<<<<<<<<<<<<
 *                     # Check if in VPoly
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L0) + (Ds[1,ii]+k*us[1,ii])*Csin(L0), Ds[2,ii]+k*us[2,ii]
 */
        __pyx_t_13 = ((__pyx_v_k >= 0.0) != 0);
        if (__pyx_t_13) {

          /* "tofu/geom/_GG03.pyx":1863
 *                 if k>=0:
 *                     # Check if in VPoly
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L0) + (Ds[1,ii]+k*us[1,ii])*Csin(L0), Ds[2,ii]+k*us[2,ii]             # <<<<<<<<<<<<<<
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):
 *                         # Check PIn (POut not possible for limited torus)
 */
          __pyx_t_266 = 0;
          __pyx_t_267 = __pyx_v_ii;
          __pyx_t_268 = 0;
          __pyx_t_269 = __pyx_v_ii;
          __pyx_t_270 = 1;
          __pyx_t_271 = __pyx_v_ii;
          __pyx_t_272 = 1;
          __pyx_t_273 = __pyx_v_ii;
          __pyx_t_15 = ((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_266 * __pyx_v_Ds.strides[0]) )) + __pyx_t_267)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_268 * __pyx_v_us.strides[0]) )) + __pyx_t_269)) ))))) * cos(__pyx_v_L0)) + (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_270 * __pyx_v_Ds.strides[0]) )) + __pyx_t_271)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_272 * __pyx_v_us.strides[0]) )) + __pyx_t_273)) ))))) * sin(__pyx_v_L0)));
          __pyx_t_274 = 2;
          __pyx_t_275 = __pyx_v_ii;
          __pyx_t_276 = 2;
          __pyx_t_277 = __pyx_v_ii;
          __pyx_t_105 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_274 * __pyx_v_Ds.strides[0]) )) + __pyx_t_275)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_276 * __pyx_v_us.strides[0]) )) + __pyx_t_277)) )))));
          __pyx_v_sol0 = __pyx_t_15;
          __pyx_v_sol1 = __pyx_t_105;

          /* "tofu/geom/_GG03.pyx":1864
 *                     # Check if in VPoly
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L0) + (Ds[1,ii]+k*us[1,ii])*Csin(L0), Ds[2,ii]+k*us[2,ii]
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 */
          __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_278 = __pyx_v_VPoly;
          __PYX_INC_MEMVIEW(&__pyx_t_278, 1);
          if (unlikely(__pyx_memslice_transpose(&__pyx_t_278) == 0)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_t_278, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __PYX_XDEC_MEMVIEW(&__pyx_t_278, 1);
          __pyx_t_278.memview = NULL;
          __pyx_t_278.data = NULL;
          __pyx_t_3 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_3)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_3);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          if (!__pyx_t_3) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_1)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
              __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
              PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_2};
              __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            } else
            #endif
            {
              __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1864, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_18);
              __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_3); __pyx_t_3 = NULL;
              __Pyx_GIVEREF(__pyx_t_2);
              PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_2);
              __pyx_t_2 = 0;
              __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_18, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_contains_point); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyFloat_FromDouble(__pyx_v_sol0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_18 = PyFloat_FromDouble(__pyx_v_sol1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_18);
          PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_18);
          __pyx_t_4 = 0;
          __pyx_t_18 = 0;
          __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1864, __pyx_L1_error)
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1864, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_18, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1864, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_13) {

            /* "tofu/geom/_GG03.pyx":1866
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1             # <<<<<<<<<<<<<<
 *                         if sca<=0 and k<kout:
 *                             kout = k
 */
            __pyx_t_279 = 0;
            __pyx_t_280 = __pyx_v_ii;
            __pyx_t_281 = 1;
            __pyx_t_282 = __pyx_v_ii;
            __pyx_v_sca = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_279 * __pyx_v_us.strides[0]) )) + __pyx_t_280)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_281 * __pyx_v_us.strides[0]) )) + __pyx_t_282)) ))) * __pyx_v_ephiIn1));

            /* "tofu/geom/_GG03.pyx":1867
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 *                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                             kout = k
 *                             indout = -1
 */
            __pyx_t_12 = ((__pyx_v_sca <= 0.0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_13 = __pyx_t_12;
              goto __pyx_L153_bool_binop_done;
            }
            __pyx_t_12 = ((__pyx_v_k < __pyx_v_kout) != 0);
            __pyx_t_13 = __pyx_t_12;
            __pyx_L153_bool_binop_done:;
            if (__pyx_t_13) {

              /* "tofu/geom/_GG03.pyx":1868
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 *                         if sca<=0 and k<kout:
 *                             kout = k             # <<<<<<<<<<<<<<
 *                             indout = -1
 *                             Done = 1
 */
              __pyx_v_kout = __pyx_v_k;

              /* "tofu/geom/_GG03.pyx":1869
 *                         if sca<=0 and k<kout:
 *                             kout = k
 *                             indout = -1             # <<<<<<<<<<<<<<
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):
 */
              __pyx_v_indout = -1;

              /* "tofu/geom/_GG03.pyx":1870
 *                             kout = k
 *                             indout = -1
 *                             Done = 1             # <<<<<<<<<<<<<<
 *                         elif sca>=0 and k<min(kin,kout):
 *                             kin = k
 */
              __pyx_v_Done = 1;

              /* "tofu/geom/_GG03.pyx":1867
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 *                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                             kout = k
 *                             indout = -1
 */
              goto __pyx_L152;
            }

            /* "tofu/geom/_GG03.pyx":1871
 *                             indout = -1
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                             kin = k
 *                             indin = -1
 */
            __pyx_t_12 = ((__pyx_v_sca >= 0.0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_13 = __pyx_t_12;
              goto __pyx_L155_bool_binop_done;
            }
            __pyx_t_105 = __pyx_v_kout;
            __pyx_t_15 = __pyx_v_kin;
            if (((__pyx_t_105 < __pyx_t_15) != 0)) {
              __pyx_t_14 = __pyx_t_105;
            } else {
              __pyx_t_14 = __pyx_t_15;
            }
            __pyx_t_12 = ((__pyx_v_k < __pyx_t_14) != 0);
            __pyx_t_13 = __pyx_t_12;
            __pyx_L155_bool_binop_done:;
            if (__pyx_t_13) {

              /* "tofu/geom/_GG03.pyx":1872
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):
 *                             kin = k             # <<<<<<<<<<<<<<
 *                             indin = -1
 * 
 */
              __pyx_v_kin = __pyx_v_k;

              /* "tofu/geom/_GG03.pyx":1873
 *                         elif sca>=0 and k<min(kin,kout):
 *                             kin = k
 *                             indin = -1             # <<<<<<<<<<<<<<
 * 
 *             ephiIn0, ephiIn1 = Csin(L1), -Ccos(L1)
 */
              __pyx_v_indin = -1;

              /* "tofu/geom/_GG03.pyx":1871
 *                             indout = -1
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                             kin = k
 *                             indin = -1
 */
            }
            __pyx_L152:;

            /* "tofu/geom/_GG03.pyx":1864
 *                     # Check if in VPoly
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L0) + (Ds[1,ii]+k*us[1,ii])*Csin(L0), Ds[2,ii]+k*us[2,ii]
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 */
          }

          /* "tofu/geom/_GG03.pyx":1861
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:             # <<<<<<<<<<<<<<
 *                     # Check if in VPoly
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L0) + (Ds[1,ii]+k*us[1,ii])*Csin(L0), Ds[2,ii]+k*us[2,ii]
 */
        }

        /* "tofu/geom/_GG03.pyx":1859
 *         if Lim is not None:
 *             ephiIn0, ephiIn1 = -Csin(L0), Ccos(L0)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:             # <<<<<<<<<<<<<<
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:
 */
      }

      /* "tofu/geom/_GG03.pyx":1875
 *                             indin = -1
 * 
 *             ephiIn0, ephiIn1 = Csin(L1), -Ccos(L1)             # <<<<<<<<<<<<<<
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 */
      __pyx_t_14 = sin(__pyx_v_L1);
      __pyx_t_105 = (-cos(__pyx_v_L1));
      __pyx_v_ephiIn0 = __pyx_t_14;
      __pyx_v_ephiIn1 = __pyx_t_105;

      /* "tofu/geom/_GG03.pyx":1876
 * 
 *             ephiIn0, ephiIn1 = Csin(L1), -Ccos(L1)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:             # <<<<<<<<<<<<<<
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:
 */
      __pyx_t_283 = 0;
      __pyx_t_284 = __pyx_v_ii;
      __pyx_t_285 = 1;
      __pyx_t_286 = __pyx_v_ii;
      __pyx_t_13 = ((fabs((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_283 * __pyx_v_us.strides[0]) )) + __pyx_t_284)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_285 * __pyx_v_us.strides[0]) )) + __pyx_t_286)) ))) * __pyx_v_ephiIn1))) > __pyx_v_EpsPlane) != 0);
      if (__pyx_t_13) {

        /* "tofu/geom/_GG03.pyx":1877
 *             ephiIn0, ephiIn1 = Csin(L1), -Ccos(L1)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)             # <<<<<<<<<<<<<<
 *                 if k>=0:
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L1) + (Ds[1,ii]+k*us[1,ii])*Csin(L1), Ds[2,ii]+k*us[2,ii]
 */
        __pyx_t_287 = 0;
        __pyx_t_288 = __pyx_v_ii;
        __pyx_t_289 = 1;
        __pyx_t_290 = __pyx_v_ii;
        __pyx_t_291 = 0;
        __pyx_t_292 = __pyx_v_ii;
        __pyx_t_293 = 1;
        __pyx_t_294 = __pyx_v_ii;
        __pyx_v_k = ((-(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_287 * __pyx_v_Ds.strides[0]) )) + __pyx_t_288)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_289 * __pyx_v_Ds.strides[0]) )) + __pyx_t_290)) ))) * __pyx_v_ephiIn1))) / (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_291 * __pyx_v_us.strides[0]) )) + __pyx_t_292)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_293 * __pyx_v_us.strides[0]) )) + __pyx_t_294)) ))) * __pyx_v_ephiIn1)));

        /* "tofu/geom/_GG03.pyx":1878
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:             # <<<<<<<<<<<<<<
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L1) + (Ds[1,ii]+k*us[1,ii])*Csin(L1), Ds[2,ii]+k*us[2,ii]
 *                     # Check if in VPoly
 */
        __pyx_t_13 = ((__pyx_v_k >= 0.0) != 0);
        if (__pyx_t_13) {

          /* "tofu/geom/_GG03.pyx":1879
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L1) + (Ds[1,ii]+k*us[1,ii])*Csin(L1), Ds[2,ii]+k*us[2,ii]             # <<<<<<<<<<<<<<
 *                     # Check if in VPoly
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):
 */
          __pyx_t_295 = 0;
          __pyx_t_296 = __pyx_v_ii;
          __pyx_t_297 = 0;
          __pyx_t_298 = __pyx_v_ii;
          __pyx_t_299 = 1;
          __pyx_t_300 = __pyx_v_ii;
          __pyx_t_301 = 1;
          __pyx_t_302 = __pyx_v_ii;
          __pyx_t_105 = ((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_295 * __pyx_v_Ds.strides[0]) )) + __pyx_t_296)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_297 * __pyx_v_us.strides[0]) )) + __pyx_t_298)) ))))) * cos(__pyx_v_L1)) + (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_299 * __pyx_v_Ds.strides[0]) )) + __pyx_t_300)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_301 * __pyx_v_us.strides[0]) )) + __pyx_t_302)) ))))) * sin(__pyx_v_L1)));
          __pyx_t_303 = 2;
          __pyx_t_304 = __pyx_v_ii;
          __pyx_t_305 = 2;
          __pyx_t_306 = __pyx_v_ii;
          __pyx_t_14 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_303 * __pyx_v_Ds.strides[0]) )) + __pyx_t_304)) ))) + (__pyx_v_k * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_305 * __pyx_v_us.strides[0]) )) + __pyx_t_306)) )))));
          __pyx_v_sol0 = __pyx_t_105;
          __pyx_v_sol1 = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":1881
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L1) + (Ds[1,ii]+k*us[1,ii])*Csin(L1), Ds[2,ii]+k*us[2,ii]
 *                     # Check if in VPoly
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_278 = __pyx_v_VPoly;
          __PYX_INC_MEMVIEW(&__pyx_t_278, 1);
          if (unlikely(__pyx_memslice_transpose(&__pyx_t_278) == 0)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_t_278, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          __PYX_XDEC_MEMVIEW(&__pyx_t_278, 1);
          __pyx_t_278.memview = NULL;
          __pyx_t_278.data = NULL;
          __pyx_t_1 = NULL;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_1) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_18};
              __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_18};
              __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1881, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
              __Pyx_GIVEREF(__pyx_t_18);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_18);
              __pyx_t_18 = 0;
              __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_4);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_contains_point); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyFloat_FromDouble(__pyx_v_sol0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_sol1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_18 = PyList_New(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          __Pyx_GIVEREF(__pyx_t_4);
          PyList_SET_ITEM(__pyx_t_18, 0, __pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_3);
          PyList_SET_ITEM(__pyx_t_18, 1, __pyx_t_3);
          __pyx_t_4 = 0;
          __pyx_t_3 = 0;
          __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GIVEREF(__pyx_t_18);
          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_18);
          __pyx_t_18 = 0;
          __pyx_t_18 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_18);
          if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
          if (PyDict_SetItem(__pyx_t_18, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1881, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 1881, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_13) {

            /* "tofu/geom/_GG03.pyx":1883
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1             # <<<<<<<<<<<<<<
 *                         if sca<=0 and k<kout:
 *                             kout = k
 */
            __pyx_t_307 = 0;
            __pyx_t_308 = __pyx_v_ii;
            __pyx_t_309 = 1;
            __pyx_t_310 = __pyx_v_ii;
            __pyx_v_sca = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_307 * __pyx_v_us.strides[0]) )) + __pyx_t_308)) ))) * __pyx_v_ephiIn0) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_309 * __pyx_v_us.strides[0]) )) + __pyx_t_310)) ))) * __pyx_v_ephiIn1));

            /* "tofu/geom/_GG03.pyx":1884
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 *                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                             kout = k
 *                             indout = -2
 */
            __pyx_t_12 = ((__pyx_v_sca <= 0.0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_13 = __pyx_t_12;
              goto __pyx_L161_bool_binop_done;
            }
            __pyx_t_12 = ((__pyx_v_k < __pyx_v_kout) != 0);
            __pyx_t_13 = __pyx_t_12;
            __pyx_L161_bool_binop_done:;
            if (__pyx_t_13) {

              /* "tofu/geom/_GG03.pyx":1885
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 *                         if sca<=0 and k<kout:
 *                             kout = k             # <<<<<<<<<<<<<<
 *                             indout = -2
 *                             Done = 1
 */
              __pyx_v_kout = __pyx_v_k;

              /* "tofu/geom/_GG03.pyx":1886
 *                         if sca<=0 and k<kout:
 *                             kout = k
 *                             indout = -2             # <<<<<<<<<<<<<<
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):
 */
              __pyx_v_indout = -2;

              /* "tofu/geom/_GG03.pyx":1887
 *                             kout = k
 *                             indout = -2
 *                             Done = 1             # <<<<<<<<<<<<<<
 *                         elif sca>=0 and k<min(kin,kout):
 *                             kin = k
 */
              __pyx_v_Done = 1;

              /* "tofu/geom/_GG03.pyx":1884
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 *                         if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                             kout = k
 *                             indout = -2
 */
              goto __pyx_L160;
            }

            /* "tofu/geom/_GG03.pyx":1888
 *                             indout = -2
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                             kin = k
 *                             indin = -2
 */
            __pyx_t_12 = ((__pyx_v_sca >= 0.0) != 0);
            if (__pyx_t_12) {
            } else {
              __pyx_t_13 = __pyx_t_12;
              goto __pyx_L163_bool_binop_done;
            }
            __pyx_t_14 = __pyx_v_kout;
            __pyx_t_105 = __pyx_v_kin;
            if (((__pyx_t_14 < __pyx_t_105) != 0)) {
              __pyx_t_15 = __pyx_t_14;
            } else {
              __pyx_t_15 = __pyx_t_105;
            }
            __pyx_t_12 = ((__pyx_v_k < __pyx_t_15) != 0);
            __pyx_t_13 = __pyx_t_12;
            __pyx_L163_bool_binop_done:;
            if (__pyx_t_13) {

              /* "tofu/geom/_GG03.pyx":1889
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):
 *                             kin = k             # <<<<<<<<<<<<<<
 *                             indin = -2
 * 
 */
              __pyx_v_kin = __pyx_v_k;

              /* "tofu/geom/_GG03.pyx":1890
 *                         elif sca>=0 and k<min(kin,kout):
 *                             kin = k
 *                             indin = -2             # <<<<<<<<<<<<<<
 * 
 *         if Done==1:
 */
              __pyx_v_indin = -2;

              /* "tofu/geom/_GG03.pyx":1888
 *                             indout = -2
 *                             Done = 1
 *                         elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                             kin = k
 *                             indin = -2
 */
            }
            __pyx_L160:;

            /* "tofu/geom/_GG03.pyx":1881
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L1) + (Ds[1,ii]+k*us[1,ii])*Csin(L1), Ds[2,ii]+k*us[2,ii]
 *                     # Check if in VPoly
 *                     if Path(VPoly.T).contains_point([sol0,sol1], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                         # Check PIn (POut not possible for limited torus)
 *                         sca = us[0,ii]*ephiIn0 + us[1,ii]*ephiIn1
 */
          }

          /* "tofu/geom/_GG03.pyx":1878
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:             # <<<<<<<<<<<<<<
 *                     sol0, sol1 = (Ds[0,ii]+k*us[0,ii])*Ccos(L1) + (Ds[1,ii]+k*us[1,ii])*Csin(L1), Ds[2,ii]+k*us[2,ii]
 *                     # Check if in VPoly
 */
        }

        /* "tofu/geom/_GG03.pyx":1876
 * 
 *             ephiIn0, ephiIn1 = Csin(L1), -Ccos(L1)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:             # <<<<<<<<<<<<<<
 *                 k = -(Ds[0,ii]*ephiIn0+Ds[1,ii]*ephiIn1)/(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)
 *                 if k>=0:
 */
      }

      /* "tofu/geom/_GG03.pyx":1857
 *                                         #print(10, k, q, A, B, C, sqd, v0, v1, jj)
 * 
 *         if Lim is not None:             # <<<<<<<<<<<<<<
 *             ephiIn0, ephiIn1 = -Csin(L0), Ccos(L0)
 *             if Cabs(us[0,ii]*ephiIn0+us[1,ii]*ephiIn1)>EpsPlane:
 */
    }

    /* "tofu/geom/_GG03.pyx":1892
 *                             indin = -2
 * 
 *         if Done==1:             # <<<<<<<<<<<<<<
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 */
    __pyx_t_13 = ((__pyx_v_Done == 1) != 0);
    if (__pyx_t_13) {

      /* "tofu/geom/_GG03.pyx":1893
 * 
 *         if Done==1:
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]             # <<<<<<<<<<<<<<
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 */
      __pyx_t_311 = 0;
      __pyx_t_312 = __pyx_v_ii;
      __pyx_t_313 = 0;
      __pyx_t_314 = __pyx_v_ii;
      __pyx_t_315 = 0;
      __pyx_t_316 = __pyx_v_ii;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_315 * __pyx_v_SOut.strides[0]) )) + __pyx_t_316)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_311 * __pyx_v_Ds.strides[0]) )) + __pyx_t_312)) ))) + (__pyx_v_kout * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_313 * __pyx_v_us.strides[0]) )) + __pyx_t_314)) )))));

      /* "tofu/geom/_GG03.pyx":1894
 *         if Done==1:
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]             # <<<<<<<<<<<<<<
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 *             phi = Catan2(SOut[1,ii],SOut[0,ii])
 */
      __pyx_t_317 = 1;
      __pyx_t_318 = __pyx_v_ii;
      __pyx_t_319 = 1;
      __pyx_t_320 = __pyx_v_ii;
      __pyx_t_321 = 1;
      __pyx_t_322 = __pyx_v_ii;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_321 * __pyx_v_SOut.strides[0]) )) + __pyx_t_322)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_317 * __pyx_v_Ds.strides[0]) )) + __pyx_t_318)) ))) + (__pyx_v_kout * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_319 * __pyx_v_us.strides[0]) )) + __pyx_t_320)) )))));

      /* "tofu/geom/_GG03.pyx":1895
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]             # <<<<<<<<<<<<<<
 *             phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:
 */
      __pyx_t_323 = 2;
      __pyx_t_324 = __pyx_v_ii;
      __pyx_t_325 = 2;
      __pyx_t_326 = __pyx_v_ii;
      __pyx_t_327 = 2;
      __pyx_t_328 = __pyx_v_ii;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_327 * __pyx_v_SOut.strides[0]) )) + __pyx_t_328)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_323 * __pyx_v_Ds.strides[0]) )) + __pyx_t_324)) ))) + (__pyx_v_kout * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_325 * __pyx_v_us.strides[0]) )) + __pyx_t_326)) )))));

      /* "tofu/geom/_GG03.pyx":1896
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 *             phi = Catan2(SOut[1,ii],SOut[0,ii])             # <<<<<<<<<<<<<<
 *             if indout==-1:
 *                 VPerpOut[0,ii] = -Csin(L0)
 */
      __pyx_t_329 = 1;
      __pyx_t_330 = __pyx_v_ii;
      __pyx_t_331 = 0;
      __pyx_t_332 = __pyx_v_ii;
      __pyx_v_phi = atan2((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_329 * __pyx_v_SOut.strides[0]) )) + __pyx_t_330)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_331 * __pyx_v_SOut.strides[0]) )) + __pyx_t_332)) ))));

      /* "tofu/geom/_GG03.pyx":1897
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 *             phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = -Csin(L0)
 *                 VPerpOut[1,ii] = Ccos(L0)
 */
      switch (__pyx_v_indout) {
        case -1L:

        /* "tofu/geom/_GG03.pyx":1898
 *             phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:
 *                 VPerpOut[0,ii] = -Csin(L0)             # <<<<<<<<<<<<<<
 *                 VPerpOut[1,ii] = Ccos(L0)
 *                 VPerpOut[2,ii] = 0.
 */
        __pyx_t_333 = 0;
        __pyx_t_334 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_333 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_334)) )) = (-sin(__pyx_v_L0));

        /* "tofu/geom/_GG03.pyx":1899
 *             if indout==-1:
 *                 VPerpOut[0,ii] = -Csin(L0)
 *                 VPerpOut[1,ii] = Ccos(L0)             # <<<<<<<<<<<<<<
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:
 */
        __pyx_t_335 = 1;
        __pyx_t_336 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_335 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_336)) )) = cos(__pyx_v_L0);

        /* "tofu/geom/_GG03.pyx":1900
 *                 VPerpOut[0,ii] = -Csin(L0)
 *                 VPerpOut[1,ii] = Ccos(L0)
 *                 VPerpOut[2,ii] = 0.             # <<<<<<<<<<<<<<
 *             elif indout==-2:
 *                 VPerpOut[0,ii] = Csin(L1)
 */
        __pyx_t_337 = 2;
        __pyx_t_338 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_337 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_338)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":1897
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 *             phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = -Csin(L0)
 *                 VPerpOut[1,ii] = Ccos(L0)
 */
        break;

        /* "tofu/geom/_GG03.pyx":1901
 *                 VPerpOut[1,ii] = Ccos(L0)
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = Csin(L1)
 *                 VPerpOut[1,ii] = -Ccos(L1)
 */
        case -2L:

        /* "tofu/geom/_GG03.pyx":1902
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:
 *                 VPerpOut[0,ii] = Csin(L1)             # <<<<<<<<<<<<<<
 *                 VPerpOut[1,ii] = -Ccos(L1)
 *                 VPerpOut[2,ii] = 0.
 */
        __pyx_t_339 = 0;
        __pyx_t_340 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_339 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_340)) )) = sin(__pyx_v_L1);

        /* "tofu/geom/_GG03.pyx":1903
 *             elif indout==-2:
 *                 VPerpOut[0,ii] = Csin(L1)
 *                 VPerpOut[1,ii] = -Ccos(L1)             # <<<<<<<<<<<<<<
 *                 VPerpOut[2,ii] = 0.
 *             else:
 */
        __pyx_t_341 = 1;
        __pyx_t_342 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_341 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_342)) )) = (-cos(__pyx_v_L1));

        /* "tofu/geom/_GG03.pyx":1904
 *                 VPerpOut[0,ii] = Csin(L1)
 *                 VPerpOut[1,ii] = -Ccos(L1)
 *                 VPerpOut[2,ii] = 0.             # <<<<<<<<<<<<<<
 *             else:
 *                 VPerpOut[0,ii] = Ccos(phi)*vIn[0,indout]
 */
        __pyx_t_343 = 2;
        __pyx_t_344 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_343 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_344)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":1901
 *                 VPerpOut[1,ii] = Ccos(L0)
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = Csin(L1)
 *                 VPerpOut[1,ii] = -Ccos(L1)
 */
        break;
        default:

        /* "tofu/geom/_GG03.pyx":1906
 *                 VPerpOut[2,ii] = 0.
 *             else:
 *                 VPerpOut[0,ii] = Ccos(phi)*vIn[0,indout]             # <<<<<<<<<<<<<<
 *                 VPerpOut[1,ii] = Csin(phi)*vIn[0,indout]
 *                 VPerpOut[2,ii] = vIn[1,indout]
 */
        __pyx_t_345 = 0;
        __pyx_t_346 = __pyx_v_indout;
        __pyx_t_347 = 0;
        __pyx_t_348 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_347 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_348)) )) = (cos(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_345 * __pyx_v_vIn.strides[0]) )) + __pyx_t_346)) ))));

        /* "tofu/geom/_GG03.pyx":1907
 *             else:
 *                 VPerpOut[0,ii] = Ccos(phi)*vIn[0,indout]
 *                 VPerpOut[1,ii] = Csin(phi)*vIn[0,indout]             # <<<<<<<<<<<<<<
 *                 VPerpOut[2,ii] = vIn[1,indout]
 *             indOut[ii] = indout
 */
        __pyx_t_349 = 0;
        __pyx_t_350 = __pyx_v_indout;
        __pyx_t_351 = 1;
        __pyx_t_352 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_351 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_352)) )) = (sin(__pyx_v_phi) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_349 * __pyx_v_vIn.strides[0]) )) + __pyx_t_350)) ))));

        /* "tofu/geom/_GG03.pyx":1908
 *                 VPerpOut[0,ii] = Ccos(phi)*vIn[0,indout]
 *                 VPerpOut[1,ii] = Csin(phi)*vIn[0,indout]
 *                 VPerpOut[2,ii] = vIn[1,indout]             # <<<<<<<<<<<<<<
 *             indOut[ii] = indout
 *             if kin<kout:
 */
        __pyx_t_353 = 1;
        __pyx_t_354 = __pyx_v_indout;
        __pyx_t_355 = 2;
        __pyx_t_356 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_355 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_356)) )) = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_353 * __pyx_v_vIn.strides[0]) )) + __pyx_t_354)) )));
        break;
      }

      /* "tofu/geom/_GG03.pyx":1909
 *                 VPerpOut[1,ii] = Csin(phi)*vIn[0,indout]
 *                 VPerpOut[2,ii] = vIn[1,indout]
 *             indOut[ii] = indout             # <<<<<<<<<<<<<<
 *             if kin<kout:
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 */
      __pyx_t_357 = __pyx_v_ii;
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_indOut.data) + __pyx_t_357)) )) = __pyx_v_indout;

      /* "tofu/geom/_GG03.pyx":1910
 *                 VPerpOut[2,ii] = vIn[1,indout]
 *             indOut[ii] = indout
 *             if kin<kout:             # <<<<<<<<<<<<<<
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 */
      __pyx_t_13 = ((__pyx_v_kin < __pyx_v_kout) != 0);
      if (__pyx_t_13) {

        /* "tofu/geom/_GG03.pyx":1911
 *             indOut[ii] = indout
 *             if kin<kout:
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]             # <<<<<<<<<<<<<<
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 */
        __pyx_t_358 = 0;
        __pyx_t_359 = __pyx_v_ii;
        __pyx_t_360 = 0;
        __pyx_t_361 = __pyx_v_ii;
        __pyx_t_362 = 0;
        __pyx_t_363 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_362 * __pyx_v_SIn.strides[0]) )) + __pyx_t_363)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_358 * __pyx_v_Ds.strides[0]) )) + __pyx_t_359)) ))) + (__pyx_v_kin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_360 * __pyx_v_us.strides[0]) )) + __pyx_t_361)) )))));

        /* "tofu/geom/_GG03.pyx":1912
 *             if kin<kout:
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]             # <<<<<<<<<<<<<<
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 phi = Catan2(SIn[1,ii],SIn[0,ii])
 */
        __pyx_t_364 = 1;
        __pyx_t_365 = __pyx_v_ii;
        __pyx_t_366 = 1;
        __pyx_t_367 = __pyx_v_ii;
        __pyx_t_368 = 1;
        __pyx_t_369 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_368 * __pyx_v_SIn.strides[0]) )) + __pyx_t_369)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_364 * __pyx_v_Ds.strides[0]) )) + __pyx_t_365)) ))) + (__pyx_v_kin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_366 * __pyx_v_us.strides[0]) )) + __pyx_t_367)) )))));

        /* "tofu/geom/_GG03.pyx":1913
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]             # <<<<<<<<<<<<<<
 *                 phi = Catan2(SIn[1,ii],SIn[0,ii])
 *                 if indin==-1:
 */
        __pyx_t_370 = 2;
        __pyx_t_371 = __pyx_v_ii;
        __pyx_t_372 = 2;
        __pyx_t_373 = __pyx_v_ii;
        __pyx_t_374 = 2;
        __pyx_t_375 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_374 * __pyx_v_SIn.strides[0]) )) + __pyx_t_375)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_370 * __pyx_v_Ds.strides[0]) )) + __pyx_t_371)) ))) + (__pyx_v_kin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_372 * __pyx_v_us.strides[0]) )) + __pyx_t_373)) )))));

        /* "tofu/geom/_GG03.pyx":1914
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 phi = Catan2(SIn[1,ii],SIn[0,ii])             # <<<<<<<<<<<<<<
 *                 if indin==-1:
 *                     VPerpIn[0,ii] = Csin(L0)
 */
        __pyx_t_376 = 1;
        __pyx_t_377 = __pyx_v_ii;
        __pyx_t_378 = 0;
        __pyx_t_379 = __pyx_v_ii;
        __pyx_v_phi = atan2((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_376 * __pyx_v_SIn.strides[0]) )) + __pyx_t_377)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_378 * __pyx_v_SIn.strides[0]) )) + __pyx_t_379)) ))));

        /* "tofu/geom/_GG03.pyx":1915
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 phi = Catan2(SIn[1,ii],SIn[0,ii])
 *                 if indin==-1:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = Csin(L0)
 *                     VPerpIn[1,ii] = -Ccos(L0)
 */
        switch (__pyx_v_indin) {
          case -1L:

          /* "tofu/geom/_GG03.pyx":1916
 *                 phi = Catan2(SIn[1,ii],SIn[0,ii])
 *                 if indin==-1:
 *                     VPerpIn[0,ii] = Csin(L0)             # <<<<<<<<<<<<<<
 *                     VPerpIn[1,ii] = -Ccos(L0)
 *                     VPerpIn[2,ii] = 0.
 */
          __pyx_t_380 = 0;
          __pyx_t_381 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_380 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_381)) )) = sin(__pyx_v_L0);

          /* "tofu/geom/_GG03.pyx":1917
 *                 if indin==-1:
 *                     VPerpIn[0,ii] = Csin(L0)
 *                     VPerpIn[1,ii] = -Ccos(L0)             # <<<<<<<<<<<<<<
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:
 */
          __pyx_t_382 = 1;
          __pyx_t_383 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_382 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_383)) )) = (-cos(__pyx_v_L0));

          /* "tofu/geom/_GG03.pyx":1918
 *                     VPerpIn[0,ii] = Csin(L0)
 *                     VPerpIn[1,ii] = -Ccos(L0)
 *                     VPerpIn[2,ii] = 0.             # <<<<<<<<<<<<<<
 *                 elif indin==-2:
 *                     VPerpIn[0,ii] = -Csin(L1)
 */
          __pyx_t_384 = 2;
          __pyx_t_385 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_384 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_385)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":1915
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 phi = Catan2(SIn[1,ii],SIn[0,ii])
 *                 if indin==-1:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = Csin(L0)
 *                     VPerpIn[1,ii] = -Ccos(L0)
 */
          break;

          /* "tofu/geom/_GG03.pyx":1919
 *                     VPerpIn[1,ii] = -Ccos(L0)
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = -Csin(L1)
 *                     VPerpIn[1,ii] = Ccos(L1)
 */
          case -2L:

          /* "tofu/geom/_GG03.pyx":1920
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:
 *                     VPerpIn[0,ii] = -Csin(L1)             # <<<<<<<<<<<<<<
 *                     VPerpIn[1,ii] = Ccos(L1)
 *                     VPerpIn[2,ii] = 0.
 */
          __pyx_t_386 = 0;
          __pyx_t_387 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_386 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_387)) )) = (-sin(__pyx_v_L1));

          /* "tofu/geom/_GG03.pyx":1921
 *                 elif indin==-2:
 *                     VPerpIn[0,ii] = -Csin(L1)
 *                     VPerpIn[1,ii] = Ccos(L1)             # <<<<<<<<<<<<<<
 *                     VPerpIn[2,ii] = 0.
 *                 else:
 */
          __pyx_t_388 = 1;
          __pyx_t_389 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_388 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_389)) )) = cos(__pyx_v_L1);

          /* "tofu/geom/_GG03.pyx":1922
 *                     VPerpIn[0,ii] = -Csin(L1)
 *                     VPerpIn[1,ii] = Ccos(L1)
 *                     VPerpIn[2,ii] = 0.             # <<<<<<<<<<<<<<
 *                 else:
 *                     VPerpIn[0,ii] = -Ccos(phi)*vIn[0,indin]
 */
          __pyx_t_390 = 2;
          __pyx_t_391 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_390 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_391)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":1919
 *                     VPerpIn[1,ii] = -Ccos(L0)
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = -Csin(L1)
 *                     VPerpIn[1,ii] = Ccos(L1)
 */
          break;
          default:

          /* "tofu/geom/_GG03.pyx":1924
 *                     VPerpIn[2,ii] = 0.
 *                 else:
 *                     VPerpIn[0,ii] = -Ccos(phi)*vIn[0,indin]             # <<<<<<<<<<<<<<
 *                     VPerpIn[1,ii] = -Csin(phi)*vIn[0,indin]
 *                     VPerpIn[2,ii] = -vIn[1,indin]
 */
          __pyx_t_392 = 0;
          __pyx_t_393 = __pyx_v_indin;
          __pyx_t_394 = 0;
          __pyx_t_395 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_394 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_395)) )) = ((-cos(__pyx_v_phi)) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_392 * __pyx_v_vIn.strides[0]) )) + __pyx_t_393)) ))));

          /* "tofu/geom/_GG03.pyx":1925
 *                 else:
 *                     VPerpIn[0,ii] = -Ccos(phi)*vIn[0,indin]
 *                     VPerpIn[1,ii] = -Csin(phi)*vIn[0,indin]             # <<<<<<<<<<<<<<
 *                     VPerpIn[2,ii] = -vIn[1,indin]
 *                 indIn[ii] = indin
 */
          __pyx_t_396 = 0;
          __pyx_t_397 = __pyx_v_indin;
          __pyx_t_398 = 1;
          __pyx_t_399 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_398 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_399)) )) = ((-sin(__pyx_v_phi)) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_396 * __pyx_v_vIn.strides[0]) )) + __pyx_t_397)) ))));

          /* "tofu/geom/_GG03.pyx":1926
 *                     VPerpIn[0,ii] = -Ccos(phi)*vIn[0,indin]
 *                     VPerpIn[1,ii] = -Csin(phi)*vIn[0,indin]
 *                     VPerpIn[2,ii] = -vIn[1,indin]             # <<<<<<<<<<<<<<
 *                 indIn[ii] = indin
 * 
 */
          __pyx_t_400 = 1;
          __pyx_t_401 = __pyx_v_indin;
          __pyx_t_402 = 2;
          __pyx_t_403 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_402 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_403)) )) = (-(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_vIn.data + __pyx_t_400 * __pyx_v_vIn.strides[0]) )) + __pyx_t_401)) ))));
          break;
        }

        /* "tofu/geom/_GG03.pyx":1927
 *                     VPerpIn[1,ii] = -Csin(phi)*vIn[0,indin]
 *                     VPerpIn[2,ii] = -vIn[1,indin]
 *                 indIn[ii] = indin             # <<<<<<<<<<<<<<
 * 
 *     return np.asarray(SIn), np.asarray(SOut), np.asarray(VPerpIn), np.asarray(VPerpOut), np.asarray(indIn), np.asarray(indOut)
 */
        __pyx_t_404 = __pyx_v_ii;
        *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_indIn.data) + __pyx_t_404)) )) = __pyx_v_indin;

        /* "tofu/geom/_GG03.pyx":1910
 *                 VPerpOut[2,ii] = vIn[1,indout]
 *             indOut[ii] = indout
 *             if kin<kout:             # <<<<<<<<<<<<<<
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 */
      }

      /* "tofu/geom/_GG03.pyx":1892
 *                             indin = -2
 * 
 *         if Done==1:             # <<<<<<<<<<<<<<
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 */
    }
  }

  /* "tofu/geom/_GG03.pyx":1929
 *                 indIn[ii] = indin
 * 
 *     return np.asarray(SIn), np.asarray(SOut), np.asarray(VPerpIn), np.asarray(VPerpOut), np.asarray(indIn), np.asarray(indOut)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_18 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_18, __pyx_n_s_asarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_SIn, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_18};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_18};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_18);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_18);
      __pyx_t_18 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_18 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_SOut, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_18);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_18, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_18)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_18)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_18, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_18, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_VPerpIn, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_18 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_18);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_18 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_5};
      __pyx_t_18 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_18 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_VPerpOut, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_16 = PyTuple_New(1+1); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_16, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_indIn, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_16); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_16};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_16};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    } else
    #endif
    {
      __pyx_t_405 = PyTuple_New(1+1); if (unlikely(!__pyx_t_405)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_405);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_405, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_16);
      PyTuple_SET_ITEM(__pyx_t_405, 0+1, __pyx_t_16);
      __pyx_t_16 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_405, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_405); __pyx_t_405 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_405 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_405)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_405);
  __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_405, __pyx_n_s_asarray); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_DECREF(__pyx_t_405); __pyx_t_405 = 0;
  __pyx_t_405 = __pyx_memoryview_fromslice(__pyx_v_indOut, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_405)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_405);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_16);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_16, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_405); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_405); __pyx_t_405 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_405};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_405); __pyx_t_405 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_405};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_405); __pyx_t_405 = 0;
    } else
    #endif
    {
      __pyx_t_406 = PyTuple_New(1+1); if (unlikely(!__pyx_t_406)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_406);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_406, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_405);
      PyTuple_SET_ITEM(__pyx_t_406, 0+1, __pyx_t_405);
      __pyx_t_405 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_406, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1929, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_406); __pyx_t_406 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
  __pyx_t_16 = PyTuple_New(6); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1929, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_16);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_18);
  PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_18);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_16, 3, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_16, 4, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_16, 5, __pyx_t_6);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_18 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_r = __pyx_t_16;
  __pyx_t_16 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1649
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Tor(double [:,::1] Ds, double [:,::1] us, double [:,::1] VPoly, double [:,::1] vIn, Lim=None,             # <<<<<<<<<<<<<<
 *                          bool Forbid=True, RMin=None, double EpsUz=1.e-6, double EpsVz=1.e-9, double EpsA=1.e-9, double EpsB=1.e-9, double EpsPlane=1.e-9):
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_18);
  __PYX_XDEC_MEMVIEW(&__pyx_t_278, 1);
  __Pyx_XDECREF(__pyx_t_405);
  __Pyx_XDECREF(__pyx_t_406);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SIn_.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SOut_.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indIn_.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indOut_.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.Calc_LOS_PInOut_Tor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SIn_.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SOut_.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indIn_.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indOut_.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_SIn_);
  __Pyx_XDECREF((PyObject *)__pyx_v_SOut_);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPerp_In);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPerp_Out);
  __Pyx_XDECREF((PyObject *)__pyx_v_indIn_);
  __Pyx_XDECREF((PyObject *)__pyx_v_indOut_);
  __PYX_XDEC_MEMVIEW(&__pyx_v_SIn, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_SOut, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPerpIn, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPerpOut, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indIn, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indOut, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":1935
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Lin(double[:,::1] Ds, double [:,::1] us, double[:,::1] VPoly, double[:,::1] VIn, Lim, double EpsPlane=1.e-9):             # <<<<<<<<<<<<<<
 * 
 *     cdef int ii=0, jj=0, Nl=Ds.shape[1], Ns=VIn.shape[1]
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin(__Pyx_memviewslice __pyx_v_Ds, __Pyx_memviewslice __pyx_v_us, __Pyx_memviewslice __pyx_v_VPoly, __Pyx_memviewslice __pyx_v_VIn, PyObject *__pyx_v_Lim, struct __pyx_opt_args_4tofu_4geom_5_GG03_Calc_LOS_PInOut_Lin *__pyx_optional_args) {
  double __pyx_v_EpsPlane = ((double)1.e-9);
  int __pyx_v_ii;
  int __pyx_v_jj;
  int __pyx_v_Nl;
  int __pyx_v_Ns;
  double __pyx_v_kin;
  double __pyx_v_kout;
  double __pyx_v_scauVin;
  double __pyx_v_q;
  double __pyx_v_X;
  double __pyx_v_sca;
  double __pyx_v_L0;
  double __pyx_v_L1;
  int __pyx_v_indin;
  int __pyx_v_indout;
  int __pyx_v_Done;
  PyArrayObject *__pyx_v_SIn_ = 0;
  PyArrayObject *__pyx_v_SOut_ = 0;
  PyArrayObject *__pyx_v_VPerp_In = 0;
  PyArrayObject *__pyx_v_VPerp_Out = 0;
  PyArrayObject *__pyx_v_indIn_ = 0;
  PyArrayObject *__pyx_v_indOut_ = 0;
  __Pyx_memviewslice __pyx_v_SIn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_SOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_VPerpIn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_VPerpOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_indIn = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_indOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_V1 = NULL;
  PyObject *__pyx_v_V2 = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_SIn_;
  __Pyx_Buffer __pyx_pybuffer_SIn_;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_SOut_;
  __Pyx_Buffer __pyx_pybuffer_SOut_;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPerp_In;
  __Pyx_Buffer __pyx_pybuffer_VPerp_In;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_VPerp_Out;
  __Pyx_Buffer __pyx_pybuffer_VPerp_Out;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indIn_;
  __Pyx_Buffer __pyx_pybuffer_indIn_;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_indOut_;
  __Pyx_Buffer __pyx_pybuffer_indOut_;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  __Pyx_memviewslice __pyx_t_11 = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  int __pyx_t_13;
  int __pyx_t_14;
  double __pyx_t_15;
  int __pyx_t_16;
  int __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  Py_ssize_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  Py_ssize_t __pyx_t_25;
  int __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  Py_ssize_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  Py_ssize_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  Py_ssize_t __pyx_t_32;
  Py_ssize_t __pyx_t_33;
  Py_ssize_t __pyx_t_34;
  Py_ssize_t __pyx_t_35;
  Py_ssize_t __pyx_t_36;
  Py_ssize_t __pyx_t_37;
  Py_ssize_t __pyx_t_38;
  Py_ssize_t __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  Py_ssize_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  Py_ssize_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  Py_ssize_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  Py_ssize_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  int __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  double __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  __Pyx_memviewslice __pyx_t_79 = { 0, 0, { 0 }, { 0 }, { 0 } };
  Py_ssize_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  Py_ssize_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  Py_ssize_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  Py_ssize_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  Py_ssize_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  Py_ssize_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  Py_ssize_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  Py_ssize_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  Py_ssize_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  Py_ssize_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  Py_ssize_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  Py_ssize_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  Py_ssize_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  Py_ssize_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  Py_ssize_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  Py_ssize_t __pyx_t_138;
  Py_ssize_t __pyx_t_139;
  Py_ssize_t __pyx_t_140;
  Py_ssize_t __pyx_t_141;
  Py_ssize_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  Py_ssize_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  Py_ssize_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  Py_ssize_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  Py_ssize_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  Py_ssize_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  Py_ssize_t __pyx_t_154;
  Py_ssize_t __pyx_t_155;
  Py_ssize_t __pyx_t_156;
  Py_ssize_t __pyx_t_157;
  Py_ssize_t __pyx_t_158;
  Py_ssize_t __pyx_t_159;
  Py_ssize_t __pyx_t_160;
  Py_ssize_t __pyx_t_161;
  Py_ssize_t __pyx_t_162;
  Py_ssize_t __pyx_t_163;
  Py_ssize_t __pyx_t_164;
  Py_ssize_t __pyx_t_165;
  Py_ssize_t __pyx_t_166;
  Py_ssize_t __pyx_t_167;
  Py_ssize_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  Py_ssize_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  Py_ssize_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  Py_ssize_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  Py_ssize_t __pyx_t_176;
  Py_ssize_t __pyx_t_177;
  Py_ssize_t __pyx_t_178;
  Py_ssize_t __pyx_t_179;
  Py_ssize_t __pyx_t_180;
  Py_ssize_t __pyx_t_181;
  Py_ssize_t __pyx_t_182;
  Py_ssize_t __pyx_t_183;
  Py_ssize_t __pyx_t_184;
  Py_ssize_t __pyx_t_185;
  Py_ssize_t __pyx_t_186;
  Py_ssize_t __pyx_t_187;
  Py_ssize_t __pyx_t_188;
  Py_ssize_t __pyx_t_189;
  PyObject *__pyx_t_190 = NULL;
  PyObject *__pyx_t_191 = NULL;
  PyObject *__pyx_t_192 = NULL;
  PyObject *__pyx_t_193 = NULL;
  __Pyx_RefNannySetupContext("Calc_LOS_PInOut_Lin", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_EpsPlane = __pyx_optional_args->EpsPlane;
    }
  }
  __pyx_pybuffer_SIn_.pybuffer.buf = NULL;
  __pyx_pybuffer_SIn_.refcount = 0;
  __pyx_pybuffernd_SIn_.data = NULL;
  __pyx_pybuffernd_SIn_.rcbuffer = &__pyx_pybuffer_SIn_;
  __pyx_pybuffer_SOut_.pybuffer.buf = NULL;
  __pyx_pybuffer_SOut_.refcount = 0;
  __pyx_pybuffernd_SOut_.data = NULL;
  __pyx_pybuffernd_SOut_.rcbuffer = &__pyx_pybuffer_SOut_;
  __pyx_pybuffer_VPerp_In.pybuffer.buf = NULL;
  __pyx_pybuffer_VPerp_In.refcount = 0;
  __pyx_pybuffernd_VPerp_In.data = NULL;
  __pyx_pybuffernd_VPerp_In.rcbuffer = &__pyx_pybuffer_VPerp_In;
  __pyx_pybuffer_VPerp_Out.pybuffer.buf = NULL;
  __pyx_pybuffer_VPerp_Out.refcount = 0;
  __pyx_pybuffernd_VPerp_Out.data = NULL;
  __pyx_pybuffernd_VPerp_Out.rcbuffer = &__pyx_pybuffer_VPerp_Out;
  __pyx_pybuffer_indIn_.pybuffer.buf = NULL;
  __pyx_pybuffer_indIn_.refcount = 0;
  __pyx_pybuffernd_indIn_.data = NULL;
  __pyx_pybuffernd_indIn_.rcbuffer = &__pyx_pybuffer_indIn_;
  __pyx_pybuffer_indOut_.pybuffer.buf = NULL;
  __pyx_pybuffer_indOut_.refcount = 0;
  __pyx_pybuffernd_indOut_.data = NULL;
  __pyx_pybuffernd_indOut_.rcbuffer = &__pyx_pybuffer_indOut_;

  /* "tofu/geom/_GG03.pyx":1937
 * cdef Calc_LOS_PInOut_Lin(double[:,::1] Ds, double [:,::1] us, double[:,::1] VPoly, double[:,::1] VIn, Lim, double EpsPlane=1.e-9):
 * 
 *     cdef int ii=0, jj=0, Nl=Ds.shape[1], Ns=VIn.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double kin, kout, scauVin, q, X, sca, L0=<double>Lim[0], L1=<double>Lim[1]
 *     cdef int indin=0, indout=0, Done=0
 */
  __pyx_v_ii = 0;
  __pyx_v_jj = 0;
  __pyx_v_Nl = (__pyx_v_Ds.shape[1]);
  __pyx_v_Ns = (__pyx_v_VIn.shape[1]);

  /* "tofu/geom/_GG03.pyx":1938
 * 
 *     cdef int ii=0, jj=0, Nl=Ds.shape[1], Ns=VIn.shape[1]
 *     cdef double kin, kout, scauVin, q, X, sca, L0=<double>Lim[0], L1=<double>Lim[1]             # <<<<<<<<<<<<<<
 *     cdef int indin=0, indout=0, Done=0
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))
 */
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_Lim, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_L0 = ((double)__pyx_t_2);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_Lim, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_L1 = ((double)__pyx_t_2);

  /* "tofu/geom/_GG03.pyx":1939
 *     cdef int ii=0, jj=0, Nl=Ds.shape[1], Ns=VIn.shape[1]
 *     cdef double kin, kout, scauVin, q, X, sca, L0=<double>Lim[0], L1=<double>Lim[1]
 *     cdef int indin=0, indout=0, Done=0             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))
 */
  __pyx_v_indin = 0;
  __pyx_v_indout = 0;
  __pyx_v_Done = 0;

  /* "tofu/geom/_GG03.pyx":1940
 *     cdef double kin, kout, scauVin, q, X, sca, L0=<double>Lim[0], L1=<double>Lim[1]
 *     cdef int indin=0, indout=0, Done=0
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1940, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1940, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SIn_.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_SIn_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1940, __pyx_L1_error)
    } else {__pyx_pybuffernd_SIn_.diminfo[0].strides = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SIn_.diminfo[0].shape = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SIn_.diminfo[1].strides = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SIn_.diminfo[1].shape = __pyx_pybuffernd_SIn_.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_SIn_ = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_nan); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ones); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_6};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1940, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_SOut_.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_SOut_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1940, __pyx_L1_error)
    } else {__pyx_pybuffernd_SOut_.diminfo[0].strides = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_SOut_.diminfo[0].shape = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_SOut_.diminfo[1].strides = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_SOut_.diminfo[1].shape = __pyx_pybuffernd_SOut_.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_SOut_ = ((PyArrayObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "tofu/geom/_GG03.pyx":1941
 *     cdef int indin=0, indout=0, Done=0
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))
 * 
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_nan); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_6};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1941, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_4);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_VPerp_In = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1941, __pyx_L1_error)
    } else {__pyx_pybuffernd_VPerp_In.diminfo[0].strides = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPerp_In.diminfo[0].shape = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPerp_In.diminfo[1].strides = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPerp_In.diminfo[1].shape = __pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_VPerp_In = ((PyArrayObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_nan); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1941, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1941, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_3);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_VPerp_Out = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1941, __pyx_L1_error)
    } else {__pyx_pybuffernd_VPerp_Out.diminfo[0].strides = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_VPerp_Out.diminfo[0].shape = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_VPerp_Out.diminfo[1].strides = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_VPerp_Out.diminfo[1].shape = __pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_VPerp_Out = ((PyArrayObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":1942
 *     cdef cnp.ndarray[double,ndim=2] SIn_=np.nan*np.ones((3,Nl)), SOut_=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=2] VPerp_In=np.nan*np.ones((3,Nl)), VPerp_Out=np.nan*np.ones((3,Nl))
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))             # <<<<<<<<<<<<<<
 * 
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_nan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_ones); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1942, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indIn_.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_indIn_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indIn_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1942, __pyx_L1_error)
    } else {__pyx_pybuffernd_indIn_.diminfo[0].strides = __pyx_pybuffernd_indIn_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indIn_.diminfo[0].shape = __pyx_pybuffernd_indIn_.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_indIn_ = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_nan); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_ones); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_Nl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1942, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 1942, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_5);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_indOut_.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_indOut_ = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_indOut_.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 1942, __pyx_L1_error)
    } else {__pyx_pybuffernd_indOut_.diminfo[0].strides = __pyx_pybuffernd_indOut_.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_indOut_.diminfo[0].shape = __pyx_pybuffernd_indOut_.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_indOut_ = ((PyArrayObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "tofu/geom/_GG03.pyx":1944
 *     cdef cnp.ndarray[double,ndim=1] indIn_=np.nan*np.ones((Nl,)), indOut_=np.nan*np.ones((Nl,))
 * 
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out             # <<<<<<<<<<<<<<
 *     cdef double[::1] indIn=indIn_, indOut=indOut_
 * 
 */
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_SIn_));
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1944, __pyx_L1_error)
  __pyx_v_SIn = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_SOut_));
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1944, __pyx_L1_error)
  __pyx_v_SOut = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VPerp_In));
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1944, __pyx_L1_error)
  __pyx_v_VPerpIn = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;
  __pyx_t_11 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(((PyObject *)__pyx_v_VPerp_Out));
  if (unlikely(!__pyx_t_11.memview)) __PYX_ERR(0, 1944, __pyx_L1_error)
  __pyx_v_VPerpOut = __pyx_t_11;
  __pyx_t_11.memview = NULL;
  __pyx_t_11.data = NULL;

  /* "tofu/geom/_GG03.pyx":1945
 * 
 *     cdef double[:,::1] SIn=SIn_, SOut=SOut_, VPerpIn=VPerp_In, VPerpOut=VPerp_Out
 *     cdef double[::1] indIn=indIn_, indOut=indOut_             # <<<<<<<<<<<<<<
 * 
 *     for ii in range(0,Nl):
 */
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_indIn_));
  if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __pyx_v_indIn = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;
  __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dc_double(((PyObject *)__pyx_v_indOut_));
  if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 1945, __pyx_L1_error)
  __pyx_v_indOut = __pyx_t_12;
  __pyx_t_12.memview = NULL;
  __pyx_t_12.data = NULL;

  /* "tofu/geom/_GG03.pyx":1947
 *     cdef double[::1] indIn=indIn_, indOut=indOut_
 * 
 *     for ii in range(0,Nl):             # <<<<<<<<<<<<<<
 * 
 *         kout, kin, Done = 1.e12, 1e12, 0
 */
  __pyx_t_13 = __pyx_v_Nl;
  for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
    __pyx_v_ii = __pyx_t_14;

    /* "tofu/geom/_GG03.pyx":1949
 *     for ii in range(0,Nl):
 * 
 *         kout, kin, Done = 1.e12, 1e12, 0             # <<<<<<<<<<<<<<
 *         # For cylinder
 *         for jj in range(0,Ns):
 */
    __pyx_t_2 = 1.e12;
    __pyx_t_15 = 1e12;
    __pyx_t_16 = 0;
    __pyx_v_kout = __pyx_t_2;
    __pyx_v_kin = __pyx_t_15;
    __pyx_v_Done = __pyx_t_16;

    /* "tofu/geom/_GG03.pyx":1951
 *         kout, kin, Done = 1.e12, 1e12, 0
 *         # For cylinder
 *         for jj in range(0,Ns):             # <<<<<<<<<<<<<<
 *             scauVin = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *             # Only if plane not parallel to line
 */
    __pyx_t_16 = __pyx_v_Ns;
    for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) {
      __pyx_v_jj = __pyx_t_17;

      /* "tofu/geom/_GG03.pyx":1952
 *         # For cylinder
 *         for jj in range(0,Ns):
 *             scauVin = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]             # <<<<<<<<<<<<<<
 *             # Only if plane not parallel to line
 *             if Cabs(scauVin)>EpsPlane:
 */
      __pyx_t_18 = 1;
      __pyx_t_19 = __pyx_v_ii;
      __pyx_t_20 = 0;
      __pyx_t_21 = __pyx_v_jj;
      __pyx_t_22 = 2;
      __pyx_t_23 = __pyx_v_ii;
      __pyx_t_24 = 1;
      __pyx_t_25 = __pyx_v_jj;
      __pyx_v_scauVin = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_18 * __pyx_v_us.strides[0]) )) + __pyx_t_19)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_20 * __pyx_v_VIn.strides[0]) )) + __pyx_t_21)) )))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_22 * __pyx_v_us.strides[0]) )) + __pyx_t_23)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_24 * __pyx_v_VIn.strides[0]) )) + __pyx_t_25)) )))));

      /* "tofu/geom/_GG03.pyx":1954
 *             scauVin = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *             # Only if plane not parallel to line
 *             if Cabs(scauVin)>EpsPlane:             # <<<<<<<<<<<<<<
 *                 k = -((Ds[1,ii]-VPoly[0,jj])*VIn[0,jj] + (Ds[2,ii]-VPoly[1,jj])*VIn[1,jj])/scauVin
 *                 # Only if on good side of semi-line
 */
      __pyx_t_26 = ((fabs(__pyx_v_scauVin) > __pyx_v_EpsPlane) != 0);
      if (__pyx_t_26) {

        /* "tofu/geom/_GG03.pyx":1955
 *             # Only if plane not parallel to line
 *             if Cabs(scauVin)>EpsPlane:
 *                 k = -((Ds[1,ii]-VPoly[0,jj])*VIn[0,jj] + (Ds[2,ii]-VPoly[1,jj])*VIn[1,jj])/scauVin             # <<<<<<<<<<<<<<
 *                 # Only if on good side of semi-line
 *                 if k>=0.:
 */
        __pyx_t_27 = 1;
        __pyx_t_28 = __pyx_v_ii;
        __pyx_t_29 = 0;
        __pyx_t_30 = __pyx_v_jj;
        __pyx_t_31 = 0;
        __pyx_t_32 = __pyx_v_jj;
        __pyx_t_33 = 2;
        __pyx_t_34 = __pyx_v_ii;
        __pyx_t_35 = 1;
        __pyx_t_36 = __pyx_v_jj;
        __pyx_t_37 = 1;
        __pyx_t_38 = __pyx_v_jj;
        __pyx_t_5 = PyFloat_FromDouble(((-((((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_27 * __pyx_v_Ds.strides[0]) )) + __pyx_t_28)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_29 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_30)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_31 * __pyx_v_VIn.strides[0]) )) + __pyx_t_32)) )))) + (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_33 * __pyx_v_Ds.strides[0]) )) + __pyx_t_34)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_35 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_36)) )))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_37 * __pyx_v_VIn.strides[0]) )) + __pyx_t_38)) )))))) / __pyx_v_scauVin)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1955, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "tofu/geom/_GG03.pyx":1957
 *                 k = -((Ds[1,ii]-VPoly[0,jj])*VIn[0,jj] + (Ds[2,ii]-VPoly[1,jj])*VIn[1,jj])/scauVin
 *                 # Only if on good side of semi-line
 *                 if k>=0.:             # <<<<<<<<<<<<<<
 *                     V1, V2 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]
 *                     q = ((Ds[1,ii] + k*us[1,ii]-VPoly[0,jj])*V1 + (Ds[2,ii] + k*us[2,ii]-VPoly[1,jj])*V2)/(V1**2+V2**2)
 */
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_k, __pyx_float_0_, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1957, __pyx_L1_error)
        __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 1957, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (__pyx_t_26) {

          /* "tofu/geom/_GG03.pyx":1958
 *                 # Only if on good side of semi-line
 *                 if k>=0.:
 *                     V1, V2 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]             # <<<<<<<<<<<<<<
 *                     q = ((Ds[1,ii] + k*us[1,ii]-VPoly[0,jj])*V1 + (Ds[2,ii] + k*us[2,ii]-VPoly[1,jj])*V2)/(V1**2+V2**2)
 *                     # Only of on the fraction of plane
 */
          __pyx_t_39 = 0;
          __pyx_t_40 = (__pyx_v_jj + 1);
          __pyx_t_41 = 0;
          __pyx_t_42 = __pyx_v_jj;
          __pyx_t_5 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_39 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_40)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_41 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_42)) ))))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1958, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_43 = 1;
          __pyx_t_44 = (__pyx_v_jj + 1);
          __pyx_t_45 = 1;
          __pyx_t_46 = __pyx_v_jj;
          __pyx_t_1 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_43 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_44)) ))) - (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_45 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_46)) ))))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1958, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_XDECREF_SET(__pyx_v_V1, __pyx_t_5);
          __pyx_t_5 = 0;
          __Pyx_XDECREF_SET(__pyx_v_V2, __pyx_t_1);
          __pyx_t_1 = 0;

          /* "tofu/geom/_GG03.pyx":1959
 *                 if k>=0.:
 *                     V1, V2 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]
 *                     q = ((Ds[1,ii] + k*us[1,ii]-VPoly[0,jj])*V1 + (Ds[2,ii] + k*us[2,ii]-VPoly[1,jj])*V2)/(V1**2+V2**2)             # <<<<<<<<<<<<<<
 *                     # Only of on the fraction of plane
 *                     if q>=0. and q<1.:
 */
          __pyx_t_47 = 1;
          __pyx_t_48 = __pyx_v_ii;
          __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_47 * __pyx_v_Ds.strides[0]) )) + __pyx_t_48)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_49 = 1;
          __pyx_t_50 = __pyx_v_ii;
          __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_49 * __pyx_v_us.strides[0]) )) + __pyx_t_50)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_3 = PyNumber_Multiply(__pyx_v_k, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_51 = 0;
          __pyx_t_52 = __pyx_v_jj;
          __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_51 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_52)) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_V1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_53 = 2;
          __pyx_t_54 = __pyx_v_ii;
          __pyx_t_1 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_53 * __pyx_v_Ds.strides[0]) )) + __pyx_t_54)) )))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_55 = 2;
          __pyx_t_56 = __pyx_v_ii;
          __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_55 * __pyx_v_us.strides[0]) )) + __pyx_t_56)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __pyx_t_7 = PyNumber_Multiply(__pyx_v_k, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = PyNumber_Add(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_57 = 1;
          __pyx_t_58 = __pyx_v_jj;
          __pyx_t_7 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPoly.data + __pyx_t_57 * __pyx_v_VPoly.strides[0]) )) + __pyx_t_58)) )))); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyNumber_Multiply(__pyx_t_1, __pyx_v_V2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyNumber_Power(__pyx_v_V1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_3 = PyNumber_Power(__pyx_v_V2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1959, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_v_q = __pyx_t_15;

          /* "tofu/geom/_GG03.pyx":1961
 *                     q = ((Ds[1,ii] + k*us[1,ii]-VPoly[0,jj])*V1 + (Ds[2,ii] + k*us[2,ii]-VPoly[1,jj])*V2)/(V1**2+V2**2)
 *                     # Only of on the fraction of plane
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         X = Ds[0,ii] + k*us[0,ii]
 *                         # Only if within limits
 */
          __pyx_t_59 = ((__pyx_v_q >= 0.) != 0);
          if (__pyx_t_59) {
          } else {
            __pyx_t_26 = __pyx_t_59;
            goto __pyx_L10_bool_binop_done;
          }
          __pyx_t_59 = ((__pyx_v_q < 1.) != 0);
          __pyx_t_26 = __pyx_t_59;
          __pyx_L10_bool_binop_done:;
          if (__pyx_t_26) {

            /* "tofu/geom/_GG03.pyx":1962
 *                     # Only of on the fraction of plane
 *                     if q>=0. and q<1.:
 *                         X = Ds[0,ii] + k*us[0,ii]             # <<<<<<<<<<<<<<
 *                         # Only if within limits
 *                         if X>=L0 and X<=L1:
 */
            __pyx_t_60 = 0;
            __pyx_t_61 = __pyx_v_ii;
            __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_60 * __pyx_v_Ds.strides[0]) )) + __pyx_t_61)) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1962, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_62 = 0;
            __pyx_t_63 = __pyx_v_ii;
            __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_62 * __pyx_v_us.strides[0]) )) + __pyx_t_63)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1962, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_1 = PyNumber_Multiply(__pyx_v_k, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1962, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1962, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1962, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __pyx_v_X = __pyx_t_15;

            /* "tofu/geom/_GG03.pyx":1964
 *                         X = Ds[0,ii] + k*us[0,ii]
 *                         # Only if within limits
 *                         if X>=L0 and X<=L1:             # <<<<<<<<<<<<<<
 *                             sca = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *                             # Only if new
 */
            __pyx_t_59 = ((__pyx_v_X >= __pyx_v_L0) != 0);
            if (__pyx_t_59) {
            } else {
              __pyx_t_26 = __pyx_t_59;
              goto __pyx_L13_bool_binop_done;
            }
            __pyx_t_59 = ((__pyx_v_X <= __pyx_v_L1) != 0);
            __pyx_t_26 = __pyx_t_59;
            __pyx_L13_bool_binop_done:;
            if (__pyx_t_26) {

              /* "tofu/geom/_GG03.pyx":1965
 *                         # Only if within limits
 *                         if X>=L0 and X<=L1:
 *                             sca = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]             # <<<<<<<<<<<<<<
 *                             # Only if new
 *                             if sca<=0 and k<kout:
 */
              __pyx_t_64 = 1;
              __pyx_t_65 = __pyx_v_ii;
              __pyx_t_66 = 0;
              __pyx_t_67 = __pyx_v_jj;
              __pyx_t_68 = 2;
              __pyx_t_69 = __pyx_v_ii;
              __pyx_t_70 = 1;
              __pyx_t_71 = __pyx_v_jj;
              __pyx_v_sca = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_64 * __pyx_v_us.strides[0]) )) + __pyx_t_65)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_66 * __pyx_v_VIn.strides[0]) )) + __pyx_t_67)) )))) + ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_68 * __pyx_v_us.strides[0]) )) + __pyx_t_69)) ))) * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_70 * __pyx_v_VIn.strides[0]) )) + __pyx_t_71)) )))));

              /* "tofu/geom/_GG03.pyx":1967
 *                             sca = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *                             # Only if new
 *                             if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                 kout = k
 *                                 indout = jj
 */
              __pyx_t_59 = ((__pyx_v_sca <= 0.0) != 0);
              if (__pyx_t_59) {
              } else {
                __pyx_t_26 = __pyx_t_59;
                goto __pyx_L16_bool_binop_done;
              }
              __pyx_t_5 = PyFloat_FromDouble(__pyx_v_kout); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1967, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_5);
              __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1967, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __pyx_t_59 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_59 < 0)) __PYX_ERR(0, 1967, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __pyx_t_26 = __pyx_t_59;
              __pyx_L16_bool_binop_done:;
              if (__pyx_t_26) {

                /* "tofu/geom/_GG03.pyx":1968
 *                             # Only if new
 *                             if sca<=0 and k<kout:
 *                                 kout = k             # <<<<<<<<<<<<<<
 *                                 indout = jj
 *                                 Done = 1
 */
                __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_k); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1968, __pyx_L1_error)
                __pyx_v_kout = __pyx_t_15;

                /* "tofu/geom/_GG03.pyx":1969
 *                             if sca<=0 and k<kout:
 *                                 kout = k
 *                                 indout = jj             # <<<<<<<<<<<<<<
 *                                 Done = 1
 *                             elif sca>=0 and k<min(kin,kout):
 */
                __pyx_v_indout = __pyx_v_jj;

                /* "tofu/geom/_GG03.pyx":1970
 *                                 kout = k
 *                                 indout = jj
 *                                 Done = 1             # <<<<<<<<<<<<<<
 *                             elif sca>=0 and k<min(kin,kout):
 *                                 kin = k
 */
                __pyx_v_Done = 1;

                /* "tofu/geom/_GG03.pyx":1967
 *                             sca = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *                             # Only if new
 *                             if sca<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                                 kout = k
 *                                 indout = jj
 */
                goto __pyx_L15;
              }

              /* "tofu/geom/_GG03.pyx":1971
 *                                 indout = jj
 *                                 Done = 1
 *                             elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                 kin = k
 *                                 indin = jj
 */
              __pyx_t_59 = ((__pyx_v_sca >= 0.0) != 0);
              if (__pyx_t_59) {
              } else {
                __pyx_t_26 = __pyx_t_59;
                goto __pyx_L18_bool_binop_done;
              }
              __pyx_t_15 = __pyx_v_kout;
              __pyx_t_2 = __pyx_v_kin;
              if (((__pyx_t_15 < __pyx_t_2) != 0)) {
                __pyx_t_72 = __pyx_t_15;
              } else {
                __pyx_t_72 = __pyx_t_2;
              }
              __pyx_t_1 = PyFloat_FromDouble(__pyx_t_72); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1971, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_1);
              __pyx_t_5 = PyObject_RichCompare(__pyx_v_k, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1971, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
              __pyx_t_59 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_59 < 0)) __PYX_ERR(0, 1971, __pyx_L1_error)
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              __pyx_t_26 = __pyx_t_59;
              __pyx_L18_bool_binop_done:;
              if (__pyx_t_26) {

                /* "tofu/geom/_GG03.pyx":1972
 *                                 Done = 1
 *                             elif sca>=0 and k<min(kin,kout):
 *                                 kin = k             # <<<<<<<<<<<<<<
 *                                 indin = jj
 * 
 */
                __pyx_t_72 = __pyx_PyFloat_AsDouble(__pyx_v_k); if (unlikely((__pyx_t_72 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1972, __pyx_L1_error)
                __pyx_v_kin = __pyx_t_72;

                /* "tofu/geom/_GG03.pyx":1973
 *                             elif sca>=0 and k<min(kin,kout):
 *                                 kin = k
 *                                 indin = jj             # <<<<<<<<<<<<<<
 * 
 *         # For two faces
 */
                __pyx_v_indin = __pyx_v_jj;

                /* "tofu/geom/_GG03.pyx":1971
 *                                 indout = jj
 *                                 Done = 1
 *                             elif sca>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                                 kin = k
 *                                 indin = jj
 */
              }
              __pyx_L15:;

              /* "tofu/geom/_GG03.pyx":1964
 *                         X = Ds[0,ii] + k*us[0,ii]
 *                         # Only if within limits
 *                         if X>=L0 and X<=L1:             # <<<<<<<<<<<<<<
 *                             sca = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *                             # Only if new
 */
            }

            /* "tofu/geom/_GG03.pyx":1961
 *                     q = ((Ds[1,ii] + k*us[1,ii]-VPoly[0,jj])*V1 + (Ds[2,ii] + k*us[2,ii]-VPoly[1,jj])*V2)/(V1**2+V2**2)
 *                     # Only of on the fraction of plane
 *                     if q>=0. and q<1.:             # <<<<<<<<<<<<<<
 *                         X = Ds[0,ii] + k*us[0,ii]
 *                         # Only if within limits
 */
          }

          /* "tofu/geom/_GG03.pyx":1957
 *                 k = -((Ds[1,ii]-VPoly[0,jj])*VIn[0,jj] + (Ds[2,ii]-VPoly[1,jj])*VIn[1,jj])/scauVin
 *                 # Only if on good side of semi-line
 *                 if k>=0.:             # <<<<<<<<<<<<<<
 *                     V1, V2 = VPoly[0,jj+1]-VPoly[0,jj], VPoly[1,jj+1]-VPoly[1,jj]
 *                     q = ((Ds[1,ii] + k*us[1,ii]-VPoly[0,jj])*V1 + (Ds[2,ii] + k*us[2,ii]-VPoly[1,jj])*V2)/(V1**2+V2**2)
 */
        }

        /* "tofu/geom/_GG03.pyx":1954
 *             scauVin = us[1,ii]*VIn[0,jj] + us[2,ii]*VIn[1,jj]
 *             # Only if plane not parallel to line
 *             if Cabs(scauVin)>EpsPlane:             # <<<<<<<<<<<<<<
 *                 k = -((Ds[1,ii]-VPoly[0,jj])*VIn[0,jj] + (Ds[2,ii]-VPoly[1,jj])*VIn[1,jj])/scauVin
 *                 # Only if on good side of semi-line
 */
      }
    }

    /* "tofu/geom/_GG03.pyx":1977
 *         # For two faces
 *         # Only if plane not parallel to line
 *         if Cabs(us[0,ii])>EpsPlane:             # <<<<<<<<<<<<<<
 *             # First face
 *             k = -(Ds[0,ii]-L0)/us[0,ii]
 */
    __pyx_t_73 = 0;
    __pyx_t_74 = __pyx_v_ii;
    __pyx_t_26 = ((fabs((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_73 * __pyx_v_us.strides[0]) )) + __pyx_t_74)) )))) > __pyx_v_EpsPlane) != 0);
    if (__pyx_t_26) {

      /* "tofu/geom/_GG03.pyx":1979
 *         if Cabs(us[0,ii])>EpsPlane:
 *             # First face
 *             k = -(Ds[0,ii]-L0)/us[0,ii]             # <<<<<<<<<<<<<<
 *             # Only if on good side of semi-line
 *             if k>=0.:
 */
      __pyx_t_75 = 0;
      __pyx_t_76 = __pyx_v_ii;
      __pyx_t_77 = 0;
      __pyx_t_78 = __pyx_v_ii;
      __pyx_t_5 = PyFloat_FromDouble(((-((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_75 * __pyx_v_Ds.strides[0]) )) + __pyx_t_76)) ))) - __pyx_v_L0)) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_77 * __pyx_v_us.strides[0]) )) + __pyx_t_78)) ))))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1979, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "tofu/geom/_GG03.pyx":1981
 *             k = -(Ds[0,ii]-L0)/us[0,ii]
 *             # Only if on good side of semi-line
 *             if k>=0.:             # <<<<<<<<<<<<<<
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_k, __pyx_float_0_, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1981, __pyx_L1_error)
      __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 1981, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_26) {

        /* "tofu/geom/_GG03.pyx":1983
 *             if k>=0.:
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                     if us[0,ii]<=0 and k<kout:
 *                         kout = k
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_79 = __pyx_v_VPoly;
        __PYX_INC_MEMVIEW(&__pyx_t_79, 1);
        if (unlikely(__pyx_memslice_transpose(&__pyx_t_79) == 0)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_t_79, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __PYX_XDEC_MEMVIEW(&__pyx_t_79, 1);
        __pyx_t_79.memview = NULL;
        __pyx_t_79.data = NULL;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
          }
        }
        if (!__pyx_t_7) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3};
            __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
            PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3};
            __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else
          #endif
          {
            __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1983, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
            __Pyx_GIVEREF(__pyx_t_3);
            PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
            __pyx_t_3 = 0;
            __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_5);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_contains_point); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_80 = 1;
        __pyx_t_81 = __pyx_v_ii;
        __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_80 * __pyx_v_Ds.strides[0]) )) + __pyx_t_81)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_82 = 1;
        __pyx_t_83 = __pyx_v_ii;
        __pyx_t_6 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_82 * __pyx_v_us.strides[0]) )) + __pyx_t_83)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = PyNumber_Multiply(__pyx_v_k, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_84 = 2;
        __pyx_t_85 = __pyx_v_ii;
        __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_84 * __pyx_v_Ds.strides[0]) )) + __pyx_t_85)) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_86 = 2;
        __pyx_t_87 = __pyx_v_ii;
        __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_86 * __pyx_v_us.strides[0]) )) + __pyx_t_87)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = PyNumber_Multiply(__pyx_v_k, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_6);
        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5);
        PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
        __pyx_t_6 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1983, __pyx_L1_error)
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 1983, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_26) {

          /* "tofu/geom/_GG03.pyx":1984
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 *                     if us[0,ii]<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                         kout = k
 *                         indout = -1
 */
          __pyx_t_88 = 0;
          __pyx_t_89 = __pyx_v_ii;
          __pyx_t_59 = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_88 * __pyx_v_us.strides[0]) )) + __pyx_t_89)) ))) <= 0.0) != 0);
          if (__pyx_t_59) {
          } else {
            __pyx_t_26 = __pyx_t_59;
            goto __pyx_L24_bool_binop_done;
          }
          __pyx_t_6 = PyFloat_FromDouble(__pyx_v_kout); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1984, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_7 = PyObject_RichCompare(__pyx_v_k, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1984, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_59 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_59 < 0)) __PYX_ERR(0, 1984, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_26 = __pyx_t_59;
          __pyx_L24_bool_binop_done:;
          if (__pyx_t_26) {

            /* "tofu/geom/_GG03.pyx":1985
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 *                     if us[0,ii]<=0 and k<kout:
 *                         kout = k             # <<<<<<<<<<<<<<
 *                         indout = -1
 *                         Done = 1
 */
            __pyx_t_72 = __pyx_PyFloat_AsDouble(__pyx_v_k); if (unlikely((__pyx_t_72 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1985, __pyx_L1_error)
            __pyx_v_kout = __pyx_t_72;

            /* "tofu/geom/_GG03.pyx":1986
 *                     if us[0,ii]<=0 and k<kout:
 *                         kout = k
 *                         indout = -1             # <<<<<<<<<<<<<<
 *                         Done = 1
 *                     elif us[0,ii]>=0 and k<min(kin,kout):
 */
            __pyx_v_indout = -1;

            /* "tofu/geom/_GG03.pyx":1987
 *                         kout = k
 *                         indout = -1
 *                         Done = 1             # <<<<<<<<<<<<<<
 *                     elif us[0,ii]>=0 and k<min(kin,kout):
 *                         kin = k
 */
            __pyx_v_Done = 1;

            /* "tofu/geom/_GG03.pyx":1984
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 *                     if us[0,ii]<=0 and k<kout:             # <<<<<<<<<<<<<<
 *                         kout = k
 *                         indout = -1
 */
            goto __pyx_L23;
          }

          /* "tofu/geom/_GG03.pyx":1988
 *                         indout = -1
 *                         Done = 1
 *                     elif us[0,ii]>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                         kin = k
 *                         indin = -1
 */
          __pyx_t_90 = 0;
          __pyx_t_91 = __pyx_v_ii;
          __pyx_t_59 = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_90 * __pyx_v_us.strides[0]) )) + __pyx_t_91)) ))) >= 0.0) != 0);
          if (__pyx_t_59) {
          } else {
            __pyx_t_26 = __pyx_t_59;
            goto __pyx_L26_bool_binop_done;
          }
          __pyx_t_72 = __pyx_v_kout;
          __pyx_t_15 = __pyx_v_kin;
          if (((__pyx_t_72 < __pyx_t_15) != 0)) {
            __pyx_t_2 = __pyx_t_72;
          } else {
            __pyx_t_2 = __pyx_t_15;
          }
          __pyx_t_7 = PyFloat_FromDouble(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1988, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_6 = PyObject_RichCompare(__pyx_v_k, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1988, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_59 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_59 < 0)) __PYX_ERR(0, 1988, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_26 = __pyx_t_59;
          __pyx_L26_bool_binop_done:;
          if (__pyx_t_26) {

            /* "tofu/geom/_GG03.pyx":1989
 *                         Done = 1
 *                     elif us[0,ii]>=0 and k<min(kin,kout):
 *                         kin = k             # <<<<<<<<<<<<<<
 *                         indin = -1
 *             # Second face
 */
            __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_k); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1989, __pyx_L1_error)
            __pyx_v_kin = __pyx_t_2;

            /* "tofu/geom/_GG03.pyx":1990
 *                     elif us[0,ii]>=0 and k<min(kin,kout):
 *                         kin = k
 *                         indin = -1             # <<<<<<<<<<<<<<
 *             # Second face
 *             k = -(Ds[0,ii]-L1)/us[0,ii]
 */
            __pyx_v_indin = -1;

            /* "tofu/geom/_GG03.pyx":1988
 *                         indout = -1
 *                         Done = 1
 *                     elif us[0,ii]>=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                         kin = k
 *                         indin = -1
 */
          }
          __pyx_L23:;

          /* "tofu/geom/_GG03.pyx":1983
 *             if k>=0.:
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                     if us[0,ii]<=0 and k<kout:
 *                         kout = k
 */
        }

        /* "tofu/geom/_GG03.pyx":1981
 *             k = -(Ds[0,ii]-L0)/us[0,ii]
 *             # Only if on good side of semi-line
 *             if k>=0.:             # <<<<<<<<<<<<<<
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 */
      }

      /* "tofu/geom/_GG03.pyx":1992
 *                         indin = -1
 *             # Second face
 *             k = -(Ds[0,ii]-L1)/us[0,ii]             # <<<<<<<<<<<<<<
 *             # Only if on good side of semi-line
 *             if k>=0.:
 */
      __pyx_t_92 = 0;
      __pyx_t_93 = __pyx_v_ii;
      __pyx_t_94 = 0;
      __pyx_t_95 = __pyx_v_ii;
      __pyx_t_6 = PyFloat_FromDouble(((-((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_92 * __pyx_v_Ds.strides[0]) )) + __pyx_t_93)) ))) - __pyx_v_L1)) / (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_94 * __pyx_v_us.strides[0]) )) + __pyx_t_95)) ))))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1992, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "tofu/geom/_GG03.pyx":1994
 *             k = -(Ds[0,ii]-L1)/us[0,ii]
 *             # Only if on good side of semi-line
 *             if k>=0.:             # <<<<<<<<<<<<<<
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 */
      __pyx_t_6 = PyObject_RichCompare(__pyx_v_k, __pyx_float_0_, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1994, __pyx_L1_error)
      __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 1994, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_26) {

        /* "tofu/geom/_GG03.pyx":1996
 *             if k>=0.:
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                     if us[0,ii]>=0 and k<kout:
 *                         kout = k
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_Path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_79 = __pyx_v_VPoly;
        __PYX_INC_MEMVIEW(&__pyx_t_79, 1);
        if (unlikely(__pyx_memslice_transpose(&__pyx_t_79) == 0)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_t_79, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __PYX_XDEC_MEMVIEW(&__pyx_t_79, 1);
        __pyx_t_79.memview = NULL;
        __pyx_t_79.data = NULL;
        __pyx_t_1 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (!__pyx_t_1) {
          __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_6);
        } else {
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
            __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
            PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_5};
            __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          } else
          #endif
          {
            __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1996, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = NULL;
            __Pyx_GIVEREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_6);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          }
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_contains_point); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_96 = 1;
        __pyx_t_97 = __pyx_v_ii;
        __pyx_t_6 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_96 * __pyx_v_Ds.strides[0]) )) + __pyx_t_97)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_98 = 1;
        __pyx_t_99 = __pyx_v_ii;
        __pyx_t_3 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_98 * __pyx_v_us.strides[0]) )) + __pyx_t_99)) )))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = PyNumber_Multiply(__pyx_v_k, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_100 = 2;
        __pyx_t_101 = __pyx_v_ii;
        __pyx_t_5 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_100 * __pyx_v_Ds.strides[0]) )) + __pyx_t_101)) )))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_102 = 2;
        __pyx_t_103 = __pyx_v_ii;
        __pyx_t_6 = PyFloat_FromDouble((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_102 * __pyx_v_us.strides[0]) )) + __pyx_t_103)) )))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_1 = PyNumber_Multiply(__pyx_v_k, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_3);
        PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_6);
        PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_6);
        __pyx_t_3 = 0;
        __pyx_t_6 = 0;
        __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_transform, Py_None) < 0) __PYX_ERR(0, 1996, __pyx_L1_error)
        if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_radius, __pyx_float_0_0) < 0) __PYX_ERR(0, 1996, __pyx_L1_error)
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_26 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_26 < 0)) __PYX_ERR(0, 1996, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (__pyx_t_26) {

          /* "tofu/geom/_GG03.pyx":1997
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 *                     if us[0,ii]>=0 and k<kout:             # <<<<<<<<<<<<<<
 *                         kout = k
 *                         indout = -2
 */
          __pyx_t_104 = 0;
          __pyx_t_105 = __pyx_v_ii;
          __pyx_t_59 = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_104 * __pyx_v_us.strides[0]) )) + __pyx_t_105)) ))) >= 0.0) != 0);
          if (__pyx_t_59) {
          } else {
            __pyx_t_26 = __pyx_t_59;
            goto __pyx_L31_bool_binop_done;
          }
          __pyx_t_3 = PyFloat_FromDouble(__pyx_v_kout); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1997, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = PyObject_RichCompare(__pyx_v_k, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1997, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_59 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_59 < 0)) __PYX_ERR(0, 1997, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_26 = __pyx_t_59;
          __pyx_L31_bool_binop_done:;
          if (__pyx_t_26) {

            /* "tofu/geom/_GG03.pyx":1998
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 *                     if us[0,ii]>=0 and k<kout:
 *                         kout = k             # <<<<<<<<<<<<<<
 *                         indout = -2
 *                         Done = 1
 */
            __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_k); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1998, __pyx_L1_error)
            __pyx_v_kout = __pyx_t_2;

            /* "tofu/geom/_GG03.pyx":1999
 *                     if us[0,ii]>=0 and k<kout:
 *                         kout = k
 *                         indout = -2             # <<<<<<<<<<<<<<
 *                         Done = 1
 *                     elif us[0,ii]<=0 and k<min(kin,kout):
 */
            __pyx_v_indout = -2;

            /* "tofu/geom/_GG03.pyx":2000
 *                         kout = k
 *                         indout = -2
 *                         Done = 1             # <<<<<<<<<<<<<<
 *                     elif us[0,ii]<=0 and k<min(kin,kout):
 *                         kin = k
 */
            __pyx_v_Done = 1;

            /* "tofu/geom/_GG03.pyx":1997
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 *                     if us[0,ii]>=0 and k<kout:             # <<<<<<<<<<<<<<
 *                         kout = k
 *                         indout = -2
 */
            goto __pyx_L30;
          }

          /* "tofu/geom/_GG03.pyx":2001
 *                         indout = -2
 *                         Done = 1
 *                     elif us[0,ii]<=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                         kin = k
 *                         indin = -2
 */
          __pyx_t_106 = 0;
          __pyx_t_107 = __pyx_v_ii;
          __pyx_t_59 = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_106 * __pyx_v_us.strides[0]) )) + __pyx_t_107)) ))) <= 0.0) != 0);
          if (__pyx_t_59) {
          } else {
            __pyx_t_26 = __pyx_t_59;
            goto __pyx_L33_bool_binop_done;
          }
          __pyx_t_2 = __pyx_v_kout;
          __pyx_t_72 = __pyx_v_kin;
          if (((__pyx_t_2 < __pyx_t_72) != 0)) {
            __pyx_t_15 = __pyx_t_2;
          } else {
            __pyx_t_15 = __pyx_t_72;
          }
          __pyx_t_1 = PyFloat_FromDouble(__pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2001, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_1);
          __pyx_t_3 = PyObject_RichCompare(__pyx_v_k, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2001, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_59 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_59 < 0)) __PYX_ERR(0, 2001, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_26 = __pyx_t_59;
          __pyx_L33_bool_binop_done:;
          if (__pyx_t_26) {

            /* "tofu/geom/_GG03.pyx":2002
 *                         Done = 1
 *                     elif us[0,ii]<=0 and k<min(kin,kout):
 *                         kin = k             # <<<<<<<<<<<<<<
 *                         indin = -2
 * 
 */
            __pyx_t_15 = __pyx_PyFloat_AsDouble(__pyx_v_k); if (unlikely((__pyx_t_15 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2002, __pyx_L1_error)
            __pyx_v_kin = __pyx_t_15;

            /* "tofu/geom/_GG03.pyx":2003
 *                     elif us[0,ii]<=0 and k<min(kin,kout):
 *                         kin = k
 *                         indin = -2             # <<<<<<<<<<<<<<
 * 
 *         if Done==1:
 */
            __pyx_v_indin = -2;

            /* "tofu/geom/_GG03.pyx":2001
 *                         indout = -2
 *                         Done = 1
 *                     elif us[0,ii]<=0 and k<min(kin,kout):             # <<<<<<<<<<<<<<
 *                         kin = k
 *                         indin = -2
 */
          }
          __pyx_L30:;

          /* "tofu/geom/_GG03.pyx":1996
 *             if k>=0.:
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):             # <<<<<<<<<<<<<<
 *                     if us[0,ii]>=0 and k<kout:
 *                         kout = k
 */
        }

        /* "tofu/geom/_GG03.pyx":1994
 *             k = -(Ds[0,ii]-L1)/us[0,ii]
 *             # Only if on good side of semi-line
 *             if k>=0.:             # <<<<<<<<<<<<<<
 *                 # Only if inside VPoly
 *                 if Path(VPoly.T).contains_point([Ds[1,ii]+k*us[1,ii],Ds[2,ii]+k*us[2,ii]], transform=None, radius=0.0):
 */
      }

      /* "tofu/geom/_GG03.pyx":1977
 *         # For two faces
 *         # Only if plane not parallel to line
 *         if Cabs(us[0,ii])>EpsPlane:             # <<<<<<<<<<<<<<
 *             # First face
 *             k = -(Ds[0,ii]-L0)/us[0,ii]
 */
    }

    /* "tofu/geom/_GG03.pyx":2005
 *                         indin = -2
 * 
 *         if Done==1:             # <<<<<<<<<<<<<<
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 */
    __pyx_t_26 = ((__pyx_v_Done == 1) != 0);
    if (__pyx_t_26) {

      /* "tofu/geom/_GG03.pyx":2006
 * 
 *         if Done==1:
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]             # <<<<<<<<<<<<<<
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 */
      __pyx_t_108 = 0;
      __pyx_t_109 = __pyx_v_ii;
      __pyx_t_110 = 0;
      __pyx_t_111 = __pyx_v_ii;
      __pyx_t_112 = 0;
      __pyx_t_113 = __pyx_v_ii;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_112 * __pyx_v_SOut.strides[0]) )) + __pyx_t_113)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_108 * __pyx_v_Ds.strides[0]) )) + __pyx_t_109)) ))) + (__pyx_v_kout * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_110 * __pyx_v_us.strides[0]) )) + __pyx_t_111)) )))));

      /* "tofu/geom/_GG03.pyx":2007
 *         if Done==1:
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]             # <<<<<<<<<<<<<<
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]
 *             # To be finished
 */
      __pyx_t_114 = 1;
      __pyx_t_115 = __pyx_v_ii;
      __pyx_t_116 = 1;
      __pyx_t_117 = __pyx_v_ii;
      __pyx_t_118 = 1;
      __pyx_t_119 = __pyx_v_ii;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_118 * __pyx_v_SOut.strides[0]) )) + __pyx_t_119)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_114 * __pyx_v_Ds.strides[0]) )) + __pyx_t_115)) ))) + (__pyx_v_kout * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_116 * __pyx_v_us.strides[0]) )) + __pyx_t_117)) )))));

      /* "tofu/geom/_GG03.pyx":2008
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 *             SOut[2,ii] = Ds[2,ii] + kout*us[2,ii]             # <<<<<<<<<<<<<<
 *             # To be finished
 *             # phi = Catan2(SOut[1,ii],SOut[0,ii])
 */
      __pyx_t_120 = 2;
      __pyx_t_121 = __pyx_v_ii;
      __pyx_t_122 = 2;
      __pyx_t_123 = __pyx_v_ii;
      __pyx_t_124 = 2;
      __pyx_t_125 = __pyx_v_ii;
      *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SOut.data + __pyx_t_124 * __pyx_v_SOut.strides[0]) )) + __pyx_t_125)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_120 * __pyx_v_Ds.strides[0]) )) + __pyx_t_121)) ))) + (__pyx_v_kout * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_122 * __pyx_v_us.strides[0]) )) + __pyx_t_123)) )))));

      /* "tofu/geom/_GG03.pyx":2011
 *             # To be finished
 *             # phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = 1.
 *                 VPerpOut[1,ii] = 0.
 */
      switch (__pyx_v_indout) {
        case -1L:

        /* "tofu/geom/_GG03.pyx":2012
 *             # phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:
 *                 VPerpOut[0,ii] = 1.             # <<<<<<<<<<<<<<
 *                 VPerpOut[1,ii] = 0.
 *                 VPerpOut[2,ii] = 0.
 */
        __pyx_t_126 = 0;
        __pyx_t_127 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_126 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_127)) )) = 1.;

        /* "tofu/geom/_GG03.pyx":2013
 *             if indout==-1:
 *                 VPerpOut[0,ii] = 1.
 *                 VPerpOut[1,ii] = 0.             # <<<<<<<<<<<<<<
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:
 */
        __pyx_t_128 = 1;
        __pyx_t_129 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_128 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_129)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":2014
 *                 VPerpOut[0,ii] = 1.
 *                 VPerpOut[1,ii] = 0.
 *                 VPerpOut[2,ii] = 0.             # <<<<<<<<<<<<<<
 *             elif indout==-2:
 *                 VPerpOut[0,ii] = -1.
 */
        __pyx_t_130 = 2;
        __pyx_t_131 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_130 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_131)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":2011
 *             # To be finished
 *             # phi = Catan2(SOut[1,ii],SOut[0,ii])
 *             if indout==-1:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = 1.
 *                 VPerpOut[1,ii] = 0.
 */
        break;

        /* "tofu/geom/_GG03.pyx":2015
 *                 VPerpOut[1,ii] = 0.
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = -1.
 *                 VPerpOut[1,ii] = 0.
 */
        case -2L:

        /* "tofu/geom/_GG03.pyx":2016
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:
 *                 VPerpOut[0,ii] = -1.             # <<<<<<<<<<<<<<
 *                 VPerpOut[1,ii] = 0.
 *                 VPerpOut[2,ii] = 0.
 */
        __pyx_t_132 = 0;
        __pyx_t_133 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_132 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_133)) )) = -1.;

        /* "tofu/geom/_GG03.pyx":2017
 *             elif indout==-2:
 *                 VPerpOut[0,ii] = -1.
 *                 VPerpOut[1,ii] = 0.             # <<<<<<<<<<<<<<
 *                 VPerpOut[2,ii] = 0.
 *             else:
 */
        __pyx_t_134 = 1;
        __pyx_t_135 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_134 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_135)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":2018
 *                 VPerpOut[0,ii] = -1.
 *                 VPerpOut[1,ii] = 0.
 *                 VPerpOut[2,ii] = 0.             # <<<<<<<<<<<<<<
 *             else:
 *                 VPerpOut[0,ii] = 0.
 */
        __pyx_t_136 = 2;
        __pyx_t_137 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_136 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_137)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":2015
 *                 VPerpOut[1,ii] = 0.
 *                 VPerpOut[2,ii] = 0.
 *             elif indout==-2:             # <<<<<<<<<<<<<<
 *                 VPerpOut[0,ii] = -1.
 *                 VPerpOut[1,ii] = 0.
 */
        break;
        default:

        /* "tofu/geom/_GG03.pyx":2020
 *                 VPerpOut[2,ii] = 0.
 *             else:
 *                 VPerpOut[0,ii] = 0.             # <<<<<<<<<<<<<<
 *                 VPerpOut[1,ii] = VIn[0,indout]
 *                 VPerpOut[2,ii] = VIn[1,indout]
 */
        __pyx_t_138 = 0;
        __pyx_t_139 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_138 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_139)) )) = 0.;

        /* "tofu/geom/_GG03.pyx":2021
 *             else:
 *                 VPerpOut[0,ii] = 0.
 *                 VPerpOut[1,ii] = VIn[0,indout]             # <<<<<<<<<<<<<<
 *                 VPerpOut[2,ii] = VIn[1,indout]
 *             indOut[ii] = indout
 */
        __pyx_t_140 = 0;
        __pyx_t_141 = __pyx_v_indout;
        __pyx_t_142 = 1;
        __pyx_t_143 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_142 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_143)) )) = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_140 * __pyx_v_VIn.strides[0]) )) + __pyx_t_141)) )));

        /* "tofu/geom/_GG03.pyx":2022
 *                 VPerpOut[0,ii] = 0.
 *                 VPerpOut[1,ii] = VIn[0,indout]
 *                 VPerpOut[2,ii] = VIn[1,indout]             # <<<<<<<<<<<<<<
 *             indOut[ii] = indout
 *             if kin<kout:
 */
        __pyx_t_144 = 1;
        __pyx_t_145 = __pyx_v_indout;
        __pyx_t_146 = 2;
        __pyx_t_147 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpOut.data + __pyx_t_146 * __pyx_v_VPerpOut.strides[0]) )) + __pyx_t_147)) )) = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_144 * __pyx_v_VIn.strides[0]) )) + __pyx_t_145)) )));
        break;
      }

      /* "tofu/geom/_GG03.pyx":2023
 *                 VPerpOut[1,ii] = VIn[0,indout]
 *                 VPerpOut[2,ii] = VIn[1,indout]
 *             indOut[ii] = indout             # <<<<<<<<<<<<<<
 *             if kin<kout:
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 */
      __pyx_t_148 = __pyx_v_ii;
      *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_indOut.data) + __pyx_t_148)) )) = __pyx_v_indout;

      /* "tofu/geom/_GG03.pyx":2024
 *                 VPerpOut[2,ii] = VIn[1,indout]
 *             indOut[ii] = indout
 *             if kin<kout:             # <<<<<<<<<<<<<<
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 */
      __pyx_t_26 = ((__pyx_v_kin < __pyx_v_kout) != 0);
      if (__pyx_t_26) {

        /* "tofu/geom/_GG03.pyx":2025
 *             indOut[ii] = indout
 *             if kin<kout:
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]             # <<<<<<<<<<<<<<
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 */
        __pyx_t_149 = 0;
        __pyx_t_150 = __pyx_v_ii;
        __pyx_t_151 = 0;
        __pyx_t_152 = __pyx_v_ii;
        __pyx_t_153 = 0;
        __pyx_t_154 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_153 * __pyx_v_SIn.strides[0]) )) + __pyx_t_154)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_149 * __pyx_v_Ds.strides[0]) )) + __pyx_t_150)) ))) + (__pyx_v_kin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_151 * __pyx_v_us.strides[0]) )) + __pyx_t_152)) )))));

        /* "tofu/geom/_GG03.pyx":2026
 *             if kin<kout:
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]             # <<<<<<<<<<<<<<
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 if indin==-1:
 */
        __pyx_t_155 = 1;
        __pyx_t_156 = __pyx_v_ii;
        __pyx_t_157 = 1;
        __pyx_t_158 = __pyx_v_ii;
        __pyx_t_159 = 1;
        __pyx_t_160 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_159 * __pyx_v_SIn.strides[0]) )) + __pyx_t_160)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_155 * __pyx_v_Ds.strides[0]) )) + __pyx_t_156)) ))) + (__pyx_v_kin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_157 * __pyx_v_us.strides[0]) )) + __pyx_t_158)) )))));

        /* "tofu/geom/_GG03.pyx":2027
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]             # <<<<<<<<<<<<<<
 *                 if indin==-1:
 *                     VPerpIn[0,ii] = -1.
 */
        __pyx_t_161 = 2;
        __pyx_t_162 = __pyx_v_ii;
        __pyx_t_163 = 2;
        __pyx_t_164 = __pyx_v_ii;
        __pyx_t_165 = 2;
        __pyx_t_166 = __pyx_v_ii;
        *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_SIn.data + __pyx_t_165 * __pyx_v_SIn.strides[0]) )) + __pyx_t_166)) )) = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_161 * __pyx_v_Ds.strides[0]) )) + __pyx_t_162)) ))) + (__pyx_v_kin * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_163 * __pyx_v_us.strides[0]) )) + __pyx_t_164)) )))));

        /* "tofu/geom/_GG03.pyx":2028
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 if indin==-1:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = -1.
 *                     VPerpIn[1,ii] = 0.
 */
        switch (__pyx_v_indin) {
          case -1L:

          /* "tofu/geom/_GG03.pyx":2029
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 if indin==-1:
 *                     VPerpIn[0,ii] = -1.             # <<<<<<<<<<<<<<
 *                     VPerpIn[1,ii] = 0.
 *                     VPerpIn[2,ii] = 0.
 */
          __pyx_t_167 = 0;
          __pyx_t_168 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_167 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_168)) )) = -1.;

          /* "tofu/geom/_GG03.pyx":2030
 *                 if indin==-1:
 *                     VPerpIn[0,ii] = -1.
 *                     VPerpIn[1,ii] = 0.             # <<<<<<<<<<<<<<
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:
 */
          __pyx_t_169 = 1;
          __pyx_t_170 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_169 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_170)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":2031
 *                     VPerpIn[0,ii] = -1.
 *                     VPerpIn[1,ii] = 0.
 *                     VPerpIn[2,ii] = 0.             # <<<<<<<<<<<<<<
 *                 elif indin==-2:
 *                     VPerpIn[0,ii] = 1.
 */
          __pyx_t_171 = 2;
          __pyx_t_172 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_171 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_172)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":2028
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 *                 SIn[2,ii] = Ds[2,ii] + kin*us[2,ii]
 *                 if indin==-1:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = -1.
 *                     VPerpIn[1,ii] = 0.
 */
          break;

          /* "tofu/geom/_GG03.pyx":2032
 *                     VPerpIn[1,ii] = 0.
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = 1.
 *                     VPerpIn[1,ii] = 0.
 */
          case -2L:

          /* "tofu/geom/_GG03.pyx":2033
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:
 *                     VPerpIn[0,ii] = 1.             # <<<<<<<<<<<<<<
 *                     VPerpIn[1,ii] = 0.
 *                     VPerpIn[2,ii] = 0.
 */
          __pyx_t_173 = 0;
          __pyx_t_174 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_173 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_174)) )) = 1.;

          /* "tofu/geom/_GG03.pyx":2034
 *                 elif indin==-2:
 *                     VPerpIn[0,ii] = 1.
 *                     VPerpIn[1,ii] = 0.             # <<<<<<<<<<<<<<
 *                     VPerpIn[2,ii] = 0.
 *                 else:
 */
          __pyx_t_175 = 1;
          __pyx_t_176 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_175 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_176)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":2035
 *                     VPerpIn[0,ii] = 1.
 *                     VPerpIn[1,ii] = 0.
 *                     VPerpIn[2,ii] = 0.             # <<<<<<<<<<<<<<
 *                 else:
 *                     VPerpIn[0,ii] = 0.
 */
          __pyx_t_177 = 2;
          __pyx_t_178 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_177 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_178)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":2032
 *                     VPerpIn[1,ii] = 0.
 *                     VPerpIn[2,ii] = 0.
 *                 elif indin==-2:             # <<<<<<<<<<<<<<
 *                     VPerpIn[0,ii] = 1.
 *                     VPerpIn[1,ii] = 0.
 */
          break;
          default:

          /* "tofu/geom/_GG03.pyx":2037
 *                     VPerpIn[2,ii] = 0.
 *                 else:
 *                     VPerpIn[0,ii] = 0.             # <<<<<<<<<<<<<<
 *                     VPerpIn[1,ii] = -VIn[0,indin]
 *                     VPerpIn[2,ii] = -VIn[1,indin]
 */
          __pyx_t_179 = 0;
          __pyx_t_180 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_179 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_180)) )) = 0.;

          /* "tofu/geom/_GG03.pyx":2038
 *                 else:
 *                     VPerpIn[0,ii] = 0.
 *                     VPerpIn[1,ii] = -VIn[0,indin]             # <<<<<<<<<<<<<<
 *                     VPerpIn[2,ii] = -VIn[1,indin]
 *                 indIn[ii] = indin
 */
          __pyx_t_181 = 0;
          __pyx_t_182 = __pyx_v_indin;
          __pyx_t_183 = 1;
          __pyx_t_184 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_183 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_184)) )) = (-(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_181 * __pyx_v_VIn.strides[0]) )) + __pyx_t_182)) ))));

          /* "tofu/geom/_GG03.pyx":2039
 *                     VPerpIn[0,ii] = 0.
 *                     VPerpIn[1,ii] = -VIn[0,indin]
 *                     VPerpIn[2,ii] = -VIn[1,indin]             # <<<<<<<<<<<<<<
 *                 indIn[ii] = indin
 * 
 */
          __pyx_t_185 = 1;
          __pyx_t_186 = __pyx_v_indin;
          __pyx_t_187 = 2;
          __pyx_t_188 = __pyx_v_ii;
          *((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VPerpIn.data + __pyx_t_187 * __pyx_v_VPerpIn.strides[0]) )) + __pyx_t_188)) )) = (-(*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_VIn.data + __pyx_t_185 * __pyx_v_VIn.strides[0]) )) + __pyx_t_186)) ))));
          break;
        }

        /* "tofu/geom/_GG03.pyx":2040
 *                     VPerpIn[1,ii] = -VIn[0,indin]
 *                     VPerpIn[2,ii] = -VIn[1,indin]
 *                 indIn[ii] = indin             # <<<<<<<<<<<<<<
 * 
 *     return np.asarray(SIn), np.asarray(SOut), np.asarray(VPerpIn), np.asarray(VPerpOut), np.asarray(indIn), np.asarray(indOut)
 */
        __pyx_t_189 = __pyx_v_ii;
        *((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_indIn.data) + __pyx_t_189)) )) = __pyx_v_indin;

        /* "tofu/geom/_GG03.pyx":2024
 *                 VPerpOut[2,ii] = VIn[1,indout]
 *             indOut[ii] = indout
 *             if kin<kout:             # <<<<<<<<<<<<<<
 *                 SIn[0,ii] = Ds[0,ii] + kin*us[0,ii]
 *                 SIn[1,ii] = Ds[1,ii] + kin*us[1,ii]
 */
      }

      /* "tofu/geom/_GG03.pyx":2005
 *                         indin = -2
 * 
 *         if Done==1:             # <<<<<<<<<<<<<<
 *             SOut[0,ii] = Ds[0,ii] + kout*us[0,ii]
 *             SOut[1,ii] = Ds[1,ii] + kout*us[1,ii]
 */
    }
  }

  /* "tofu/geom/_GG03.pyx":2042
 *                 indIn[ii] = indin
 * 
 *     return np.asarray(SIn), np.asarray(SOut), np.asarray(VPerpIn), np.asarray(VPerpOut), np.asarray(indIn), np.asarray(indOut)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_asarray); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_SIn, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_1};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_asarray); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_SOut, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
      __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_asarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_VPerpIn, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_190 = PyTuple_New(1+1); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_190);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_190, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_190, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_190, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_190); __pyx_t_190 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_190 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_190);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_190, __pyx_n_s_asarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_190); __pyx_t_190 = 0;
  __pyx_t_190 = __pyx_memoryview_fromslice(__pyx_v_VPerpOut, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_190);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_190); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_190); __pyx_t_190 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_190};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_190); __pyx_t_190 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_190};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_190); __pyx_t_190 = 0;
    } else
    #endif
    {
      __pyx_t_191 = PyTuple_New(1+1); if (unlikely(!__pyx_t_191)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_191);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_191, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_190);
      PyTuple_SET_ITEM(__pyx_t_191, 0+1, __pyx_t_190);
      __pyx_t_190 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_191, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_191 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_191)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_191);
  __pyx_t_190 = __Pyx_PyObject_GetAttrStr(__pyx_t_191, __pyx_n_s_asarray); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_190);
  __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
  __pyx_t_191 = __pyx_memoryview_fromslice(__pyx_v_indIn, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_191)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_191);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_190))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_190);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_190);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_190, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_190, __pyx_t_191); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_190)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_191};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_190, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_190)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_191};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_190, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
    } else
    #endif
    {
      __pyx_t_192 = PyTuple_New(1+1); if (unlikely(!__pyx_t_192)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_192);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_192, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_191);
      PyTuple_SET_ITEM(__pyx_t_192, 0+1, __pyx_t_191);
      __pyx_t_191 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_190, __pyx_t_192, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_192); __pyx_t_192 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_190); __pyx_t_190 = 0;
  __pyx_t_192 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_192)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_192);
  __pyx_t_191 = __Pyx_PyObject_GetAttrStr(__pyx_t_192, __pyx_n_s_asarray); if (unlikely(!__pyx_t_191)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_191);
  __Pyx_DECREF(__pyx_t_192); __pyx_t_192 = 0;
  __pyx_t_192 = __pyx_memoryview_fromslice(__pyx_v_indOut, 1, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_192)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_192);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_191))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_191);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_191);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_191, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_190 = __Pyx_PyObject_CallOneArg(__pyx_t_191, __pyx_t_192); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_192); __pyx_t_192 = 0;
    __Pyx_GOTREF(__pyx_t_190);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_191)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_192};
      __pyx_t_190 = __Pyx_PyFunction_FastCall(__pyx_t_191, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_190);
      __Pyx_DECREF(__pyx_t_192); __pyx_t_192 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_191)) {
      PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_192};
      __pyx_t_190 = __Pyx_PyCFunction_FastCall(__pyx_t_191, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GOTREF(__pyx_t_190);
      __Pyx_DECREF(__pyx_t_192); __pyx_t_192 = 0;
    } else
    #endif
    {
      __pyx_t_193 = PyTuple_New(1+1); if (unlikely(!__pyx_t_193)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_193);
      __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_193, 0, __pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_GIVEREF(__pyx_t_192);
      PyTuple_SET_ITEM(__pyx_t_193, 0+1, __pyx_t_192);
      __pyx_t_192 = 0;
      __pyx_t_190 = __Pyx_PyObject_Call(__pyx_t_191, __pyx_t_193, NULL); if (unlikely(!__pyx_t_190)) __PYX_ERR(0, 2042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_190);
      __Pyx_DECREF(__pyx_t_193); __pyx_t_193 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_191); __pyx_t_191 = 0;
  __pyx_t_191 = PyTuple_New(6); if (unlikely(!__pyx_t_191)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_191);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_191, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_191, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_191, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_191, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_191, 4, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_190);
  PyTuple_SET_ITEM(__pyx_t_191, 5, __pyx_t_190);
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  __pyx_t_4 = 0;
  __pyx_t_190 = 0;
  __pyx_r = __pyx_t_191;
  __pyx_t_191 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":1935
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * cdef Calc_LOS_PInOut_Lin(double[:,::1] Ds, double [:,::1] us, double[:,::1] VPoly, double[:,::1] VIn, Lim, double EpsPlane=1.e-9):             # <<<<<<<<<<<<<<
 * 
 *     cdef int ii=0, jj=0, Nl=Ds.shape[1], Ns=VIn.shape[1]
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __PYX_XDEC_MEMVIEW(&__pyx_t_11, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_t_79, 1);
  __Pyx_XDECREF(__pyx_t_190);
  __Pyx_XDECREF(__pyx_t_191);
  __Pyx_XDECREF(__pyx_t_192);
  __Pyx_XDECREF(__pyx_t_193);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SIn_.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SOut_.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indIn_.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indOut_.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.Calc_LOS_PInOut_Lin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SIn_.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_SOut_.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_In.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_VPerp_Out.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indIn_.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_indOut_.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_SIn_);
  __Pyx_XDECREF((PyObject *)__pyx_v_SOut_);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPerp_In);
  __Pyx_XDECREF((PyObject *)__pyx_v_VPerp_Out);
  __Pyx_XDECREF((PyObject *)__pyx_v_indIn_);
  __Pyx_XDECREF((PyObject *)__pyx_v_indOut_);
  __PYX_XDEC_MEMVIEW(&__pyx_v_SIn, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_SOut, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPerpIn, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_VPerpOut, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indIn, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_indOut, 1);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_V1);
  __Pyx_XDECREF(__pyx_v_V2);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2058
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_get_sample(double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, str dLMode='abs', str method='sum',
 *                    Test=True):
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_47LOS_get_sample(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_46LOS_get_sample[] = " Return the sampled line, with the specified method\n\n    'linspace': return the N+1 edges, including the first and last point\n    'sum' :     return N segments centers\n    'simps':    return N+1 egdes, N even (for scipy.integrate.simps)\n    'romb' :    return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb)\n    ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_47LOS_get_sample = {"LOS_get_sample", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_47LOS_get_sample, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_46LOS_get_sample};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_47LOS_get_sample(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_Ds = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_us = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_dL = 0;
  __Pyx_memviewslice __pyx_v_DLs = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_dLMode = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_Test = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LOS_get_sample (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Ds,&__pyx_n_s_us,&__pyx_n_s_dL,&__pyx_n_s_DLs,&__pyx_n_s_dLMode,&__pyx_n_s_method,&__pyx_n_s_Test,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[4] = ((PyObject*)__pyx_n_s_abs);
    values[5] = ((PyObject*)__pyx_n_s_sum);

    /* "tofu/geom/_GG03.pyx":2060
 * def LOS_get_sample(double[:,::1] Ds, double[:,::1] us, dL,
 *                    double[:,::1] DLs, str dLMode='abs', str method='sum',
 *                    Test=True):             # <<<<<<<<<<<<<<
 * 
 *     """ Return the sampled line, with the specified method
 */
    values[6] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Ds)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_us)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_get_sample", 0, 4, 7, 1); __PYX_ERR(0, 2058, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_get_sample", 0, 4, 7, 2); __PYX_ERR(0, 2058, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DLs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_get_sample", 0, 4, 7, 3); __PYX_ERR(0, 2058, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dLMode);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Test);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "LOS_get_sample") < 0)) __PYX_ERR(0, 2058, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_Ds = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0]); if (unlikely(!__pyx_v_Ds.memview)) __PYX_ERR(0, 2058, __pyx_L3_error)
    __pyx_v_us = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[1]); if (unlikely(!__pyx_v_us.memview)) __PYX_ERR(0, 2058, __pyx_L3_error)
    __pyx_v_dL = values[2];
    __pyx_v_DLs = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[3]); if (unlikely(!__pyx_v_DLs.memview)) __PYX_ERR(0, 2059, __pyx_L3_error)
    __pyx_v_dLMode = ((PyObject*)values[4]);
    __pyx_v_method = ((PyObject*)values[5]);
    __pyx_v_Test = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("LOS_get_sample", 0, 4, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2058, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_get_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dLMode), (&PyString_Type), 1, "dLMode", 1))) __PYX_ERR(0, 2059, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method), (&PyString_Type), 1, "method", 1))) __PYX_ERR(0, 2059, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_46LOS_get_sample(__pyx_self, __pyx_v_Ds, __pyx_v_us, __pyx_v_dL, __pyx_v_DLs, __pyx_v_dLMode, __pyx_v_method, __pyx_v_Test);

  /* "tofu/geom/_GG03.pyx":2058
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_get_sample(double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, str dLMode='abs', str method='sum',
 *                    Test=True):
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_46LOS_get_sample(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_Ds, __Pyx_memviewslice __pyx_v_us, PyObject *__pyx_v_dL, __Pyx_memviewslice __pyx_v_DLs, PyObject *__pyx_v_dLMode, PyObject *__pyx_v_method, PyObject *__pyx_v_Test) {
  PyObject *__pyx_v_C0 = NULL;
  PyObject *__pyx_v_C1 = NULL;
  unsigned int __pyx_v_ii;
  unsigned int __pyx_v_jj;
  unsigned int __pyx_v_N;
  unsigned int __pyx_v_ND;
  double __pyx_v_kkk;
  double __pyx_v_D0;
  double __pyx_v_D1;
  double __pyx_v_D2;
  double __pyx_v_u0;
  double __pyx_v_u1;
  double __pyx_v_u2;
  double __pyx_v_dl0;
  double __pyx_v_dl;
  PyArrayObject *__pyx_v_dLr = 0;
  PyArrayObject *__pyx_v_kk = 0;
  PyArrayObject *__pyx_v_pts = 0;
  PyObject *__pyx_v_Pts = 0;
  PyObject *__pyx_v_k = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_dLr;
  __Pyx_Buffer __pyx_pybuffer_dLr;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_kk;
  __Pyx_Buffer __pyx_pybuffer_kk;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pts;
  __Pyx_Buffer __pyx_pybuffer_pts;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyArrayObject *__pyx_t_10 = NULL;
  unsigned int __pyx_t_11;
  unsigned int __pyx_t_12;
  double __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  size_t __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  size_t __pyx_t_17;
  size_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  size_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  size_t __pyx_t_22;
  double __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  size_t __pyx_t_25;
  double __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  size_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  size_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  size_t __pyx_t_32;
  PyArrayObject *__pyx_t_33 = NULL;
  int __pyx_t_34;
  PyObject *__pyx_t_35 = NULL;
  PyObject *__pyx_t_36 = NULL;
  PyObject *__pyx_t_37 = NULL;
  PyArrayObject *__pyx_t_38 = NULL;
  unsigned int __pyx_t_39;
  unsigned int __pyx_t_40;
  size_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  size_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  size_t __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  size_t __pyx_t_47;
  long __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  size_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  size_t __pyx_t_52;
  size_t __pyx_t_53;
  Py_ssize_t __pyx_t_54;
  size_t __pyx_t_55;
  Py_ssize_t __pyx_t_56;
  size_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  size_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  size_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  size_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  size_t __pyx_t_65;
  size_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  size_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  size_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  size_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  size_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  size_t __pyx_t_76;
  size_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  size_t __pyx_t_79;
  Py_ssize_t __pyx_t_80;
  size_t __pyx_t_81;
  Py_ssize_t __pyx_t_82;
  size_t __pyx_t_83;
  Py_ssize_t __pyx_t_84;
  size_t __pyx_t_85;
  Py_ssize_t __pyx_t_86;
  size_t __pyx_t_87;
  Py_ssize_t __pyx_t_88;
  size_t __pyx_t_89;
  size_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  size_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  size_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  size_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  size_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  size_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  size_t __pyx_t_102;
  size_t __pyx_t_103;
  Py_ssize_t __pyx_t_104;
  size_t __pyx_t_105;
  Py_ssize_t __pyx_t_106;
  size_t __pyx_t_107;
  Py_ssize_t __pyx_t_108;
  size_t __pyx_t_109;
  Py_ssize_t __pyx_t_110;
  size_t __pyx_t_111;
  Py_ssize_t __pyx_t_112;
  size_t __pyx_t_113;
  Py_ssize_t __pyx_t_114;
  size_t __pyx_t_115;
  size_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  size_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  size_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  size_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  size_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  size_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  size_t __pyx_t_128;
  size_t __pyx_t_129;
  Py_ssize_t __pyx_t_130;
  size_t __pyx_t_131;
  Py_ssize_t __pyx_t_132;
  size_t __pyx_t_133;
  Py_ssize_t __pyx_t_134;
  size_t __pyx_t_135;
  Py_ssize_t __pyx_t_136;
  size_t __pyx_t_137;
  Py_ssize_t __pyx_t_138;
  size_t __pyx_t_139;
  Py_ssize_t __pyx_t_140;
  size_t __pyx_t_141;
  size_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  size_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  size_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  size_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  size_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  size_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  size_t __pyx_t_154;
  size_t __pyx_t_155;
  Py_ssize_t __pyx_t_156;
  size_t __pyx_t_157;
  Py_ssize_t __pyx_t_158;
  size_t __pyx_t_159;
  Py_ssize_t __pyx_t_160;
  size_t __pyx_t_161;
  Py_ssize_t __pyx_t_162;
  size_t __pyx_t_163;
  Py_ssize_t __pyx_t_164;
  size_t __pyx_t_165;
  Py_ssize_t __pyx_t_166;
  size_t __pyx_t_167;
  size_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  size_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  size_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  size_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  size_t __pyx_t_176;
  Py_ssize_t __pyx_t_177;
  size_t __pyx_t_178;
  size_t __pyx_t_179;
  Py_ssize_t __pyx_t_180;
  size_t __pyx_t_181;
  Py_ssize_t __pyx_t_182;
  size_t __pyx_t_183;
  Py_ssize_t __pyx_t_184;
  size_t __pyx_t_185;
  Py_ssize_t __pyx_t_186;
  size_t __pyx_t_187;
  Py_ssize_t __pyx_t_188;
  size_t __pyx_t_189;
  Py_ssize_t __pyx_t_190;
  size_t __pyx_t_191;
  size_t __pyx_t_192;
  Py_ssize_t __pyx_t_193;
  size_t __pyx_t_194;
  Py_ssize_t __pyx_t_195;
  size_t __pyx_t_196;
  Py_ssize_t __pyx_t_197;
  size_t __pyx_t_198;
  Py_ssize_t __pyx_t_199;
  size_t __pyx_t_200;
  Py_ssize_t __pyx_t_201;
  size_t __pyx_t_202;
  size_t __pyx_t_203;
  Py_ssize_t __pyx_t_204;
  size_t __pyx_t_205;
  Py_ssize_t __pyx_t_206;
  size_t __pyx_t_207;
  Py_ssize_t __pyx_t_208;
  size_t __pyx_t_209;
  Py_ssize_t __pyx_t_210;
  size_t __pyx_t_211;
  Py_ssize_t __pyx_t_212;
  size_t __pyx_t_213;
  Py_ssize_t __pyx_t_214;
  size_t __pyx_t_215;
  size_t __pyx_t_216;
  Py_ssize_t __pyx_t_217;
  size_t __pyx_t_218;
  Py_ssize_t __pyx_t_219;
  size_t __pyx_t_220;
  Py_ssize_t __pyx_t_221;
  size_t __pyx_t_222;
  Py_ssize_t __pyx_t_223;
  size_t __pyx_t_224;
  Py_ssize_t __pyx_t_225;
  size_t __pyx_t_226;
  size_t __pyx_t_227;
  Py_ssize_t __pyx_t_228;
  size_t __pyx_t_229;
  Py_ssize_t __pyx_t_230;
  size_t __pyx_t_231;
  Py_ssize_t __pyx_t_232;
  size_t __pyx_t_233;
  Py_ssize_t __pyx_t_234;
  size_t __pyx_t_235;
  Py_ssize_t __pyx_t_236;
  size_t __pyx_t_237;
  Py_ssize_t __pyx_t_238;
  size_t __pyx_t_239;
  size_t __pyx_t_240;
  Py_ssize_t __pyx_t_241;
  size_t __pyx_t_242;
  Py_ssize_t __pyx_t_243;
  size_t __pyx_t_244;
  Py_ssize_t __pyx_t_245;
  size_t __pyx_t_246;
  Py_ssize_t __pyx_t_247;
  size_t __pyx_t_248;
  Py_ssize_t __pyx_t_249;
  size_t __pyx_t_250;
  Py_ssize_t __pyx_t_251;
  size_t __pyx_t_252;
  size_t __pyx_t_253;
  Py_ssize_t __pyx_t_254;
  size_t __pyx_t_255;
  Py_ssize_t __pyx_t_256;
  size_t __pyx_t_257;
  Py_ssize_t __pyx_t_258;
  size_t __pyx_t_259;
  Py_ssize_t __pyx_t_260;
  size_t __pyx_t_261;
  Py_ssize_t __pyx_t_262;
  size_t __pyx_t_263;
  Py_ssize_t __pyx_t_264;
  size_t __pyx_t_265;
  size_t __pyx_t_266;
  Py_ssize_t __pyx_t_267;
  size_t __pyx_t_268;
  Py_ssize_t __pyx_t_269;
  size_t __pyx_t_270;
  Py_ssize_t __pyx_t_271;
  size_t __pyx_t_272;
  Py_ssize_t __pyx_t_273;
  size_t __pyx_t_274;
  Py_ssize_t __pyx_t_275;
  size_t __pyx_t_276;
  Py_ssize_t __pyx_t_277;
  size_t __pyx_t_278;
  size_t __pyx_t_279;
  Py_ssize_t __pyx_t_280;
  size_t __pyx_t_281;
  Py_ssize_t __pyx_t_282;
  size_t __pyx_t_283;
  Py_ssize_t __pyx_t_284;
  size_t __pyx_t_285;
  Py_ssize_t __pyx_t_286;
  size_t __pyx_t_287;
  Py_ssize_t __pyx_t_288;
  size_t __pyx_t_289;
  Py_ssize_t __pyx_t_290;
  size_t __pyx_t_291;
  size_t __pyx_t_292;
  Py_ssize_t __pyx_t_293;
  size_t __pyx_t_294;
  Py_ssize_t __pyx_t_295;
  size_t __pyx_t_296;
  Py_ssize_t __pyx_t_297;
  size_t __pyx_t_298;
  Py_ssize_t __pyx_t_299;
  size_t __pyx_t_300;
  Py_ssize_t __pyx_t_301;
  size_t __pyx_t_302;
  Py_ssize_t __pyx_t_303;
  size_t __pyx_t_304;
  size_t __pyx_t_305;
  Py_ssize_t __pyx_t_306;
  size_t __pyx_t_307;
  Py_ssize_t __pyx_t_308;
  size_t __pyx_t_309;
  Py_ssize_t __pyx_t_310;
  size_t __pyx_t_311;
  Py_ssize_t __pyx_t_312;
  size_t __pyx_t_313;
  Py_ssize_t __pyx_t_314;
  size_t __pyx_t_315;
  Py_ssize_t __pyx_t_316;
  size_t __pyx_t_317;
  size_t __pyx_t_318;
  Py_ssize_t __pyx_t_319;
  size_t __pyx_t_320;
  Py_ssize_t __pyx_t_321;
  size_t __pyx_t_322;
  Py_ssize_t __pyx_t_323;
  size_t __pyx_t_324;
  __Pyx_RefNannySetupContext("LOS_get_sample", 0);
  __Pyx_INCREF(__pyx_v_dLMode);
  __Pyx_INCREF(__pyx_v_method);
  __pyx_pybuffer_dLr.pybuffer.buf = NULL;
  __pyx_pybuffer_dLr.refcount = 0;
  __pyx_pybuffernd_dLr.data = NULL;
  __pyx_pybuffernd_dLr.rcbuffer = &__pyx_pybuffer_dLr;
  __pyx_pybuffer_kk.pybuffer.buf = NULL;
  __pyx_pybuffer_kk.refcount = 0;
  __pyx_pybuffernd_kk.data = NULL;
  __pyx_pybuffernd_kk.rcbuffer = &__pyx_pybuffer_kk;
  __pyx_pybuffer_pts.pybuffer.buf = NULL;
  __pyx_pybuffer_pts.refcount = 0;
  __pyx_pybuffernd_pts.data = NULL;
  __pyx_pybuffernd_pts.rcbuffer = &__pyx_pybuffer_pts;

  /* "tofu/geom/_GG03.pyx":2069
 *     'romb' :    return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb)
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Test); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2069, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2070
 *     """
 *     if Test:
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"             # <<<<<<<<<<<<<<
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = ((__pyx_v_Ds.shape[0]) == (__pyx_v_us.shape[0]));
      if (__pyx_t_1) {
        __pyx_t_1 = ((__pyx_v_us.shape[0]) == 3);
      }
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_Ds_us_dim_0);
        __PYX_ERR(0, 2070, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2071
 *     if Test:
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"             # <<<<<<<<<<<<<<
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!(((__pyx_v_DLs.shape[0]) == 2) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_DLs_dim_0);
        __PYX_ERR(0, 2071, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2072
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"             # <<<<<<<<<<<<<<
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = ((__pyx_v_Ds.shape[1]) == (__pyx_v_us.shape[1]));
      if (__pyx_t_1) {
        __pyx_t_1 = ((__pyx_v_us.shape[1]) == (__pyx_v_DLs.shape[1]));
      }
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_Ds_us_DLs_1);
        __PYX_ERR(0, 2072, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2073
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 *         C0 = not hasattr(dL,'__iter__') and dL>0.             # <<<<<<<<<<<<<<
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 *         assert C0 or C1, "Arg dL must be >0. !"
 */
    __pyx_t_1 = __Pyx_HasAttr(__pyx_v_dL, __pyx_n_s_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2073, __pyx_L1_error)
    __pyx_t_3 = (!(__pyx_t_1 != 0));
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2073, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dL, __pyx_float_0_, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2073, __pyx_L1_error)
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L4_bool_binop_done:;
    __pyx_v_C0 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2074
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)             # <<<<<<<<<<<<<<
 *         assert C0 or C1, "Arg dL must be >0. !"
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"
 */
    __pyx_t_3 = __Pyx_HasAttr(__pyx_v_dL, __pyx_n_s_iter); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2074, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = PyObject_Length(__pyx_v_dL); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2074, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_5 == (__pyx_v_Ds.shape[1]));
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_all); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_dL, __pyx_float_0_, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2074, __pyx_L1_error)
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2074, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2074, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L6_bool_binop_done:;
    __pyx_v_C1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2075
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 *         assert C0 or C1, "Arg dL must be >0. !"             # <<<<<<<<<<<<<<
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_C0); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2075, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_C1); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2075, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_1;
      __pyx_L9_bool_binop_done:;
      if (unlikely(!__pyx_t_3)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_dL_must_be_0);
        __PYX_ERR(0, 2075, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2076
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 *         assert C0 or C1, "Arg dL must be >0. !"
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"             # <<<<<<<<<<<<<<
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"
 * 
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dLMode, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2076, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2076, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2076, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_abs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2076, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_rel, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2076, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_1;
      __pyx_L11_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!(__pyx_t_3 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_dLMode_in_abs_rel);
        __PYX_ERR(0, 2076, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2077
 *         assert C0 or C1, "Arg dL must be >0. !"
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"             # <<<<<<<<<<<<<<
 * 
 *     cdef unsigned int ii, jj, N, ND = Ds.shape[1]
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2077, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2077, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2077, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2077, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_romb, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2077, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_1;
      __pyx_L13_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!(__pyx_t_3 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_method);
        __PYX_ERR(0, 2077, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2069
 *     'romb' :    return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb)
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 */
  }

  /* "tofu/geom/_GG03.pyx":2079
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"
 * 
 *     cdef unsigned int ii, jj, N, ND = Ds.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double kkk, D0, D1, D2, u0, u1, u2, dl0, dl
 *     cdef cnp.ndarray[double,ndim=1] dLr = np.empty((ND,),dtype=float)
 */
  __pyx_v_ND = (__pyx_v_Ds.shape[1]);

  /* "tofu/geom/_GG03.pyx":2081
 *     cdef unsigned int ii, jj, N, ND = Ds.shape[1]
 *     cdef double kkk, D0, D1, D2, u0, u1, u2, dl0, dl
 *     cdef cnp.ndarray[double,ndim=1] dLr = np.empty((ND,),dtype=float)             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] kk
 *     cdef cnp.ndarray[double,ndim=2] pts
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ND); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
  __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2081, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2081, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2081, __pyx_L1_error)
  __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_dLr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2081, __pyx_L1_error)
    } else {__pyx_pybuffernd_dLr.diminfo[0].strides = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dLr.diminfo[0].shape = __pyx_pybuffernd_dLr.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_10 = 0;
  __pyx_v_dLr = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2084
 *     cdef cnp.ndarray[double,ndim=1] kk
 *     cdef cnp.ndarray[double,ndim=2] pts
 *     cdef list Pts=[0 for ii in range(0,ND)], k=[0 for ii in range(0,ND)]             # <<<<<<<<<<<<<<
 * 
 *     dLMode = dLMode.lower()
 */
  __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = __pyx_v_ND;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_ii = __pyx_t_12;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_int_0))) __PYX_ERR(0, 2084, __pyx_L1_error)
  }
  __pyx_v_Pts = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;
  __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_11 = __pyx_v_ND;
  for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
    __pyx_v_ii = __pyx_t_12;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_9, (PyObject*)__pyx_int_0))) __PYX_ERR(0, 2084, __pyx_L1_error)
  }
  __pyx_v_k = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2086
 *     cdef list Pts=[0 for ii in range(0,ND)], k=[0 for ii in range(0,ND)]
 * 
 *     dLMode = dLMode.lower()             # <<<<<<<<<<<<<<
 *     method = method.lower()
 *     # Case with unique dL
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_dLMode, __pyx_n_s_lower); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2086, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2086, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 2086, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_dLMode, ((PyObject*)__pyx_t_9));
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2087
 * 
 *     dLMode = dLMode.lower()
 *     method = method.lower()             # <<<<<<<<<<<<<<
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_lower); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2087, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2087, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2087, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 2087, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_method, ((PyObject*)__pyx_t_9));
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2089
 *     method = method.lower()
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):             # <<<<<<<<<<<<<<
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 */
  __pyx_t_3 = __Pyx_HasAttr(__pyx_v_dL, __pyx_n_s_iter); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2089, __pyx_L1_error)
  __pyx_t_1 = ((!(__pyx_t_3 != 0)) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2090
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_dLMode, __pyx_n_s_rel, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2090, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "tofu/geom/_GG03.pyx":2091
 *     if not hasattr(dL,'__iter__'):
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))             # <<<<<<<<<<<<<<
 *             if method=='sum':
 *                 for ii in range(0,ND):
 */
      __pyx_t_9 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_v_dL, 1., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2091, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2091, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_N = ((long)ceil(__pyx_t_13));

      /* "tofu/geom/_GG03.pyx":2092
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2092, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2093
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2094
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_14 = 0;
          __pyx_t_15 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_14 * __pyx_v_DLs.strides[0]) )) + __pyx_t_15)) )));

          /* "tofu/geom/_GG03.pyx":2095
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_16 = 1;
          __pyx_t_17 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_16 * __pyx_v_DLs.strides[0]) )) + __pyx_t_17)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2096
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_18 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2097
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_19 = 0;
          __pyx_t_20 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_19 * __pyx_v_Ds.strides[0]) )) + __pyx_t_20)) )));
          __pyx_t_21 = 1;
          __pyx_t_22 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_21 * __pyx_v_Ds.strides[0]) )) + __pyx_t_22)) )));
          __pyx_t_24 = 2;
          __pyx_t_25 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_24 * __pyx_v_Ds.strides[0]) )) + __pyx_t_25)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2098
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 */
          __pyx_t_27 = 0;
          __pyx_t_28 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_27 * __pyx_v_us.strides[0]) )) + __pyx_t_28)) )));
          __pyx_t_29 = 1;
          __pyx_t_30 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_29 * __pyx_v_us.strides[0]) )) + __pyx_t_30)) )));
          __pyx_t_31 = 2;
          __pyx_t_32 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_31 * __pyx_v_us.strides[0]) )) + __pyx_t_32)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2099
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2099, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2099, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2099, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2099, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2100
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2100, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2100, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2100, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2100, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2101
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_39 = __pyx_v_N;
          for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) {
            __pyx_v_jj = __pyx_t_40;

            /* "tofu/geom/_GG03.pyx":2102
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2103
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_41 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2104
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_42 = 0;
            __pyx_t_43 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2105
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_44 = 1;
            __pyx_t_45 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2106
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_46 = 2;
            __pyx_t_47 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2107
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 *             elif method=='simps':
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2107, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2108
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 *             elif method=='simps':
 *                 N = N if N%2==0 else N+1
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2108, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2092
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L22;
      }

      /* "tofu/geom/_GG03.pyx":2109
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2109, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2110
 *                     k[ii] = kk
 *             elif method=='simps':
 *                 N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        if ((((__pyx_v_N % 2) == 0) != 0)) {
          __pyx_t_48 = __pyx_v_N;
        } else {
          __pyx_t_48 = (__pyx_v_N + 1);
        }
        __pyx_v_N = __pyx_t_48;

        /* "tofu/geom/_GG03.pyx":2111
 *             elif method=='simps':
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2112
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_49 = 0;
          __pyx_t_50 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_49 * __pyx_v_DLs.strides[0]) )) + __pyx_t_50)) )));

          /* "tofu/geom/_GG03.pyx":2113
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_51 = 1;
          __pyx_t_52 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_51 * __pyx_v_DLs.strides[0]) )) + __pyx_t_52)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2114
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_53 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2115
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_54 = 0;
          __pyx_t_55 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_54 * __pyx_v_Ds.strides[0]) )) + __pyx_t_55)) )));
          __pyx_t_56 = 1;
          __pyx_t_57 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_56 * __pyx_v_Ds.strides[0]) )) + __pyx_t_57)) )));
          __pyx_t_58 = 2;
          __pyx_t_59 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_58 * __pyx_v_Ds.strides[0]) )) + __pyx_t_59)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2116
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_60 = 0;
          __pyx_t_61 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_60 * __pyx_v_us.strides[0]) )) + __pyx_t_61)) )));
          __pyx_t_62 = 1;
          __pyx_t_63 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_62 * __pyx_v_us.strides[0]) )) + __pyx_t_63)) )));
          __pyx_t_64 = 2;
          __pyx_t_65 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_64 * __pyx_v_us.strides[0]) )) + __pyx_t_65)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2117
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2117, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2117, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2117, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2117, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2118
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2118, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2118, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2118, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_9);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2118, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2119
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2120
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2121
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_66 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2122
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_67 = 0;
            __pyx_t_68 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2123
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_69 = 1;
            __pyx_t_70 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_70, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2124
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_71 = 2;
            __pyx_t_72 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2125
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2125, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2126
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2126, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2109
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):
 */
        goto __pyx_L22;
      }

      /* "tofu/geom/_GG03.pyx":2129
 * 
 *             else:
 *                 N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      /*else*/ {
        __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

        /* "tofu/geom/_GG03.pyx":2130
 *             else:
 *                 N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2131
 *                 N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_73 = 0;
          __pyx_t_74 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_73 * __pyx_v_DLs.strides[0]) )) + __pyx_t_74)) )));

          /* "tofu/geom/_GG03.pyx":2132
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_75 = 1;
          __pyx_t_76 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_75 * __pyx_v_DLs.strides[0]) )) + __pyx_t_76)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2133
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_77 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_77, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2134
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_78 = 0;
          __pyx_t_79 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_78 * __pyx_v_Ds.strides[0]) )) + __pyx_t_79)) )));
          __pyx_t_80 = 1;
          __pyx_t_81 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_80 * __pyx_v_Ds.strides[0]) )) + __pyx_t_81)) )));
          __pyx_t_82 = 2;
          __pyx_t_83 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_82 * __pyx_v_Ds.strides[0]) )) + __pyx_t_83)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2135
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_84 = 0;
          __pyx_t_85 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_84 * __pyx_v_us.strides[0]) )) + __pyx_t_85)) )));
          __pyx_t_86 = 1;
          __pyx_t_87 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_86 * __pyx_v_us.strides[0]) )) + __pyx_t_87)) )));
          __pyx_t_88 = 2;
          __pyx_t_89 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_88 * __pyx_v_us.strides[0]) )) + __pyx_t_89)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2136
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2136, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2136, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2136, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2136, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2137
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2137, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2137, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2137, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2137, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2138
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2139
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2140
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_90 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_90, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2141
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_91 = 0;
            __pyx_t_92 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_91, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_92, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2142
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_93 = 1;
            __pyx_t_94 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_93, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_94, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2143
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_95 = 2;
            __pyx_t_96 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_96, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2144
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2144, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2145
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2145, __pyx_L1_error)
        }
      }
      __pyx_L22:;

      /* "tofu/geom/_GG03.pyx":2090
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':
 */
      goto __pyx_L21;
    }

    /* "tofu/geom/_GG03.pyx":2148
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
    /*else*/ {
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2148, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2149
 *         else:
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2150
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 */
          __pyx_t_97 = 0;
          __pyx_t_98 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_97 * __pyx_v_DLs.strides[0]) )) + __pyx_t_98)) )));

          /* "tofu/geom/_GG03.pyx":2152
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_99 = 1;
          __pyx_t_100 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_99 * __pyx_v_DLs.strides[0]) )) + __pyx_t_100)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2152, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_dL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2152, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2153
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_101 = 1;
          __pyx_t_102 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_101 * __pyx_v_DLs.strides[0]) )) + __pyx_t_102)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2154
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_103 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_103, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2155
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_104 = 0;
          __pyx_t_105 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_104 * __pyx_v_Ds.strides[0]) )) + __pyx_t_105)) )));
          __pyx_t_106 = 1;
          __pyx_t_107 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_106 * __pyx_v_Ds.strides[0]) )) + __pyx_t_107)) )));
          __pyx_t_108 = 2;
          __pyx_t_109 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_108 * __pyx_v_Ds.strides[0]) )) + __pyx_t_109)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2156
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 */
          __pyx_t_110 = 0;
          __pyx_t_111 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_110 * __pyx_v_us.strides[0]) )) + __pyx_t_111)) )));
          __pyx_t_112 = 1;
          __pyx_t_113 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_112 * __pyx_v_us.strides[0]) )) + __pyx_t_113)) )));
          __pyx_t_114 = 2;
          __pyx_t_115 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_114 * __pyx_v_us.strides[0]) )) + __pyx_t_115)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2157
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2157, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2157, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2157, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2157, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2158
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2158, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2158, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2158, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2158, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2159
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_39 = __pyx_v_N;
          for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) {
            __pyx_v_jj = __pyx_t_40;

            /* "tofu/geom/_GG03.pyx":2160
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2161
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_116 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_116, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2162
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_117 = 0;
            __pyx_t_118 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_117, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_118, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2163
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_119 = 1;
            __pyx_t_120 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_119, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_120, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2164
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_121 = 2;
            __pyx_t_122 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_121, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_122, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2165
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2165, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2166
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2166, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2148
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L35;
      }

      /* "tofu/geom/_GG03.pyx":2168
 *                     k[ii] = kk
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2168, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2169
 * 
 *             elif method=='simps':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2170
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 */
          __pyx_t_123 = 0;
          __pyx_t_124 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_123 * __pyx_v_DLs.strides[0]) )) + __pyx_t_124)) )));

          /* "tofu/geom/_GG03.pyx":2172
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))             # <<<<<<<<<<<<<<
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_125 = 1;
          __pyx_t_126 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_125 * __pyx_v_DLs.strides[0]) )) + __pyx_t_126)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_dL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2172, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2173
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          if ((((__pyx_v_N % 2) == 0) != 0)) {
            __pyx_t_48 = __pyx_v_N;
          } else {
            __pyx_t_48 = (__pyx_v_N + 1);
          }
          __pyx_v_N = __pyx_t_48;

          /* "tofu/geom/_GG03.pyx":2174
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_127 = 1;
          __pyx_t_128 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_127 * __pyx_v_DLs.strides[0]) )) + __pyx_t_128)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2175
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_129 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_129, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2176
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_130 = 0;
          __pyx_t_131 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_130 * __pyx_v_Ds.strides[0]) )) + __pyx_t_131)) )));
          __pyx_t_132 = 1;
          __pyx_t_133 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_132 * __pyx_v_Ds.strides[0]) )) + __pyx_t_133)) )));
          __pyx_t_134 = 2;
          __pyx_t_135 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_134 * __pyx_v_Ds.strides[0]) )) + __pyx_t_135)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2177
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_136 = 0;
          __pyx_t_137 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_136 * __pyx_v_us.strides[0]) )) + __pyx_t_137)) )));
          __pyx_t_138 = 1;
          __pyx_t_139 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_138 * __pyx_v_us.strides[0]) )) + __pyx_t_139)) )));
          __pyx_t_140 = 2;
          __pyx_t_141 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_140 * __pyx_v_us.strides[0]) )) + __pyx_t_141)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2178
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2178, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2178, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2178, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2178, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2179
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2179, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2179, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2179, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2179, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2180
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2181
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2182
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_142 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_142, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2183
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_143 = 0;
            __pyx_t_144 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_143, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_144, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2184
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_145 = 1;
            __pyx_t_146 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_145, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_146, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2185
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_147 = 2;
            __pyx_t_148 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_147, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_148, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2186
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2186, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2187
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2187, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2168
 *                     k[ii] = kk
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L35;
      }

      /* "tofu/geom/_GG03.pyx":2190
 * 
 *             else:
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
      /*else*/ {
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2191
 *             else:
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 */
          __pyx_t_149 = 0;
          __pyx_t_150 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_149 * __pyx_v_DLs.strides[0]) )) + __pyx_t_150)) )));

          /* "tofu/geom/_GG03.pyx":2193
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))             # <<<<<<<<<<<<<<
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_151 = 1;
          __pyx_t_152 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_151 * __pyx_v_DLs.strides[0]) )) + __pyx_t_152)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2193, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_dL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2193, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2193, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2194
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

          /* "tofu/geom/_GG03.pyx":2195
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_153 = 1;
          __pyx_t_154 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_153 * __pyx_v_DLs.strides[0]) )) + __pyx_t_154)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2196
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_155 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_155, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2197
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_156 = 0;
          __pyx_t_157 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_156 * __pyx_v_Ds.strides[0]) )) + __pyx_t_157)) )));
          __pyx_t_158 = 1;
          __pyx_t_159 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_158 * __pyx_v_Ds.strides[0]) )) + __pyx_t_159)) )));
          __pyx_t_160 = 2;
          __pyx_t_161 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_160 * __pyx_v_Ds.strides[0]) )) + __pyx_t_161)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2198
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_162 = 0;
          __pyx_t_163 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_162 * __pyx_v_us.strides[0]) )) + __pyx_t_163)) )));
          __pyx_t_164 = 1;
          __pyx_t_165 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_164 * __pyx_v_us.strides[0]) )) + __pyx_t_165)) )));
          __pyx_t_166 = 2;
          __pyx_t_167 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_166 * __pyx_v_us.strides[0]) )) + __pyx_t_167)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2199
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2199, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2199, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2199, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2199, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2200
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2200, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2200, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2200, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2200, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2201
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2202
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2203
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_168 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_168, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2204
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_169 = 0;
            __pyx_t_170 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_169, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_170, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2205
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_171 = 1;
            __pyx_t_172 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_171, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_172, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2206
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_173 = 2;
            __pyx_t_174 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_173, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_174, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2207
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2207, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2208
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *     # Case with different resolution for each LOS
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2208, __pyx_L1_error)
        }
      }
      __pyx_L35:;
    }
    __pyx_L21:;

    /* "tofu/geom/_GG03.pyx":2089
 *     method = method.lower()
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):             # <<<<<<<<<<<<<<
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 */
    goto __pyx_L20;
  }

  /* "tofu/geom/_GG03.pyx":2212
 *     # Case with different resolution for each LOS
 *     else:
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             if method=='sum':
 *                 for ii in range(0,ND):
 */
  /*else*/ {
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_dLMode, __pyx_n_s_rel, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2212, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":2213
 *     else:
 *         if dLMode=='rel':
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2213, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2214
 *         if dLMode=='rel':
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     dl0 = DLs[0,ii]
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2215
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_t_7, 1., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2215, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2215, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2216
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_175 = 0;
          __pyx_t_176 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_175 * __pyx_v_DLs.strides[0]) )) + __pyx_t_176)) )));

          /* "tofu/geom/_GG03.pyx":2217
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_177 = 1;
          __pyx_t_178 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_177 * __pyx_v_DLs.strides[0]) )) + __pyx_t_178)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2218
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_179 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_179, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2219
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_180 = 0;
          __pyx_t_181 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_180 * __pyx_v_Ds.strides[0]) )) + __pyx_t_181)) )));
          __pyx_t_182 = 1;
          __pyx_t_183 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_182 * __pyx_v_Ds.strides[0]) )) + __pyx_t_183)) )));
          __pyx_t_184 = 2;
          __pyx_t_185 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_184 * __pyx_v_Ds.strides[0]) )) + __pyx_t_185)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2220
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 */
          __pyx_t_186 = 0;
          __pyx_t_187 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_186 * __pyx_v_us.strides[0]) )) + __pyx_t_187)) )));
          __pyx_t_188 = 1;
          __pyx_t_189 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_188 * __pyx_v_us.strides[0]) )) + __pyx_t_189)) )));
          __pyx_t_190 = 2;
          __pyx_t_191 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_190 * __pyx_v_us.strides[0]) )) + __pyx_t_191)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2221
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2221, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2221, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2221, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2221, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2222
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2222, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2222, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2222, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2222, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2223
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_39 = __pyx_v_N;
          for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) {
            __pyx_v_jj = __pyx_t_40;

            /* "tofu/geom/_GG03.pyx":2224
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2225
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_192 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_192, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2226
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_193 = 0;
            __pyx_t_194 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_193, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_194, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2227
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_195 = 1;
            __pyx_t_196 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_195, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_196, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2228
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_197 = 2;
            __pyx_t_198 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_197, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_198, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2229
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 *             elif method=='simps':
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2229, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2230
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2230, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2213
 *     else:
 *         if dLMode=='rel':
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
        goto __pyx_L49;
      }

      /* "tofu/geom/_GG03.pyx":2231
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2231, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2232
 *                     k[ii] = kk
 *             elif method=='simps':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = N if N%2==0 else N+1
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2233
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = N if N%2==0 else N+1
 *                     dl0 = DLs[0,ii]
 */
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_t_7, 1., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2233, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2233, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2234
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          if ((((__pyx_v_N % 2) == 0) != 0)) {
            __pyx_t_48 = __pyx_v_N;
          } else {
            __pyx_t_48 = (__pyx_v_N + 1);
          }
          __pyx_v_N = __pyx_t_48;

          /* "tofu/geom/_GG03.pyx":2235
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = N if N%2==0 else N+1
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_199 = 0;
          __pyx_t_200 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_199 * __pyx_v_DLs.strides[0]) )) + __pyx_t_200)) )));

          /* "tofu/geom/_GG03.pyx":2236
 *                     N = N if N%2==0 else N+1
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_201 = 1;
          __pyx_t_202 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_201 * __pyx_v_DLs.strides[0]) )) + __pyx_t_202)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2237
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_203 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_203, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2238
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_204 = 0;
          __pyx_t_205 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_204 * __pyx_v_Ds.strides[0]) )) + __pyx_t_205)) )));
          __pyx_t_206 = 1;
          __pyx_t_207 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_206 * __pyx_v_Ds.strides[0]) )) + __pyx_t_207)) )));
          __pyx_t_208 = 2;
          __pyx_t_209 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_208 * __pyx_v_Ds.strides[0]) )) + __pyx_t_209)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2239
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_210 = 0;
          __pyx_t_211 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_210 * __pyx_v_us.strides[0]) )) + __pyx_t_211)) )));
          __pyx_t_212 = 1;
          __pyx_t_213 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_212 * __pyx_v_us.strides[0]) )) + __pyx_t_213)) )));
          __pyx_t_214 = 2;
          __pyx_t_215 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_214 * __pyx_v_us.strides[0]) )) + __pyx_t_215)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2240
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2240, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2240, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2240, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2240, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2241
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2241, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2241, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2241, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2241, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2242
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2243
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2244
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_216 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_216, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2245
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_217 = 0;
            __pyx_t_218 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_217, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_218, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2246
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_219 = 1;
            __pyx_t_220 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_219, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_220, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2247
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_221 = 2;
            __pyx_t_222 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_221, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_222, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2248
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2248, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2249
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2249, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2231
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
        goto __pyx_L49;
      }

      /* "tofu/geom/_GG03.pyx":2252
 * 
 *             else:
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 */
      /*else*/ {
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2253
 *             else:
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl0 = DLs[0,ii]
 */
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2253, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_t_7, 1., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2253, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2253, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2254
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

          /* "tofu/geom/_GG03.pyx":2255
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_223 = 0;
          __pyx_t_224 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_223 * __pyx_v_DLs.strides[0]) )) + __pyx_t_224)) )));

          /* "tofu/geom/_GG03.pyx":2256
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_225 = 1;
          __pyx_t_226 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_225 * __pyx_v_DLs.strides[0]) )) + __pyx_t_226)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2257
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_227 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_227, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2258
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_228 = 0;
          __pyx_t_229 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_228 * __pyx_v_Ds.strides[0]) )) + __pyx_t_229)) )));
          __pyx_t_230 = 1;
          __pyx_t_231 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_230 * __pyx_v_Ds.strides[0]) )) + __pyx_t_231)) )));
          __pyx_t_232 = 2;
          __pyx_t_233 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_232 * __pyx_v_Ds.strides[0]) )) + __pyx_t_233)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2259
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_234 = 0;
          __pyx_t_235 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_234 * __pyx_v_us.strides[0]) )) + __pyx_t_235)) )));
          __pyx_t_236 = 1;
          __pyx_t_237 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_236 * __pyx_v_us.strides[0]) )) + __pyx_t_237)) )));
          __pyx_t_238 = 2;
          __pyx_t_239 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_238 * __pyx_v_us.strides[0]) )) + __pyx_t_239)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2260
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2260, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2260, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2260, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2260, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2261
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2261, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2261, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2261, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2261, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2262
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2263
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2264
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_240 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_240, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2265
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_241 = 0;
            __pyx_t_242 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_241, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_242, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2266
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_243 = 1;
            __pyx_t_244 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_243, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_244, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2267
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_245 = 2;
            __pyx_t_246 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_245, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_246, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2268
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2268, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2269
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2269, __pyx_L1_error)
        }
      }
      __pyx_L49:;

      /* "tofu/geom/_GG03.pyx":2212
 *     # Case with different resolution for each LOS
 *     else:
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             if method=='sum':
 *                 for ii in range(0,ND):
 */
      goto __pyx_L48;
    }

    /* "tofu/geom/_GG03.pyx":2272
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
    /*else*/ {
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2272, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2273
 *         else:
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2274
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 */
          __pyx_t_247 = 0;
          __pyx_t_248 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_247 * __pyx_v_DLs.strides[0]) )) + __pyx_t_248)) )));

          /* "tofu/geom/_GG03.pyx":2276
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_t_249 = 1;
          __pyx_t_250 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_249 * __pyx_v_DLs.strides[0]) )) + __pyx_t_250)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2276, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2276, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2276, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2276, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2277
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_251 = 1;
          __pyx_t_252 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_251 * __pyx_v_DLs.strides[0]) )) + __pyx_t_252)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2278
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_253 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_253, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2279
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_254 = 0;
          __pyx_t_255 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_254 * __pyx_v_Ds.strides[0]) )) + __pyx_t_255)) )));
          __pyx_t_256 = 1;
          __pyx_t_257 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_256 * __pyx_v_Ds.strides[0]) )) + __pyx_t_257)) )));
          __pyx_t_258 = 2;
          __pyx_t_259 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_258 * __pyx_v_Ds.strides[0]) )) + __pyx_t_259)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2280
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 */
          __pyx_t_260 = 0;
          __pyx_t_261 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_260 * __pyx_v_us.strides[0]) )) + __pyx_t_261)) )));
          __pyx_t_262 = 1;
          __pyx_t_263 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_262 * __pyx_v_us.strides[0]) )) + __pyx_t_263)) )));
          __pyx_t_264 = 2;
          __pyx_t_265 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_264 * __pyx_v_us.strides[0]) )) + __pyx_t_265)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2281
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2281, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2281, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2281, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2281, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2282
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2282, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2282, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2282, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_9);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2282, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2283
 *                     pts = np.empty((3,N),dtype=float)
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_39 = __pyx_v_N;
          for (__pyx_t_40 = 0; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) {
            __pyx_v_jj = __pyx_t_40;

            /* "tofu/geom/_GG03.pyx":2284
 *                     kk = np.empty((N,),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2285
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_266 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_266, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2286
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_267 = 0;
            __pyx_t_268 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_267, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_268, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2287
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_269 = 1;
            __pyx_t_270 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_269, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_270, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2288
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_271 = 2;
            __pyx_t_272 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_271, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_272, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2289
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2289, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2290
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2290, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2272
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L62;
      }

      /* "tofu/geom/_GG03.pyx":2292
 *                     k[ii] = kk
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2292, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2293
 * 
 *             elif method=='simps':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2294
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 */
          __pyx_t_273 = 0;
          __pyx_t_274 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_273 * __pyx_v_DLs.strides[0]) )) + __pyx_t_274)) )));

          /* "tofu/geom/_GG03.pyx":2296
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_275 = 1;
          __pyx_t_276 = __pyx_v_ii;
          __pyx_t_9 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_275 * __pyx_v_DLs.strides[0]) )) + __pyx_t_276)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2296, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2296, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2296, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2296, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2297
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          if ((((__pyx_v_N % 2) == 0) != 0)) {
            __pyx_t_48 = __pyx_v_N;
          } else {
            __pyx_t_48 = (__pyx_v_N + 1);
          }
          __pyx_v_N = __pyx_t_48;

          /* "tofu/geom/_GG03.pyx":2298
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_277 = 1;
          __pyx_t_278 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_277 * __pyx_v_DLs.strides[0]) )) + __pyx_t_278)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2299
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_279 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_279, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2300
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_280 = 0;
          __pyx_t_281 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_280 * __pyx_v_Ds.strides[0]) )) + __pyx_t_281)) )));
          __pyx_t_282 = 1;
          __pyx_t_283 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_282 * __pyx_v_Ds.strides[0]) )) + __pyx_t_283)) )));
          __pyx_t_284 = 2;
          __pyx_t_285 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_284 * __pyx_v_Ds.strides[0]) )) + __pyx_t_285)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2301
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_286 = 0;
          __pyx_t_287 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_286 * __pyx_v_us.strides[0]) )) + __pyx_t_287)) )));
          __pyx_t_288 = 1;
          __pyx_t_289 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_288 * __pyx_v_us.strides[0]) )) + __pyx_t_289)) )));
          __pyx_t_290 = 2;
          __pyx_t_291 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_290 * __pyx_v_us.strides[0]) )) + __pyx_t_291)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2302
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2302, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2302, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2302, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2302, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2303
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2303, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2303, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2303, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2303, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2304
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2305
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2306
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_292 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_292, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2307
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_293 = 0;
            __pyx_t_294 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_293, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_294, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2308
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_295 = 1;
            __pyx_t_296 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_295, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_296, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2309
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_297 = 2;
            __pyx_t_298 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_297, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_298, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2310
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2310, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2311
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2311, __pyx_L1_error)
        }

        /* "tofu/geom/_GG03.pyx":2292
 *                     k[ii] = kk
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L62;
      }

      /* "tofu/geom/_GG03.pyx":2314
 * 
 *             else:
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
      /*else*/ {
        __pyx_t_11 = __pyx_v_ND;
        for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
          __pyx_v_ii = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2315
 *             else:
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 */
          __pyx_t_299 = 0;
          __pyx_t_300 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_299 * __pyx_v_DLs.strides[0]) )) + __pyx_t_300)) )));

          /* "tofu/geom/_GG03.pyx":2317
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_301 = 1;
          __pyx_t_302 = __pyx_v_ii;
          __pyx_t_4 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_301 * __pyx_v_DLs.strides[0]) )) + __pyx_t_302)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2317, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2317, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_13));

          /* "tofu/geom/_GG03.pyx":2318
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 */
          __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

          /* "tofu/geom/_GG03.pyx":2319
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_303 = 1;
          __pyx_t_304 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_303 * __pyx_v_DLs.strides[0]) )) + __pyx_t_304)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2320
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_305 = __pyx_v_ii;
          *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_dLr.rcbuffer->pybuffer.buf, __pyx_t_305, __pyx_pybuffernd_dLr.diminfo[0].strides) = __pyx_v_dl;

          /* "tofu/geom/_GG03.pyx":2321
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_306 = 0;
          __pyx_t_307 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_306 * __pyx_v_Ds.strides[0]) )) + __pyx_t_307)) )));
          __pyx_t_308 = 1;
          __pyx_t_309 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_308 * __pyx_v_Ds.strides[0]) )) + __pyx_t_309)) )));
          __pyx_t_310 = 2;
          __pyx_t_311 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_310 * __pyx_v_Ds.strides[0]) )) + __pyx_t_311)) )));
          __pyx_v_D0 = __pyx_t_13;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2322
 *                     dLr[ii] = dl
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 */
          __pyx_t_312 = 0;
          __pyx_t_313 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_312 * __pyx_v_us.strides[0]) )) + __pyx_t_313)) )));
          __pyx_t_314 = 1;
          __pyx_t_315 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_314 * __pyx_v_us.strides[0]) )) + __pyx_t_315)) )));
          __pyx_t_316 = 2;
          __pyx_t_317 = __pyx_v_ii;
          __pyx_t_13 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_316 * __pyx_v_us.strides[0]) )) + __pyx_t_317)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_13;

          /* "tofu/geom/_GG03.pyx":2323
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2323, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2323, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2323, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_9);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2323, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2324
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2324, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2324, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2324, __pyx_L1_error)
          __pyx_t_38 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_t_38, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kk.rcbuffer->pybuffer, (PyObject*)__pyx_v_kk, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_kk.diminfo[0].strides = __pyx_pybuffernd_kk.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kk.diminfo[0].shape = __pyx_pybuffernd_kk.rcbuffer->pybuffer.shape[0];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2324, __pyx_L1_error)
          }
          __pyx_t_38 = 0;
          __Pyx_XDECREF_SET(__pyx_v_kk, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2325
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 */
          __pyx_t_48 = (__pyx_v_N + 1);
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_48; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2326
 *                     kk = np.empty((N+1,),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2327
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_t_318 = __pyx_v_jj;
            *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kk.rcbuffer->pybuffer.buf, __pyx_t_318, __pyx_pybuffernd_kk.diminfo[0].strides) = __pyx_v_kkk;

            /* "tofu/geom/_GG03.pyx":2328
 *                         kkk = dl0 + (<double>jj)*dl
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_319 = 0;
            __pyx_t_320 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_319, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_320, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2329
 *                         kk[jj] = kkk
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 */
            __pyx_t_321 = 1;
            __pyx_t_322 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_321, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_322, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2330
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     Pts[ii] = pts
 *                     k[ii] = kk
 */
            __pyx_t_323 = 2;
            __pyx_t_324 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_323, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_324, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2331
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts             # <<<<<<<<<<<<<<
 *                     k[ii] = kk
 * 
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_Pts, __pyx_v_ii, ((PyObject *)__pyx_v_pts), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2331, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2332
 *                         pts[2,jj] = D2 + kkk*u2
 *                     Pts[ii] = pts
 *                     k[ii] = kk             # <<<<<<<<<<<<<<
 * 
 *     return Pts, k, dLr
 */
          if (unlikely(__Pyx_SetItemInt(__pyx_v_k, __pyx_v_ii, ((PyObject *)__pyx_v_kk), unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 1, 0, 0) < 0)) __PYX_ERR(0, 2332, __pyx_L1_error)
        }
      }
      __pyx_L62:;
    }
    __pyx_L48:;
  }
  __pyx_L20:;

  /* "tofu/geom/_GG03.pyx":2334
 *                     k[ii] = kk
 * 
 *     return Pts, k, dLr             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_Pts);
  __Pyx_GIVEREF(__pyx_v_Pts);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_Pts);
  __Pyx_INCREF(__pyx_v_k);
  __Pyx_GIVEREF(__pyx_v_k);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_k);
  __Pyx_INCREF(((PyObject *)__pyx_v_dLr));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_dLr));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_dLr));
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2058
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_get_sample(double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, str dLMode='abs', str method='sum',
 *                    Test=True):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_get_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dLr.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kk.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_C0);
  __Pyx_XDECREF(__pyx_v_C1);
  __Pyx_XDECREF((PyObject *)__pyx_v_dLr);
  __Pyx_XDECREF((PyObject *)__pyx_v_kk);
  __Pyx_XDECREF((PyObject *)__pyx_v_pts);
  __Pyx_XDECREF(__pyx_v_Pts);
  __Pyx_XDECREF(__pyx_v_k);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ds, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_us, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_DLs, 1);
  __Pyx_XDECREF(__pyx_v_dLMode);
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2346
 * 
 * 
 * cdef get_insp(ff):             # <<<<<<<<<<<<<<
 *     out = insp(ff)
 *     if sys.version[0]=='3':
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03_get_insp(PyObject *__pyx_v_ff) {
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_v_pars = NULL;
  PyObject *__pyx_v_na = NULL;
  PyObject *__pyx_v_kw = NULL;
  PyObject *__pyx_v_nat = NULL;
  PyObject *__pyx_v_nak = NULL;
  PyObject *__pyx_v_pp = NULL;
  PyObject *__pyx_v_ii = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  int __pyx_t_13;
  __Pyx_RefNannySetupContext("get_insp", 0);

  /* "tofu/geom/_GG03.pyx":2347
 * 
 * cdef get_insp(ff):
 *     out = insp(ff)             # <<<<<<<<<<<<<<
 *     if sys.version[0]=='3':
 *         pars = out.parameters.values()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_insp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_ff); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2347, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_ff};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2347, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_ff};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2347, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_ff);
      __Pyx_GIVEREF(__pyx_v_ff);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_ff);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_out = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2348
 * cdef get_insp(ff):
 *     out = insp(ff)
 *     if sys.version[0]=='3':             # <<<<<<<<<<<<<<
 *         pars = out.parameters.values()
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s_3, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "tofu/geom/_GG03.pyx":2349
 *     out = insp(ff)
 *     if sys.version[0]=='3':
 *         pars = out.parameters.values()             # <<<<<<<<<<<<<<
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                       and pp.default is pp.empty) for pp in pars])
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_parameters); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2349, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2349, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2349, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_pars = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":2350
 *     if sys.version[0]=='3':
 *         pars = out.parameters.values()
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD             # <<<<<<<<<<<<<<
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2350, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);

    /* "tofu/geom/_GG03.pyx":2351
 *         pars = out.parameters.values()
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                       and pp.default is pp.empty) for pp in pars])             # <<<<<<<<<<<<<<
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                                          and pp.default is not pp.empty)]
 */
    if (likely(PyList_CheckExact(__pyx_v_pars)) || PyTuple_CheckExact(__pyx_v_pars)) {
      __pyx_t_3 = __pyx_v_pars; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_pars); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2351, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2351, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2351, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2351, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_3);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2351, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":2350
 *     if sys.version[0]=='3':
 *         pars = out.parameters.values()
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD             # <<<<<<<<<<<<<<
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_kind); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_POSITIONAL_OR_KEYWORD); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_9, __pyx_t_10, Py_EQ); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2350, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 2350, __pyx_L1_error)
      if (__pyx_t_5) {
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_8 = __pyx_t_11;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L6_bool_binop_done;
      }

      /* "tofu/geom/_GG03.pyx":2351
 *         pars = out.parameters.values()
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                       and pp.default is pp.empty) for pp in pars])             # <<<<<<<<<<<<<<
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                                          and pp.default is not pp.empty)]
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_default); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_empty); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = (__pyx_t_11 == __pyx_t_10);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2351, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_8 = __pyx_t_10;
      __pyx_t_10 = 0;
      __pyx_L6_bool_binop_done:;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 2350, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2350, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2350, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2350, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2350, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __pyx_t_3 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2350, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_na = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":2352
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD             # <<<<<<<<<<<<<<
 *                                          and pp.default is not pp.empty)]
 *     else:
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2352, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (likely(PyList_CheckExact(__pyx_v_pars)) || PyTuple_CheckExact(__pyx_v_pars)) {
      __pyx_t_2 = __pyx_v_pars; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pars); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2352, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_2))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2352, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2352, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2352, __pyx_L1_error)
          #else
          __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2352, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          #endif
        }
      } else {
        __pyx_t_8 = __pyx_t_7(__pyx_t_2);
        if (unlikely(!__pyx_t_8)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2352, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_8);
      }
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":2353
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                                          and pp.default is not pp.empty)]             # <<<<<<<<<<<<<<
 *     else:
 *         nat, nak = len(out.args), len(out.defaults)
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_kind); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);

      /* "tofu/geom/_GG03.pyx":2352
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD             # <<<<<<<<<<<<<<
 *                                          and pp.default is not pp.empty)]
 *     else:
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_POSITIONAL_OR_KEYWORD); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2352, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_8, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2352, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2352, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_12) {
      } else {
        __pyx_t_5 = __pyx_t_12;
        goto __pyx_L11_bool_binop_done;
      }

      /* "tofu/geom/_GG03.pyx":2353
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                                          and pp.default is not pp.empty)]             # <<<<<<<<<<<<<<
 *     else:
 *         nat, nak = len(out.args), len(out.defaults)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_default); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2353, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = (__pyx_t_3 != __pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_13 = (__pyx_t_12 != 0);
      __pyx_t_5 = __pyx_t_13;
      __pyx_L11_bool_binop_done:;

      /* "tofu/geom/_GG03.pyx":2352
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 *                       and pp.default is pp.empty) for pp in pars])
 *         kw = [pp.name for pp in pars if (pp.kind==pp.POSITIONAL_OR_KEYWORD             # <<<<<<<<<<<<<<
 *                                          and pp.default is not pp.empty)]
 *     else:
 */
      if (__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_pp, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2352, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 2352, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_kw = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":2348
 * cdef get_insp(ff):
 *     out = insp(ff)
 *     if sys.version[0]=='3':             # <<<<<<<<<<<<<<
 *         pars = out.parameters.values()
 *         na = np.sum([(pp.kind==pp.POSITIONAL_OR_KEYWORD
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":2355
 *                                          and pp.default is not pp.empty)]
 *     else:
 *         nat, nak = len(out.args), len(out.defaults)             # <<<<<<<<<<<<<<
 *         na = nat-nak
 *         kw = [out.args[ii] for ii in range(nat-1,na-1,-1)][::-1]
 */
  /*else*/ {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_args); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_defaults); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2355, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2355, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_nat = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_nak = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2356
 *     else:
 *         nat, nak = len(out.args), len(out.defaults)
 *         na = nat-nak             # <<<<<<<<<<<<<<
 *         kw = [out.args[ii] for ii in range(nat-1,na-1,-1)][::-1]
 *     return na, kw
 */
    __pyx_t_2 = PyNumber_Subtract(__pyx_v_nat, __pyx_v_nak); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_na = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2357
 *         nat, nak = len(out.args), len(out.defaults)
 *         na = nat-nak
 *         kw = [out.args[ii] for ii in range(nat-1,na-1,-1)][::-1]             # <<<<<<<<<<<<<<
 *     return na, kw
 * 
 */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyInt_SubtractObjC(__pyx_v_nat, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_v_na, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
    __Pyx_INCREF(__pyx_int_neg_1);
    __Pyx_GIVEREF(__pyx_int_neg_1);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_neg_1);
    __pyx_t_1 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0;
      __pyx_t_7 = NULL;
    } else {
      __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2357, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_7)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2357, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 2357, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_7(__pyx_t_3);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 2357, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_ii, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_args); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyObject_GetItem(__pyx_t_4, __pyx_v_ii); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2357, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 2357, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_slice__261); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2357, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_kw = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":2358
 *         na = nat-nak
 *         kw = [out.args[ii] for ii in range(nat-1,na-1,-1)][::-1]
 *     return na, kw             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_na);
  __Pyx_GIVEREF(__pyx_v_na);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_na);
  __Pyx_INCREF(__pyx_v_kw);
  __Pyx_GIVEREF(__pyx_v_kw);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_kw);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2346
 * 
 * 
 * cdef get_insp(ff):             # <<<<<<<<<<<<<<
 *     out = insp(ff)
 *     if sys.version[0]=='3':
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("tofu.geom._GG03.get_insp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_pars);
  __Pyx_XDECREF(__pyx_v_na);
  __Pyx_XDECREF(__pyx_v_kw);
  __Pyx_XDECREF(__pyx_v_nat);
  __Pyx_XDECREF(__pyx_v_nak);
  __Pyx_XDECREF(__pyx_v_pp);
  __Pyx_XDECREF(__pyx_v_ii);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2362
 * 
 * 
 * def check_ff(ff, t=None, Ani=None, bool Vuniq=False):             # <<<<<<<<<<<<<<
 *     cdef bool ani
 *     stre = "Input emissivity function (ff)"
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_49check_ff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_49check_ff = {"check_ff", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_49check_ff, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_49check_ff(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ff = 0;
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_Ani = 0;
  PyBoolObject *__pyx_v_Vuniq = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_ff (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ff,&__pyx_n_s_t,&__pyx_n_s_Ani,&__pyx_n_s_Vuniq,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)Py_None);
    values[3] = (PyObject *)((PyBoolObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ff)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Ani);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Vuniq);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_ff") < 0)) __PYX_ERR(0, 2362, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ff = values[0];
    __pyx_v_t = values[1];
    __pyx_v_Ani = values[2];
    __pyx_v_Vuniq = ((PyBoolObject *)values[3]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("check_ff", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2362, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.check_ff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Vuniq), __pyx_ptype_7cpython_4bool_bool, 1, "Vuniq", 0))) __PYX_ERR(0, 2362, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_48check_ff(__pyx_self, __pyx_v_ff, __pyx_v_t, __pyx_v_Ani, __pyx_v_Vuniq);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_48check_ff(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ff, PyObject *__pyx_v_t, PyObject *__pyx_v_Ani, PyBoolObject *__pyx_v_Vuniq) {
  PyBoolObject *__pyx_v_ani = 0;
  PyObject *__pyx_v_stre = NULL;
  PyObject *__pyx_v_na = NULL;
  PyObject *__pyx_v_kw = NULL;
  int __pyx_v_C;
  PyObject *__pyx_v_Pts = NULL;
  PyObject *__pyx_v_NP = NULL;
  PyObject *__pyx_v_out = NULL;
  PyObject *__pyx_v_Str = NULL;
  Py_ssize_t __pyx_v_nt;
  PyObject *__pyx_v_Vect = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  __Pyx_RefNannySetupContext("check_ff", 0);

  /* "tofu/geom/_GG03.pyx":2364
 * def check_ff(ff, t=None, Ani=None, bool Vuniq=False):
 *     cdef bool ani
 *     stre = "Input emissivity function (ff)"             # <<<<<<<<<<<<<<
 *     assert hasattr(ff,'__call__'), stre+" must be a callable (function) !"
 *     na, kw = get_insp(ff)
 */
  __Pyx_INCREF(__pyx_kp_s_Input_emissivity_function_ff);
  __pyx_v_stre = __pyx_kp_s_Input_emissivity_function_ff;

  /* "tofu/geom/_GG03.pyx":2365
 *     cdef bool ani
 *     stre = "Input emissivity function (ff)"
 *     assert hasattr(ff,'__call__'), stre+" must be a callable (function) !"             # <<<<<<<<<<<<<<
 *     na, kw = get_insp(ff)
 *     assert na==1, stre+" must take only one positional argument: ff(Pts) !"
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = __Pyx_HasAttr(__pyx_v_ff, __pyx_n_s_call); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2365, __pyx_L1_error)
    if (unlikely(!(__pyx_t_1 != 0))) {
      __pyx_t_2 = PyNumber_Add(__pyx_v_stre, __pyx_kp_s_must_be_a_callable_function); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyTuple_Pack(1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2365, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 2365, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":2366
 *     stre = "Input emissivity function (ff)"
 *     assert hasattr(ff,'__call__'), stre+" must be a callable (function) !"
 *     na, kw = get_insp(ff)             # <<<<<<<<<<<<<<
 *     assert na==1, stre+" must take only one positional argument: ff(Pts) !"
 *     assert 't' in kw, stre+" must have kwarg 't=None' for time vector !"
 */
  __pyx_t_3 = __pyx_f_4tofu_4geom_5_GG03_get_insp(__pyx_v_ff); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 2366, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2366, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 2366, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 2366, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_na = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_kw = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "tofu/geom/_GG03.pyx":2367
 *     assert hasattr(ff,'__call__'), stre+" must be a callable (function) !"
 *     na, kw = get_insp(ff)
 *     assert na==1, stre+" must take only one positional argument: ff(Pts) !"             # <<<<<<<<<<<<<<
 *     assert 't' in kw, stre+" must have kwarg 't=None' for time vector !"
 *     C = type(t) in [int,float,np.int64,np.float64] or hasattr(t,'__iter__')
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_na, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2367, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2367, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(!__pyx_t_1)) {
      __pyx_t_3 = PyNumber_Add(__pyx_v_stre, __pyx_kp_s_must_take_only_one_positional_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_Pack(1, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2367, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 2367, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":2368
 *     na, kw = get_insp(ff)
 *     assert na==1, stre+" must take only one positional argument: ff(Pts) !"
 *     assert 't' in kw, stre+" must have kwarg 't=None' for time vector !"             # <<<<<<<<<<<<<<
 *     C = type(t) in [int,float,np.int64,np.float64] or hasattr(t,'__iter__')
 *     assert t is None or C, "Arg t must be None, a scalar or an iterable !"
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_t, __pyx_v_kw, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2368, __pyx_L1_error)
    if (unlikely(!(__pyx_t_1 != 0))) {
      __pyx_t_4 = PyNumber_Add(__pyx_v_stre, __pyx_kp_s_must_have_kwarg_t_None_for_time); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_Pack(1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(0, 2368, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":2369
 *     assert na==1, stre+" must take only one positional argument: ff(Pts) !"
 *     assert 't' in kw, stre+" must have kwarg 't=None' for time vector !"
 *     C = type(t) in [int,float,np.int64,np.float64] or hasattr(t,'__iter__')             # <<<<<<<<<<<<<<
 *     assert t is None or C, "Arg t must be None, a scalar or an iterable !"
 *     Pts = np.array([[1,2],[3,4],[5,6]])
 */
  __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_t)));
  __pyx_t_3 = ((PyObject *)Py_TYPE(__pyx_v_t));
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_t_3), ((PyObject *)(&PyInt_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_t_3), ((PyObject *)(&PyFloat_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_t_3), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_8) {
  } else {
    __pyx_t_7 = __pyx_t_8;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_t_3), __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_7 = __pyx_t_8;
  __pyx_L7_bool_binop_done:;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_8 = __Pyx_HasAttr(__pyx_v_t, __pyx_n_s_iter); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 2369, __pyx_L1_error)
  __pyx_t_7 = (__pyx_t_8 != 0);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  __pyx_v_C = __pyx_t_1;

  /* "tofu/geom/_GG03.pyx":2370
 *     assert 't' in kw, stre+" must have kwarg 't=None' for time vector !"
 *     C = type(t) in [int,float,np.int64,np.float64] or hasattr(t,'__iter__')
 *     assert t is None or C, "Arg t must be None, a scalar or an iterable !"             # <<<<<<<<<<<<<<
 *     Pts = np.array([[1,2],[3,4],[5,6]])
 *     NP = Pts.shape[1]
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    __pyx_t_7 = (__pyx_v_t == Py_None);
    __pyx_t_8 = (__pyx_t_7 != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_1 = __pyx_t_8;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_8 = (__pyx_v_C != 0);
    __pyx_t_1 = __pyx_t_8;
    __pyx_L11_bool_binop_done:;
    if (unlikely(!__pyx_t_1)) {
      PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_t_must_be_None_a_scalar_or_a);
      __PYX_ERR(0, 2370, __pyx_L1_error)
    }
  }
  #endif

  /* "tofu/geom/_GG03.pyx":2371
 *     C = type(t) in [int,float,np.int64,np.float64] or hasattr(t,'__iter__')
 *     assert t is None or C, "Arg t must be None, a scalar or an iterable !"
 *     Pts = np.array([[1,2],[3,4],[5,6]])             # <<<<<<<<<<<<<<
 *     NP = Pts.shape[1]
 *     try:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_1);
  __Pyx_INCREF(__pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_2);
  __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_3);
  __Pyx_INCREF(__pyx_int_4);
  __Pyx_GIVEREF(__pyx_int_4);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_int_4);
  __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_int_5);
  __Pyx_GIVEREF(__pyx_int_5);
  PyList_SET_ITEM(__pyx_t_9, 0, __pyx_int_5);
  __Pyx_INCREF(__pyx_int_6);
  __Pyx_GIVEREF(__pyx_int_6);
  PyList_SET_ITEM(__pyx_t_9, 1, __pyx_int_6);
  __pyx_t_10 = PyList_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_10, 2, __pyx_t_9);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_9) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2371, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2371, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2371, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2371, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_Pts = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":2372
 *     assert t is None or C, "Arg t must be None, a scalar or an iterable !"
 *     Pts = np.array([[1,2],[3,4],[5,6]])
 *     NP = Pts.shape[1]             # <<<<<<<<<<<<<<
 *     try:
 *         out = ff(Pts, t=t)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2372, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_NP = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":2373
 *     Pts = np.array([[1,2],[3,4],[5,6]])
 *     NP = Pts.shape[1]
 *     try:             # <<<<<<<<<<<<<<
 *         out = ff(Pts, t=t)
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_13);
    /*try:*/ {

      /* "tofu/geom/_GG03.pyx":2374
 *     NP = Pts.shape[1]
 *     try:
 *         out = ff(Pts, t=t)             # <<<<<<<<<<<<<<
 *     except Exception:
 *         Str = stre+" must take one positional arg: a (3,N) np.ndarray"
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2374, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_Pts);
      __Pyx_GIVEREF(__pyx_v_Pts);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_Pts);
      __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2374, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2374, __pyx_L13_error)
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2374, __pyx_L13_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_out = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "tofu/geom/_GG03.pyx":2373
 *     Pts = np.array([[1,2],[3,4],[5,6]])
 *     NP = Pts.shape[1]
 *     try:             # <<<<<<<<<<<<<<
 *         out = ff(Pts, t=t)
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    goto __pyx_L18_try_end;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "tofu/geom/_GG03.pyx":2375
 *     try:
 *         out = ff(Pts, t=t)
 *     except Exception:             # <<<<<<<<<<<<<<
 *         Str = stre+" must take one positional arg: a (3,N) np.ndarray"
 *         assert False, Str
 */
    __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_14) {
      __Pyx_AddTraceback("tofu.geom._GG03.check_ff", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_2) < 0) __PYX_ERR(0, 2375, __pyx_L15_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "tofu/geom/_GG03.pyx":2376
 *         out = ff(Pts, t=t)
 *     except Exception:
 *         Str = stre+" must take one positional arg: a (3,N) np.ndarray"             # <<<<<<<<<<<<<<
 *         assert False, Str
 *     if hasattr(t,'__iter__'):
 */
      __pyx_t_10 = PyNumber_Add(__pyx_v_stre, __pyx_kp_s_must_take_one_positional_arg_a); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2376, __pyx_L15_except_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_v_Str = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "tofu/geom/_GG03.pyx":2377
 *     except Exception:
 *         Str = stre+" must take one positional arg: a (3,N) np.ndarray"
 *         assert False, Str             # <<<<<<<<<<<<<<
 *     if hasattr(t,'__iter__'):
 *         nt = len(t)
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!0)) {
          __pyx_t_10 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2377, __pyx_L15_except_error)
          __Pyx_GOTREF(__pyx_t_10);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_10);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __PYX_ERR(0, 2377, __pyx_L15_except_error)
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L14_exception_handled;
    }
    goto __pyx_L15_except_error;
    __pyx_L15_except_error:;

    /* "tofu/geom/_GG03.pyx":2373
 *     Pts = np.array([[1,2],[3,4],[5,6]])
 *     NP = Pts.shape[1]
 *     try:             # <<<<<<<<<<<<<<
 *         out = ff(Pts, t=t)
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    goto __pyx_L1_error;
    __pyx_L14_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_ExceptionReset(__pyx_t_11, __pyx_t_12, __pyx_t_13);
    __pyx_L18_try_end:;
  }

  /* "tofu/geom/_GG03.pyx":2378
 *         Str = stre+" must take one positional arg: a (3,N) np.ndarray"
 *         assert False, Str
 *     if hasattr(t,'__iter__'):             # <<<<<<<<<<<<<<
 *         nt = len(t)
 *         Str = ("ff(Pts,t=t), where Pts is a (3,N) np.array and "
 */
  __pyx_t_1 = __Pyx_HasAttr(__pyx_v_t, __pyx_n_s_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2378, __pyx_L1_error)
  __pyx_t_8 = (__pyx_t_1 != 0);
  if (__pyx_t_8) {

    /* "tofu/geom/_GG03.pyx":2379
 *         assert False, Str
 *     if hasattr(t,'__iter__'):
 *         nt = len(t)             # <<<<<<<<<<<<<<
 *         Str = ("ff(Pts,t=t), where Pts is a (3,N) np.array and "
 *                +"t a len()=nt iterable, must return a (nt,N) np.ndarray !")
 */
    __pyx_t_15 = PyObject_Length(__pyx_v_t); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2379, __pyx_L1_error)
    __pyx_v_nt = __pyx_t_15;

    /* "tofu/geom/_GG03.pyx":2381
 *         nt = len(t)
 *         Str = ("ff(Pts,t=t), where Pts is a (3,N) np.array and "
 *                +"t a len()=nt iterable, must return a (nt,N) np.ndarray !")             # <<<<<<<<<<<<<<
 *         assert type(out) is np.ndarray and out.shape==(nt,NP), Str
 *     else:
 */
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_ff_Pts_t_t_where_Pts_is_a_3_N_np, __pyx_kp_s_t_a_len_nt_iterable_must_return); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2381, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_Str, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2382
 *         Str = ("ff(Pts,t=t), where Pts is a (3,N) np.array and "
 *                +"t a len()=nt iterable, must return a (nt,N) np.ndarray !")
 *         assert type(out) is np.ndarray and out.shape==(nt,NP), Str             # <<<<<<<<<<<<<<
 *     else:
 *         Str = ("When fed a (3,N) np.array only, or if t is a scalar,"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2382, __pyx_L1_error) }
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = (((PyObject *)Py_TYPE(__pyx_v_out)) == __pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = (__pyx_t_1 != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_8 = __pyx_t_7;
        goto __pyx_L22_bool_binop_done;
      }
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2382, __pyx_L1_error) }
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_nt); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
      __Pyx_INCREF(__pyx_v_NP);
      __Pyx_GIVEREF(__pyx_v_NP);
      PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_NP);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2382, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __pyx_t_7;
      __pyx_L22_bool_binop_done:;
      if (unlikely(!__pyx_t_8)) {
        __pyx_t_2 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2382, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __PYX_ERR(0, 2382, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2378
 *         Str = stre+" must take one positional arg: a (3,N) np.ndarray"
 *         assert False, Str
 *     if hasattr(t,'__iter__'):             # <<<<<<<<<<<<<<
 *         nt = len(t)
 *         Str = ("ff(Pts,t=t), where Pts is a (3,N) np.array and "
 */
    goto __pyx_L21;
  }

  /* "tofu/geom/_GG03.pyx":2384
 *         assert type(out) is np.ndarray and out.shape==(nt,NP), Str
 *     else:
 *         Str = ("When fed a (3,N) np.array only, or if t is a scalar,"             # <<<<<<<<<<<<<<
 *                +" ff must return a (N,) np.ndarray !")
 *         assert type(out) is np.ndarray and out.shape==(NP,), Str
 */
  /*else*/ {

    /* "tofu/geom/_GG03.pyx":2385
 *     else:
 *         Str = ("When fed a (3,N) np.array only, or if t is a scalar,"
 *                +" ff must return a (N,) np.ndarray !")             # <<<<<<<<<<<<<<
 *         assert type(out) is np.ndarray and out.shape==(NP,), Str
 * 
 */
    __pyx_t_2 = PyNumber_Add(__pyx_kp_s_When_fed_a_3_N_np_array_only_or, __pyx_kp_s_ff_must_return_a_N_np_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2385, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_Str, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2386
 *         Str = ("When fed a (3,N) np.array only, or if t is a scalar,"
 *                +" ff must return a (N,) np.ndarray !")
 *         assert type(out) is np.ndarray and out.shape==(NP,), Str             # <<<<<<<<<<<<<<
 * 
 *     ani = ('Vect' in kw) if Ani is None else Ani
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2386, __pyx_L1_error) }
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_7 = (((PyObject *)Py_TYPE(__pyx_v_out)) == __pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = (__pyx_t_7 != 0);
      if (__pyx_t_1) {
      } else {
        __pyx_t_8 = __pyx_t_1;
        goto __pyx_L24_bool_binop_done;
      }
      if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2386, __pyx_L1_error) }
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2386, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_NP);
      __Pyx_GIVEREF(__pyx_v_NP);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_NP);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2386, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2386, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __pyx_t_1;
      __pyx_L24_bool_binop_done:;
      if (unlikely(!__pyx_t_8)) {
        __pyx_t_3 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2386, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(0, 2386, __pyx_L1_error)
      }
    }
    #endif
  }
  __pyx_L21:;

  /* "tofu/geom/_GG03.pyx":2388
 *         assert type(out) is np.ndarray and out.shape==(NP,), Str
 * 
 *     ani = ('Vect' in kw) if Ani is None else Ani             # <<<<<<<<<<<<<<
 *     if ani:
 *         Str = "If Ani=True, ff must take a keyword argument 'Vect=None' !"
 */
  __pyx_t_8 = (__pyx_v_Ani == Py_None);
  if ((__pyx_t_8 != 0)) {
    __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_Vect, __pyx_v_kw, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2388, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2388, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 2388, __pyx_L1_error)
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    if (!(likely(((__pyx_v_Ani) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Ani, __pyx_ptype_7cpython_4bool_bool))))) __PYX_ERR(0, 2388, __pyx_L1_error)
    __Pyx_INCREF(__pyx_v_Ani);
    __pyx_t_3 = __pyx_v_Ani;
  }
  __pyx_v_ani = ((PyBoolObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "tofu/geom/_GG03.pyx":2389
 * 
 *     ani = ('Vect' in kw) if Ani is None else Ani
 *     if ani:             # <<<<<<<<<<<<<<
 *         Str = "If Ani=True, ff must take a keyword argument 'Vect=None' !"
 *         assert 'Vect' in kw, Str
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2389, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "tofu/geom/_GG03.pyx":2390
 *     ani = ('Vect' in kw) if Ani is None else Ani
 *     if ani:
 *         Str = "If Ani=True, ff must take a keyword argument 'Vect=None' !"             # <<<<<<<<<<<<<<
 *         assert 'Vect' in kw, Str
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)
 */
    __Pyx_INCREF(__pyx_kp_s_If_Ani_True_ff_must_take_a_keywo);
    __Pyx_DECREF_SET(__pyx_v_Str, __pyx_kp_s_If_Ani_True_ff_must_take_a_keywo);

    /* "tofu/geom/_GG03.pyx":2391
 *     if ani:
 *         Str = "If Ani=True, ff must take a keyword argument 'Vect=None' !"
 *         assert 'Vect' in kw, Str             # <<<<<<<<<<<<<<
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)
 *         try:
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_Vect, __pyx_v_kw, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2391, __pyx_L1_error)
      if (unlikely(!(__pyx_t_8 != 0))) {
        __pyx_t_3 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(0, 2391, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2392
 *         Str = "If Ani=True, ff must take a keyword argument 'Vect=None' !"
 *         assert 'Vect' in kw, Str
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)             # <<<<<<<<<<<<<<
 *         try:
 *             out = ff(Pts, Vect=Vect, t=t)
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_Vuniq)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2392, __pyx_L1_error)
    if (__pyx_t_8) {
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_1);
      __Pyx_INCREF(__pyx_int_2);
      __Pyx_GIVEREF(__pyx_int_2);
      PyList_SET_ITEM(__pyx_t_5, 1, __pyx_int_2);
      __Pyx_INCREF(__pyx_int_3);
      __Pyx_GIVEREF(__pyx_int_3);
      PyList_SET_ITEM(__pyx_t_5, 2, __pyx_int_3);
      __pyx_t_9 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
          PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_5};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else
        #endif
        {
          __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL;
          __Pyx_GIVEREF(__pyx_t_5);
          PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_3 = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_ones); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_Pts, __pyx_n_s_shape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2392, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_10};
          __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_10};
          __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        } else
        #endif
        {
          __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_10);
          __pyx_t_10 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2392, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_3 = __pyx_t_2;
      __pyx_t_2 = 0;
    }
    __pyx_v_Vect = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "tofu/geom/_GG03.pyx":2393
 *         assert 'Vect' in kw, Str
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)
 *         try:             # <<<<<<<<<<<<<<
 *             out = ff(Pts, Vect=Vect, t=t)
 *         except Exception:
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_11);
      /*try:*/ {

        /* "tofu/geom/_GG03.pyx":2394
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)
 *         try:
 *             out = ff(Pts, Vect=Vect, t=t)             # <<<<<<<<<<<<<<
 *         except Exception:
 *             Str = "If Ani=True, ff must handle multiple points Pts (3,N) with "
 */
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2394, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_Pts);
        __Pyx_GIVEREF(__pyx_v_Pts);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_Pts);
        __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2394, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_Vect, __pyx_v_Vect) < 0) __PYX_ERR(0, 2394, __pyx_L27_error)
        if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2394, __pyx_L27_error)
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2394, __pyx_L27_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF_SET(__pyx_v_out, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "tofu/geom/_GG03.pyx":2393
 *         assert 'Vect' in kw, Str
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)
 *         try:             # <<<<<<<<<<<<<<
 *             out = ff(Pts, Vect=Vect, t=t)
 *         except Exception:
 */
      }
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L32_try_end;
      __pyx_L27_error:;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "tofu/geom/_GG03.pyx":2395
 *         try:
 *             out = ff(Pts, Vect=Vect, t=t)
 *         except Exception:             # <<<<<<<<<<<<<<
 *             Str = "If Ani=True, ff must handle multiple points Pts (3,N) with "
 *             if Vuniq:
 */
      __pyx_t_14 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
      if (__pyx_t_14) {
        __Pyx_AddTraceback("tofu.geom._GG03.check_ff", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_3) < 0) __PYX_ERR(0, 2395, __pyx_L29_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_3);

        /* "tofu/geom/_GG03.pyx":2396
 *             out = ff(Pts, Vect=Vect, t=t)
 *         except Exception:
 *             Str = "If Ani=True, ff must handle multiple points Pts (3,N) with "             # <<<<<<<<<<<<<<
 *             if Vuniq:
 *                 Str += "a unique common vector (Vect as a len()=3 iterable)"
 */
        __Pyx_INCREF(__pyx_kp_s_If_Ani_True_ff_must_handle_multi);
        __Pyx_DECREF_SET(__pyx_v_Str, __pyx_kp_s_If_Ani_True_ff_must_handle_multi);

        /* "tofu/geom/_GG03.pyx":2397
 *         except Exception:
 *             Str = "If Ani=True, ff must handle multiple points Pts (3,N) with "
 *             if Vuniq:             # <<<<<<<<<<<<<<
 *                 Str += "a unique common vector (Vect as a len()=3 iterable)"
 *             else:
 */
        __pyx_t_8 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_Vuniq)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2397, __pyx_L29_except_error)
        if (__pyx_t_8) {

          /* "tofu/geom/_GG03.pyx":2398
 *             Str = "If Ani=True, ff must handle multiple points Pts (3,N) with "
 *             if Vuniq:
 *                 Str += "a unique common vector (Vect as a len()=3 iterable)"             # <<<<<<<<<<<<<<
 *             else:
 *                 Str += "multiple vectors (Vect as a (3,N) np.ndarray)"
 */
          __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_Str, __pyx_kp_s_a_unique_common_vector_Vect_as_a); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2398, __pyx_L29_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF_SET(__pyx_v_Str, __pyx_t_9);
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2397
 *         except Exception:
 *             Str = "If Ani=True, ff must handle multiple points Pts (3,N) with "
 *             if Vuniq:             # <<<<<<<<<<<<<<
 *                 Str += "a unique common vector (Vect as a len()=3 iterable)"
 *             else:
 */
          goto __pyx_L35;
        }

        /* "tofu/geom/_GG03.pyx":2400
 *                 Str += "a unique common vector (Vect as a len()=3 iterable)"
 *             else:
 *                 Str += "multiple vectors (Vect as a (3,N) np.ndarray)"             # <<<<<<<<<<<<<<
 *             assert False, Str
 *         if hasattr(t,'__iter__'):
 */
        /*else*/ {
          __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_Str, __pyx_kp_s_multiple_vectors_Vect_as_a_3_N_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2400, __pyx_L29_except_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF_SET(__pyx_v_Str, __pyx_t_9);
          __pyx_t_9 = 0;
        }
        __pyx_L35:;

        /* "tofu/geom/_GG03.pyx":2401
 *             else:
 *                 Str += "multiple vectors (Vect as a (3,N) np.ndarray)"
 *             assert False, Str             # <<<<<<<<<<<<<<
 *         if hasattr(t,'__iter__'):
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 */
        #ifndef CYTHON_WITHOUT_ASSERTIONS
        if (unlikely(!Py_OptimizeFlag)) {
          if (unlikely(!0)) {
            __pyx_t_9 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2401, __pyx_L29_except_error)
            __Pyx_GOTREF(__pyx_t_9);
            PyErr_SetObject(PyExc_AssertionError, __pyx_t_9);
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __PYX_ERR(0, 2401, __pyx_L29_except_error)
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L28_exception_handled;
      }
      goto __pyx_L29_except_error;
      __pyx_L29_except_error:;

      /* "tofu/geom/_GG03.pyx":2393
 *         assert 'Vect' in kw, Str
 *         Vect = np.array([1,2,3]) if Vuniq else np.ones(Pts.shape)
 *         try:             # <<<<<<<<<<<<<<
 *             out = ff(Pts, Vect=Vect, t=t)
 *         except Exception:
 */
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
      goto __pyx_L1_error;
      __pyx_L28_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_12, __pyx_t_11);
      __pyx_L32_try_end:;
    }

    /* "tofu/geom/_GG03.pyx":2402
 *                 Str += "multiple vectors (Vect as a (3,N) np.ndarray)"
 *             assert False, Str
 *         if hasattr(t,'__iter__'):             # <<<<<<<<<<<<<<
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")
 */
    __pyx_t_8 = __Pyx_HasAttr(__pyx_v_t, __pyx_n_s_iter); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 2402, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_8 != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":2404
 *         if hasattr(t,'__iter__'):
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")             # <<<<<<<<<<<<<<
 *             assert type(out) is np.ndarray and out.shape==(nt,NP), Str
 *         else:
 */
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s_If_Ani_True_ff_must_return_a_nt, __pyx_kp_s_Pts_is_3_N_Vect_is_provided_and); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2404, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_Str, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "tofu/geom/_GG03.pyx":2405
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")
 *             assert type(out) is np.ndarray and out.shape==(nt,NP), Str             # <<<<<<<<<<<<<<
 *         else:
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2405, __pyx_L1_error) }
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_8 = (((PyObject *)Py_TYPE(__pyx_v_out)) == __pyx_t_2);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_7 = (__pyx_t_8 != 0);
        if (__pyx_t_7) {
        } else {
          __pyx_t_1 = __pyx_t_7;
          goto __pyx_L37_bool_binop_done;
        }
        if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2405, __pyx_L1_error) }
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_nt); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __Pyx_INCREF(__pyx_v_NP);
        __Pyx_GIVEREF(__pyx_v_NP);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_NP);
        __pyx_t_3 = 0;
        __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 2405, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_1 = __pyx_t_7;
        __pyx_L37_bool_binop_done:;
        if (unlikely(!__pyx_t_1)) {
          __pyx_t_3 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2405, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_3);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __PYX_ERR(0, 2405, __pyx_L1_error)
        }
      }
      #endif

      /* "tofu/geom/_GG03.pyx":2402
 *                 Str += "multiple vectors (Vect as a (3,N) np.ndarray)"
 *             assert False, Str
 *         if hasattr(t,'__iter__'):             # <<<<<<<<<<<<<<
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")
 */
      goto __pyx_L36;
    }

    /* "tofu/geom/_GG03.pyx":2407
 *             assert type(out) is np.ndarray and out.shape==(nt,NP), Str
 *         else:
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "             # <<<<<<<<<<<<<<
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")
 *             assert type(out) is np.ndarray and out.shape==(NP,), Str
 */
    /*else*/ {

      /* "tofu/geom/_GG03.pyx":2408
 *         else:
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")             # <<<<<<<<<<<<<<
 *             assert type(out) is np.ndarray and out.shape==(NP,), Str
 *     return ani
 */
      __pyx_t_3 = PyNumber_Add(__pyx_kp_s_If_Ani_True_ff_must_return_a_nt, __pyx_kp_s_Pts_is_3_N_Vect_is_provided_and); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2408, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_Str, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "tofu/geom/_GG03.pyx":2409
 *             Str = ("If Ani=True, ff must return a (nt,N) np.ndarray when "
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")
 *             assert type(out) is np.ndarray and out.shape==(NP,), Str             # <<<<<<<<<<<<<<
 *     return ani
 * 
 */
      #ifndef CYTHON_WITHOUT_ASSERTIONS
      if (unlikely(!Py_OptimizeFlag)) {
        if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2409, __pyx_L1_error) }
        __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_ndarray); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_7 = (((PyObject *)Py_TYPE(__pyx_v_out)) == __pyx_t_4);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_8 = (__pyx_t_7 != 0);
        if (__pyx_t_8) {
        } else {
          __pyx_t_1 = __pyx_t_8;
          goto __pyx_L39_bool_binop_done;
        }
        if (unlikely(!__pyx_v_out)) { __Pyx_RaiseUnboundLocalError("out"); __PYX_ERR(0, 2409, __pyx_L1_error) }
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_out, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_v_NP);
        __Pyx_GIVEREF(__pyx_v_NP);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_NP);
        __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 2409, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_1 = __pyx_t_8;
        __pyx_L39_bool_binop_done:;
        if (unlikely(!__pyx_t_1)) {
          __pyx_t_2 = PyTuple_Pack(1, __pyx_v_Str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2409, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          PyErr_SetObject(PyExc_AssertionError, __pyx_t_2);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __PYX_ERR(0, 2409, __pyx_L1_error)
        }
      }
      #endif
    }
    __pyx_L36:;

    /* "tofu/geom/_GG03.pyx":2389
 * 
 *     ani = ('Vect' in kw) if Ani is None else Ani
 *     if ani:             # <<<<<<<<<<<<<<
 *         Str = "If Ani=True, ff must take a keyword argument 'Vect=None' !"
 *         assert 'Vect' in kw, Str
 */
  }

  /* "tofu/geom/_GG03.pyx":2410
 *                    +"Pts is (3,N), Vect is provided and t is (nt,)")
 *             assert type(out) is np.ndarray and out.shape==(NP,), Str
 *     return ani             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_ani));
  __pyx_r = ((PyObject *)__pyx_v_ani);
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2362
 * 
 * 
 * def check_ff(ff, t=None, Ani=None, bool Vuniq=False):             # <<<<<<<<<<<<<<
 *     cdef bool ani
 *     stre = "Input emissivity function (ff)"
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("tofu.geom._GG03.check_ff", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_ani);
  __Pyx_XDECREF(__pyx_v_stre);
  __Pyx_XDECREF(__pyx_v_na);
  __Pyx_XDECREF(__pyx_v_kw);
  __Pyx_XDECREF(__pyx_v_Pts);
  __Pyx_XDECREF(__pyx_v_NP);
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF(__pyx_v_Str);
  __Pyx_XDECREF(__pyx_v_Vect);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2421
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},
 *                    str dLMode='abs', str method='simps',
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_51LOS_calc_signal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4tofu_4geom_5_GG03_50LOS_calc_signal[] = " Return the sampled line, with the specified method\n\n    'linspace': return the N+1 edges, including the first and last point\n    'sum' :     return N segments centers\n    'simps':    return N+1 egdes, N even (for scipy.integrate.simps)\n    'romb' :    return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb)\n    ";
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_51LOS_calc_signal = {"LOS_calc_signal", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_51LOS_calc_signal, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4tofu_4geom_5_GG03_50LOS_calc_signal};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_51LOS_calc_signal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_ff = 0;
  __Pyx_memviewslice __pyx_v_Ds = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_us = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_dL = 0;
  __Pyx_memviewslice __pyx_v_DLs = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_t = 0;
  PyObject *__pyx_v_Ani = 0;
  PyObject *__pyx_v_fkwdargs = 0;
  PyObject *__pyx_v_dLMode = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_Test = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LOS_calc_signal (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ff,&__pyx_n_s_Ds,&__pyx_n_s_us,&__pyx_n_s_dL,&__pyx_n_s_DLs,&__pyx_n_s_t,&__pyx_n_s_Ani,&__pyx_n_s_fkwdargs,&__pyx_n_s_dLMode,&__pyx_n_s_method,&__pyx_n_s_Test,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};

    /* "tofu/geom/_GG03.pyx":2422
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},             # <<<<<<<<<<<<<<
 *                    str dLMode='abs', str method='simps',
 *                    Test=True):
 */
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = __pyx_k__262;
    values[8] = ((PyObject*)__pyx_n_s_abs);
    values[9] = ((PyObject*)__pyx_n_s_simps);

    /* "tofu/geom/_GG03.pyx":2424
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},
 *                    str dLMode='abs', str method='simps',
 *                    Test=True):             # <<<<<<<<<<<<<<
 * 
 *     """ Return the sampled line, with the specified method
 */
    values[10] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ff)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Ds)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_calc_signal", 0, 5, 11, 1); __PYX_ERR(0, 2421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_us)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_calc_signal", 0, 5, 11, 2); __PYX_ERR(0, 2421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dL)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_calc_signal", 0, 5, 11, 3); __PYX_ERR(0, 2421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_DLs)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_calc_signal", 0, 5, 11, 4); __PYX_ERR(0, 2421, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_t);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Ani);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fkwdargs);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dLMode);
          if (value) { values[8] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method);
          if (value) { values[9] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Test);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "LOS_calc_signal") < 0)) __PYX_ERR(0, 2421, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        CYTHON_FALLTHROUGH;
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        CYTHON_FALLTHROUGH;
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        CYTHON_FALLTHROUGH;
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        CYTHON_FALLTHROUGH;
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_ff = values[0];
    __pyx_v_Ds = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[1]); if (unlikely(!__pyx_v_Ds.memview)) __PYX_ERR(0, 2421, __pyx_L3_error)
    __pyx_v_us = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[2]); if (unlikely(!__pyx_v_us.memview)) __PYX_ERR(0, 2421, __pyx_L3_error)
    __pyx_v_dL = values[3];
    __pyx_v_DLs = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[4]); if (unlikely(!__pyx_v_DLs.memview)) __PYX_ERR(0, 2422, __pyx_L3_error)
    __pyx_v_t = values[5];
    __pyx_v_Ani = values[6];
    __pyx_v_fkwdargs = ((PyObject*)values[7]);
    __pyx_v_dLMode = ((PyObject*)values[8]);
    __pyx_v_method = ((PyObject*)values[9]);
    __pyx_v_Test = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("LOS_calc_signal", 0, 5, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2421, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_calc_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_fkwdargs), (&PyDict_Type), 1, "fkwdargs", 1))) __PYX_ERR(0, 2422, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dLMode), (&PyString_Type), 1, "dLMode", 1))) __PYX_ERR(0, 2423, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_method), (&PyString_Type), 1, "method", 1))) __PYX_ERR(0, 2423, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_50LOS_calc_signal(__pyx_self, __pyx_v_ff, __pyx_v_Ds, __pyx_v_us, __pyx_v_dL, __pyx_v_DLs, __pyx_v_t, __pyx_v_Ani, __pyx_v_fkwdargs, __pyx_v_dLMode, __pyx_v_method, __pyx_v_Test);

  /* "tofu/geom/_GG03.pyx":2421
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},
 *                    str dLMode='abs', str method='simps',
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_50LOS_calc_signal(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ff, __Pyx_memviewslice __pyx_v_Ds, __Pyx_memviewslice __pyx_v_us, PyObject *__pyx_v_dL, __Pyx_memviewslice __pyx_v_DLs, PyObject *__pyx_v_t, PyObject *__pyx_v_Ani, PyObject *__pyx_v_fkwdargs, PyObject *__pyx_v_dLMode, PyObject *__pyx_v_method, PyObject *__pyx_v_Test) {
  PyObject *__pyx_v_C0 = NULL;
  PyObject *__pyx_v_C1 = NULL;
  PyBoolObject *__pyx_v_ani = 0;
  unsigned int __pyx_v_nt;
  unsigned int __pyx_v_axm;
  unsigned int __pyx_v_ii;
  unsigned int __pyx_v_jj;
  unsigned int __pyx_v_N;
  unsigned int __pyx_v_ND;
  double __pyx_v_kkk;
  double __pyx_v_D0;
  double __pyx_v_D1;
  double __pyx_v_D2;
  double __pyx_v_u0;
  double __pyx_v_u1;
  double __pyx_v_u2;
  double __pyx_v_dl0;
  double __pyx_v_dl;
  PyArrayObject *__pyx_v_pts = 0;
  PyArrayObject *__pyx_v_sig = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_pts;
  __Pyx_Buffer __pyx_pybuffer_pts;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_sig;
  __Pyx_Buffer __pyx_pybuffer_sig;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyArrayObject *__pyx_t_11 = NULL;
  double __pyx_t_12;
  unsigned int __pyx_t_13;
  unsigned int __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  size_t __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  size_t __pyx_t_18;
  Py_ssize_t __pyx_t_19;
  size_t __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  size_t __pyx_t_22;
  double __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  size_t __pyx_t_25;
  double __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  size_t __pyx_t_28;
  Py_ssize_t __pyx_t_29;
  size_t __pyx_t_30;
  Py_ssize_t __pyx_t_31;
  size_t __pyx_t_32;
  PyArrayObject *__pyx_t_33 = NULL;
  int __pyx_t_34;
  PyObject *__pyx_t_35 = NULL;
  PyObject *__pyx_t_36 = NULL;
  PyObject *__pyx_t_37 = NULL;
  unsigned int __pyx_t_38;
  unsigned int __pyx_t_39;
  Py_ssize_t __pyx_t_40;
  size_t __pyx_t_41;
  Py_ssize_t __pyx_t_42;
  size_t __pyx_t_43;
  Py_ssize_t __pyx_t_44;
  size_t __pyx_t_45;
  long __pyx_t_46;
  Py_ssize_t __pyx_t_47;
  size_t __pyx_t_48;
  Py_ssize_t __pyx_t_49;
  size_t __pyx_t_50;
  Py_ssize_t __pyx_t_51;
  size_t __pyx_t_52;
  Py_ssize_t __pyx_t_53;
  size_t __pyx_t_54;
  Py_ssize_t __pyx_t_55;
  size_t __pyx_t_56;
  Py_ssize_t __pyx_t_57;
  size_t __pyx_t_58;
  Py_ssize_t __pyx_t_59;
  size_t __pyx_t_60;
  Py_ssize_t __pyx_t_61;
  size_t __pyx_t_62;
  Py_ssize_t __pyx_t_63;
  size_t __pyx_t_64;
  Py_ssize_t __pyx_t_65;
  size_t __pyx_t_66;
  Py_ssize_t __pyx_t_67;
  size_t __pyx_t_68;
  Py_ssize_t __pyx_t_69;
  size_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  size_t __pyx_t_72;
  Py_ssize_t __pyx_t_73;
  size_t __pyx_t_74;
  Py_ssize_t __pyx_t_75;
  size_t __pyx_t_76;
  Py_ssize_t __pyx_t_77;
  size_t __pyx_t_78;
  Py_ssize_t __pyx_t_79;
  size_t __pyx_t_80;
  Py_ssize_t __pyx_t_81;
  size_t __pyx_t_82;
  Py_ssize_t __pyx_t_83;
  size_t __pyx_t_84;
  Py_ssize_t __pyx_t_85;
  size_t __pyx_t_86;
  Py_ssize_t __pyx_t_87;
  size_t __pyx_t_88;
  Py_ssize_t __pyx_t_89;
  size_t __pyx_t_90;
  Py_ssize_t __pyx_t_91;
  size_t __pyx_t_92;
  Py_ssize_t __pyx_t_93;
  size_t __pyx_t_94;
  Py_ssize_t __pyx_t_95;
  size_t __pyx_t_96;
  Py_ssize_t __pyx_t_97;
  size_t __pyx_t_98;
  Py_ssize_t __pyx_t_99;
  size_t __pyx_t_100;
  Py_ssize_t __pyx_t_101;
  size_t __pyx_t_102;
  Py_ssize_t __pyx_t_103;
  size_t __pyx_t_104;
  Py_ssize_t __pyx_t_105;
  size_t __pyx_t_106;
  Py_ssize_t __pyx_t_107;
  size_t __pyx_t_108;
  Py_ssize_t __pyx_t_109;
  size_t __pyx_t_110;
  Py_ssize_t __pyx_t_111;
  size_t __pyx_t_112;
  Py_ssize_t __pyx_t_113;
  size_t __pyx_t_114;
  Py_ssize_t __pyx_t_115;
  size_t __pyx_t_116;
  Py_ssize_t __pyx_t_117;
  size_t __pyx_t_118;
  Py_ssize_t __pyx_t_119;
  size_t __pyx_t_120;
  Py_ssize_t __pyx_t_121;
  size_t __pyx_t_122;
  Py_ssize_t __pyx_t_123;
  size_t __pyx_t_124;
  Py_ssize_t __pyx_t_125;
  size_t __pyx_t_126;
  Py_ssize_t __pyx_t_127;
  size_t __pyx_t_128;
  Py_ssize_t __pyx_t_129;
  size_t __pyx_t_130;
  Py_ssize_t __pyx_t_131;
  size_t __pyx_t_132;
  Py_ssize_t __pyx_t_133;
  size_t __pyx_t_134;
  Py_ssize_t __pyx_t_135;
  size_t __pyx_t_136;
  Py_ssize_t __pyx_t_137;
  size_t __pyx_t_138;
  Py_ssize_t __pyx_t_139;
  size_t __pyx_t_140;
  Py_ssize_t __pyx_t_141;
  size_t __pyx_t_142;
  Py_ssize_t __pyx_t_143;
  size_t __pyx_t_144;
  Py_ssize_t __pyx_t_145;
  size_t __pyx_t_146;
  Py_ssize_t __pyx_t_147;
  size_t __pyx_t_148;
  Py_ssize_t __pyx_t_149;
  size_t __pyx_t_150;
  Py_ssize_t __pyx_t_151;
  size_t __pyx_t_152;
  Py_ssize_t __pyx_t_153;
  size_t __pyx_t_154;
  Py_ssize_t __pyx_t_155;
  size_t __pyx_t_156;
  Py_ssize_t __pyx_t_157;
  size_t __pyx_t_158;
  Py_ssize_t __pyx_t_159;
  size_t __pyx_t_160;
  Py_ssize_t __pyx_t_161;
  size_t __pyx_t_162;
  Py_ssize_t __pyx_t_163;
  size_t __pyx_t_164;
  Py_ssize_t __pyx_t_165;
  size_t __pyx_t_166;
  Py_ssize_t __pyx_t_167;
  size_t __pyx_t_168;
  Py_ssize_t __pyx_t_169;
  size_t __pyx_t_170;
  Py_ssize_t __pyx_t_171;
  size_t __pyx_t_172;
  Py_ssize_t __pyx_t_173;
  size_t __pyx_t_174;
  Py_ssize_t __pyx_t_175;
  size_t __pyx_t_176;
  Py_ssize_t __pyx_t_177;
  size_t __pyx_t_178;
  Py_ssize_t __pyx_t_179;
  size_t __pyx_t_180;
  Py_ssize_t __pyx_t_181;
  size_t __pyx_t_182;
  Py_ssize_t __pyx_t_183;
  size_t __pyx_t_184;
  Py_ssize_t __pyx_t_185;
  size_t __pyx_t_186;
  Py_ssize_t __pyx_t_187;
  size_t __pyx_t_188;
  Py_ssize_t __pyx_t_189;
  size_t __pyx_t_190;
  Py_ssize_t __pyx_t_191;
  size_t __pyx_t_192;
  Py_ssize_t __pyx_t_193;
  size_t __pyx_t_194;
  Py_ssize_t __pyx_t_195;
  size_t __pyx_t_196;
  Py_ssize_t __pyx_t_197;
  size_t __pyx_t_198;
  Py_ssize_t __pyx_t_199;
  size_t __pyx_t_200;
  Py_ssize_t __pyx_t_201;
  size_t __pyx_t_202;
  Py_ssize_t __pyx_t_203;
  size_t __pyx_t_204;
  Py_ssize_t __pyx_t_205;
  size_t __pyx_t_206;
  Py_ssize_t __pyx_t_207;
  size_t __pyx_t_208;
  Py_ssize_t __pyx_t_209;
  size_t __pyx_t_210;
  Py_ssize_t __pyx_t_211;
  size_t __pyx_t_212;
  Py_ssize_t __pyx_t_213;
  size_t __pyx_t_214;
  Py_ssize_t __pyx_t_215;
  size_t __pyx_t_216;
  Py_ssize_t __pyx_t_217;
  size_t __pyx_t_218;
  Py_ssize_t __pyx_t_219;
  size_t __pyx_t_220;
  Py_ssize_t __pyx_t_221;
  size_t __pyx_t_222;
  Py_ssize_t __pyx_t_223;
  size_t __pyx_t_224;
  Py_ssize_t __pyx_t_225;
  size_t __pyx_t_226;
  Py_ssize_t __pyx_t_227;
  size_t __pyx_t_228;
  Py_ssize_t __pyx_t_229;
  size_t __pyx_t_230;
  Py_ssize_t __pyx_t_231;
  size_t __pyx_t_232;
  Py_ssize_t __pyx_t_233;
  size_t __pyx_t_234;
  Py_ssize_t __pyx_t_235;
  size_t __pyx_t_236;
  Py_ssize_t __pyx_t_237;
  size_t __pyx_t_238;
  Py_ssize_t __pyx_t_239;
  size_t __pyx_t_240;
  Py_ssize_t __pyx_t_241;
  size_t __pyx_t_242;
  Py_ssize_t __pyx_t_243;
  size_t __pyx_t_244;
  Py_ssize_t __pyx_t_245;
  size_t __pyx_t_246;
  Py_ssize_t __pyx_t_247;
  size_t __pyx_t_248;
  Py_ssize_t __pyx_t_249;
  size_t __pyx_t_250;
  Py_ssize_t __pyx_t_251;
  size_t __pyx_t_252;
  Py_ssize_t __pyx_t_253;
  size_t __pyx_t_254;
  Py_ssize_t __pyx_t_255;
  size_t __pyx_t_256;
  Py_ssize_t __pyx_t_257;
  size_t __pyx_t_258;
  Py_ssize_t __pyx_t_259;
  size_t __pyx_t_260;
  Py_ssize_t __pyx_t_261;
  size_t __pyx_t_262;
  Py_ssize_t __pyx_t_263;
  size_t __pyx_t_264;
  Py_ssize_t __pyx_t_265;
  size_t __pyx_t_266;
  Py_ssize_t __pyx_t_267;
  size_t __pyx_t_268;
  Py_ssize_t __pyx_t_269;
  size_t __pyx_t_270;
  Py_ssize_t __pyx_t_271;
  size_t __pyx_t_272;
  Py_ssize_t __pyx_t_273;
  size_t __pyx_t_274;
  Py_ssize_t __pyx_t_275;
  size_t __pyx_t_276;
  Py_ssize_t __pyx_t_277;
  size_t __pyx_t_278;
  Py_ssize_t __pyx_t_279;
  size_t __pyx_t_280;
  Py_ssize_t __pyx_t_281;
  size_t __pyx_t_282;
  Py_ssize_t __pyx_t_283;
  size_t __pyx_t_284;
  Py_ssize_t __pyx_t_285;
  size_t __pyx_t_286;
  Py_ssize_t __pyx_t_287;
  size_t __pyx_t_288;
  Py_ssize_t __pyx_t_289;
  size_t __pyx_t_290;
  Py_ssize_t __pyx_t_291;
  size_t __pyx_t_292;
  Py_ssize_t __pyx_t_293;
  size_t __pyx_t_294;
  Py_ssize_t __pyx_t_295;
  size_t __pyx_t_296;
  Py_ssize_t __pyx_t_297;
  size_t __pyx_t_298;
  Py_ssize_t __pyx_t_299;
  size_t __pyx_t_300;
  __Pyx_RefNannySetupContext("LOS_calc_signal", 0);
  __Pyx_INCREF(__pyx_v_dLMode);
  __Pyx_INCREF(__pyx_v_method);
  __pyx_pybuffer_pts.pybuffer.buf = NULL;
  __pyx_pybuffer_pts.refcount = 0;
  __pyx_pybuffernd_pts.data = NULL;
  __pyx_pybuffernd_pts.rcbuffer = &__pyx_pybuffer_pts;
  __pyx_pybuffer_sig.pybuffer.buf = NULL;
  __pyx_pybuffer_sig.refcount = 0;
  __pyx_pybuffernd_sig.data = NULL;
  __pyx_pybuffernd_sig.rcbuffer = &__pyx_pybuffer_sig;

  /* "tofu/geom/_GG03.pyx":2433
 *     'romb' :    return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb)
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_Test); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2433, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2434
 *     """
 *     if Test:
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"             # <<<<<<<<<<<<<<
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = ((__pyx_v_Ds.shape[0]) == (__pyx_v_us.shape[0]));
      if (__pyx_t_1) {
        __pyx_t_1 = ((__pyx_v_us.shape[0]) == 3);
      }
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_Ds_us_dim_0);
        __PYX_ERR(0, 2434, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2435
 *     if Test:
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"             # <<<<<<<<<<<<<<
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      if (unlikely(!(((__pyx_v_DLs.shape[0]) == 2) != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_DLs_dim_0);
        __PYX_ERR(0, 2435, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2436
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"             # <<<<<<<<<<<<<<
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = ((__pyx_v_Ds.shape[1]) == (__pyx_v_us.shape[1]));
      if (__pyx_t_1) {
        __pyx_t_1 = ((__pyx_v_us.shape[1]) == (__pyx_v_DLs.shape[1]));
      }
      if (unlikely(!(__pyx_t_1 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Args_Ds_us_DLs_1);
        __PYX_ERR(0, 2436, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2437
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 *         C0 = not hasattr(dL,'__iter__') and dL>0.             # <<<<<<<<<<<<<<
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 *         assert C0 or C1, "Arg dL must be >0. !"
 */
    __pyx_t_1 = __Pyx_HasAttr(__pyx_v_dL, __pyx_n_s_iter); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 2437, __pyx_L1_error)
    __pyx_t_3 = (!(__pyx_t_1 != 0));
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2437, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_dL, __pyx_float_0_, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2437, __pyx_L1_error)
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L4_bool_binop_done:;
    __pyx_v_C0 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2438
 *         assert Ds.shape[1]==us.shape[1]==DLs.shape[1], "Args Ds, us, DLs 1"
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)             # <<<<<<<<<<<<<<
 *         assert C0 or C1, "Arg dL must be >0. !"
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"
 */
    __pyx_t_3 = __Pyx_HasAttr(__pyx_v_dL, __pyx_n_s_iter); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2438, __pyx_L1_error)
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_5 = PyObject_Length(__pyx_v_dL); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2438, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_5 == (__pyx_v_Ds.shape[1]));
    if (__pyx_t_3) {
    } else {
      __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2438, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_all); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2438, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_RichCompare(__pyx_v_dL, __pyx_float_0_, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2438, __pyx_L1_error)
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2438, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2438, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2438, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2438, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_L6_bool_binop_done:;
    __pyx_v_C1 = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":2439
 *         C0 = not hasattr(dL,'__iter__') and dL>0.
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 *         assert C0 or C1, "Arg dL must be >0. !"             # <<<<<<<<<<<<<<
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_C0); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2439, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_C1); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2439, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_1;
      __pyx_L9_bool_binop_done:;
      if (unlikely(!__pyx_t_3)) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_dL_must_be_0);
        __PYX_ERR(0, 2439, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2440
 *         C1 = hasattr(dL,'__iter__') and len(dL)==Ds.shape[1] and np.all(dL>0.)
 *         assert C0 or C1, "Arg dL must be >0. !"
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"             # <<<<<<<<<<<<<<
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"
 *     # Testing function
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dLMode, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2440, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2440, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2440, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_abs, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2440, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_rel, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2440, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_1;
      __pyx_L11_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!(__pyx_t_3 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_dLMode_in_abs_rel);
        __PYX_ERR(0, 2440, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2441
 *         assert C0 or C1, "Arg dL must be >0. !"
 *         assert dLMode.lower() in ['abs','rel'], "Arg dLMode in ['abs','rel']"
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"             # <<<<<<<<<<<<<<
 *     # Testing function
 *     cdef bool ani = check_ff(ff,t=t,Ani=Ani)
 */
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(!Py_OptimizeFlag)) {
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2441, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2441, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2441, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2441, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2441, __pyx_L1_error)
      if (!__pyx_t_1) {
      } else {
        __pyx_t_3 = __pyx_t_1;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_n_s_romb, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2441, __pyx_L1_error)
      __pyx_t_3 = __pyx_t_1;
      __pyx_L13_bool_binop_done:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!(__pyx_t_3 != 0))) {
        PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_Arg_method);
        __PYX_ERR(0, 2441, __pyx_L1_error)
      }
    }
    #endif

    /* "tofu/geom/_GG03.pyx":2433
 *     'romb' :    return N+1 edges, N+1 = 2**k+1 (for scipy.integrate.romb)
 *     """
 *     if Test:             # <<<<<<<<<<<<<<
 *         assert Ds.shape[0]==us.shape[0]==3, "Args Ds, us - dim 0"
 *         assert DLs.shape[0]==2, "Arg DLs - dim 0"
 */
  }

  /* "tofu/geom/_GG03.pyx":2443
 *         assert method.lower() in ['sum','simps','romb'], "Arg method"
 *     # Testing function
 *     cdef bool ani = check_ff(ff,t=t,Ani=Ani)             # <<<<<<<<<<<<<<
 * 
 *     cdef unsigned int nt, axm, ii, jj, N, ND = Ds.shape[1]
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_check_ff); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_ff);
  __Pyx_GIVEREF(__pyx_v_ff);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ff);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_Ani, __pyx_v_Ani) < 0) __PYX_ERR(0, 2443, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_7cpython_4bool_bool))))) __PYX_ERR(0, 2443, __pyx_L1_error)
  __pyx_v_ani = ((PyBoolObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2445
 *     cdef bool ani = check_ff(ff,t=t,Ani=Ani)
 * 
 *     cdef unsigned int nt, axm, ii, jj, N, ND = Ds.shape[1]             # <<<<<<<<<<<<<<
 *     cdef double kkk, D0, D1, D2, u0, u1, u2, dl0, dl
 *     cdef cnp.ndarray[double,ndim=2] pts
 */
  __pyx_v_ND = (__pyx_v_Ds.shape[1]);

  /* "tofu/geom/_GG03.pyx":2448
 *     cdef double kkk, D0, D1, D2, u0, u1, u2, dl0, dl
 *     cdef cnp.ndarray[double,ndim=2] pts
 *     if t is None or not hasattr(t,'__iter__'):             # <<<<<<<<<<<<<<
 *         nt = 1
 *         axm = 0
 */
  __pyx_t_1 = (__pyx_v_t == Py_None);
  __pyx_t_10 = (__pyx_t_1 != 0);
  if (!__pyx_t_10) {
  } else {
    __pyx_t_3 = __pyx_t_10;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_10 = __Pyx_HasAttr(__pyx_v_t, __pyx_n_s_iter); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 2448, __pyx_L1_error)
  __pyx_t_1 = ((!(__pyx_t_10 != 0)) != 0);
  __pyx_t_3 = __pyx_t_1;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_3) {

    /* "tofu/geom/_GG03.pyx":2449
 *     cdef cnp.ndarray[double,ndim=2] pts
 *     if t is None or not hasattr(t,'__iter__'):
 *         nt = 1             # <<<<<<<<<<<<<<
 *         axm = 0
 *     else:
 */
    __pyx_v_nt = 1;

    /* "tofu/geom/_GG03.pyx":2450
 *     if t is None or not hasattr(t,'__iter__'):
 *         nt = 1
 *         axm = 0             # <<<<<<<<<<<<<<
 *     else:
 *         nt = len(t)
 */
    __pyx_v_axm = 0;

    /* "tofu/geom/_GG03.pyx":2448
 *     cdef double kkk, D0, D1, D2, u0, u1, u2, dl0, dl
 *     cdef cnp.ndarray[double,ndim=2] pts
 *     if t is None or not hasattr(t,'__iter__'):             # <<<<<<<<<<<<<<
 *         nt = 1
 *         axm = 0
 */
    goto __pyx_L16;
  }

  /* "tofu/geom/_GG03.pyx":2452
 *         axm = 0
 *     else:
 *         nt = len(t)             # <<<<<<<<<<<<<<
 *         axm = 1
 *     cdef cnp.ndarray[double,ndim=2] sig = np.empty((nt,ND),dtype=float)
 */
  /*else*/ {
    __pyx_t_5 = PyObject_Length(__pyx_v_t); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2452, __pyx_L1_error)
    __pyx_v_nt = __pyx_t_5;

    /* "tofu/geom/_GG03.pyx":2453
 *     else:
 *         nt = len(t)
 *         axm = 1             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=2] sig = np.empty((nt,ND),dtype=float)
 * 
 */
    __pyx_v_axm = 1;
  }
  __pyx_L16:;

  /* "tofu/geom/_GG03.pyx":2454
 *         nt = len(t)
 *         axm = 1
 *     cdef cnp.ndarray[double,ndim=2] sig = np.empty((nt,ND),dtype=float)             # <<<<<<<<<<<<<<
 * 
 *     dLMode = dLMode.lower()
 */
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nt); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ND); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __pyx_t_9 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2454, __pyx_L1_error)
  __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2454, __pyx_L1_error)
  __pyx_t_11 = ((PyArrayObject *)__pyx_t_9);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sig.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_sig = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sig.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2454, __pyx_L1_error)
    } else {__pyx_pybuffernd_sig.diminfo[0].strides = __pyx_pybuffernd_sig.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sig.diminfo[0].shape = __pyx_pybuffernd_sig.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_sig.diminfo[1].strides = __pyx_pybuffernd_sig.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_sig.diminfo[1].shape = __pyx_pybuffernd_sig.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_11 = 0;
  __pyx_v_sig = ((PyArrayObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2456
 *     cdef cnp.ndarray[double,ndim=2] sig = np.empty((nt,ND),dtype=float)
 * 
 *     dLMode = dLMode.lower()             # <<<<<<<<<<<<<<
 *     method = method.lower()
 *     # Case with unique dL
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dLMode, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2456, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2456, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2456, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 2456, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_dLMode, ((PyObject*)__pyx_t_9));
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2457
 * 
 *     dLMode = dLMode.lower()
 *     method = method.lower()             # <<<<<<<<<<<<<<
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_lower); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2457, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2457, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_9))||((__pyx_t_9) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_9)->tp_name), 0))) __PYX_ERR(0, 2457, __pyx_L1_error)
  __Pyx_DECREF_SET(__pyx_v_method, ((PyObject*)__pyx_t_9));
  __pyx_t_9 = 0;

  /* "tofu/geom/_GG03.pyx":2459
 *     method = method.lower()
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):             # <<<<<<<<<<<<<<
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 */
  __pyx_t_3 = __Pyx_HasAttr(__pyx_v_dL, __pyx_n_s_iter); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2459, __pyx_L1_error)
  __pyx_t_1 = ((!(__pyx_t_3 != 0)) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2460
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':
 */
    __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_dLMode, __pyx_n_s_rel, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2460, __pyx_L1_error)
    __pyx_t_3 = (__pyx_t_1 != 0);
    if (__pyx_t_3) {

      /* "tofu/geom/_GG03.pyx":2461
 *     if not hasattr(dL,'__iter__'):
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))             # <<<<<<<<<<<<<<
 *             if method=='sum':
 *                 for ii in range(0,ND):
 */
      __pyx_t_9 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_v_dL, 1., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2461, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2461, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_N = ((long)ceil(__pyx_t_12));

      /* "tofu/geom/_GG03.pyx":2462
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2462, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2463
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2464
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_15 = 0;
          __pyx_t_16 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_15 * __pyx_v_DLs.strides[0]) )) + __pyx_t_16)) )));

          /* "tofu/geom/_GG03.pyx":2465
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_17 = 1;
          __pyx_t_18 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_17 * __pyx_v_DLs.strides[0]) )) + __pyx_t_18)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2466
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_19 = 0;
          __pyx_t_20 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_19 * __pyx_v_Ds.strides[0]) )) + __pyx_t_20)) )));
          __pyx_t_21 = 1;
          __pyx_t_22 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_21 * __pyx_v_Ds.strides[0]) )) + __pyx_t_22)) )));
          __pyx_t_24 = 2;
          __pyx_t_25 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_24 * __pyx_v_Ds.strides[0]) )) + __pyx_t_25)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2467
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_27 = 0;
          __pyx_t_28 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_27 * __pyx_v_us.strides[0]) )) + __pyx_t_28)) )));
          __pyx_t_29 = 1;
          __pyx_t_30 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_29 * __pyx_v_us.strides[0]) )) + __pyx_t_30)) )));
          __pyx_t_31 = 2;
          __pyx_t_32 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_31 * __pyx_v_us.strides[0]) )) + __pyx_t_32)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2468
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2468, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2468, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2468, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2468, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2469
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_38 = __pyx_v_N;
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2470
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2471
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_40 = 0;
            __pyx_t_41 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2472
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_42 = 1;
            __pyx_t_43 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2473
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_44 = 2;
            __pyx_t_45 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2474
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2474, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":2475
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 */
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2475, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2475, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2475, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2475, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_9);
            __pyx_t_7 = 0;
            __pyx_t_4 = 0;
            __pyx_t_9 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2475, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_2) < 0)) __PYX_ERR(0, 2475, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "tofu/geom/_GG03.pyx":2474
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          }

          /* "tofu/geom/_GG03.pyx":2476
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2476, __pyx_L1_error)
          __pyx_t_4 = __pyx_t_7;
          __pyx_t_7 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2476, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2476, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_axis, __pyx_t_2) < 0) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_slice__263);
          __Pyx_GIVEREF(__pyx_slice__263);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_slice__263);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
          __pyx_t_7 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 2476, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2462
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L21;
      }

      /* "tofu/geom/_GG03.pyx":2478
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2478, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2479
 * 
 *             elif method=='simps':
 *                 N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        if ((((__pyx_v_N % 2) == 0) != 0)) {
          __pyx_t_46 = __pyx_v_N;
        } else {
          __pyx_t_46 = (__pyx_v_N + 1);
        }
        __pyx_v_N = __pyx_t_46;

        /* "tofu/geom/_GG03.pyx":2480
 *             elif method=='simps':
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2481
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_47 = 0;
          __pyx_t_48 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_47 * __pyx_v_DLs.strides[0]) )) + __pyx_t_48)) )));

          /* "tofu/geom/_GG03.pyx":2482
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_49 = 1;
          __pyx_t_50 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_49 * __pyx_v_DLs.strides[0]) )) + __pyx_t_50)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2483
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_51 = 0;
          __pyx_t_52 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_51 * __pyx_v_Ds.strides[0]) )) + __pyx_t_52)) )));
          __pyx_t_53 = 1;
          __pyx_t_54 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_53 * __pyx_v_Ds.strides[0]) )) + __pyx_t_54)) )));
          __pyx_t_55 = 2;
          __pyx_t_56 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_55 * __pyx_v_Ds.strides[0]) )) + __pyx_t_56)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2484
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_57 = 0;
          __pyx_t_58 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_57 * __pyx_v_us.strides[0]) )) + __pyx_t_58)) )));
          __pyx_t_59 = 1;
          __pyx_t_60 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_59 * __pyx_v_us.strides[0]) )) + __pyx_t_60)) )));
          __pyx_t_61 = 2;
          __pyx_t_62 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_61 * __pyx_v_us.strides[0]) )) + __pyx_t_62)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2485
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2485, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2485, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2485, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_9);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2485, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2486
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2487
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2488
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_63 = 0;
            __pyx_t_64 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2489
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_65 = 1;
            __pyx_t_66 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2490
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_67 = 2;
            __pyx_t_68 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2491
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2491, __pyx_L1_error)
          if (__pyx_t_3) {

            /* "tofu/geom/_GG03.pyx":2492
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)
 */
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2492, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2492, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2492, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2492, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
            __pyx_t_9 = 0;
            __pyx_t_7 = 0;
            __pyx_t_4 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2492, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_2) < 0)) __PYX_ERR(0, 2492, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

            /* "tofu/geom/_GG03.pyx":2491
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2493
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_simps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2493, __pyx_L1_error)
          __pyx_t_7 = __pyx_t_9;
          __pyx_t_9 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2493, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_7, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2493, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9);
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2494
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2494, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_x, Py_None) < 0) __PYX_ERR(0, 2494, __pyx_L1_error)
          __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2494, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dx, __pyx_t_2) < 0) __PYX_ERR(0, 2494, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2494, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_axis, __pyx_t_2) < 0) __PYX_ERR(0, 2494, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2493
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_slice__264);
          __Pyx_GIVEREF(__pyx_slice__264);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_slice__264);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_7, __pyx_t_2) < 0)) __PYX_ERR(0, 2493, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2478
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 N = N if N%2==0 else N+1
 *                 for ii in range(0,ND):
 */
        goto __pyx_L21;
      }

      /* "tofu/geom/_GG03.pyx":2497
 * 
 *             else:
 *                 N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      /*else*/ {
        __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

        /* "tofu/geom/_GG03.pyx":2498
 *             else:
 *                 N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2499
 *                 N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_69 = 0;
          __pyx_t_70 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_69 * __pyx_v_DLs.strides[0]) )) + __pyx_t_70)) )));

          /* "tofu/geom/_GG03.pyx":2500
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_71 = 1;
          __pyx_t_72 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_71 * __pyx_v_DLs.strides[0]) )) + __pyx_t_72)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2501
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_73 = 0;
          __pyx_t_74 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_73 * __pyx_v_Ds.strides[0]) )) + __pyx_t_74)) )));
          __pyx_t_75 = 1;
          __pyx_t_76 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_75 * __pyx_v_Ds.strides[0]) )) + __pyx_t_76)) )));
          __pyx_t_77 = 2;
          __pyx_t_78 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_77 * __pyx_v_Ds.strides[0]) )) + __pyx_t_78)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2502
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_79 = 0;
          __pyx_t_80 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_79 * __pyx_v_us.strides[0]) )) + __pyx_t_80)) )));
          __pyx_t_81 = 1;
          __pyx_t_82 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_81 * __pyx_v_us.strides[0]) )) + __pyx_t_82)) )));
          __pyx_t_83 = 2;
          __pyx_t_84 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_83 * __pyx_v_us.strides[0]) )) + __pyx_t_84)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2503
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2503, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2503, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2503, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2503, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2504
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2505
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2506
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_85 = 0;
            __pyx_t_86 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2507
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_87 = 1;
            __pyx_t_88 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_88, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2508
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_89 = 2;
            __pyx_t_90 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2509
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2509, __pyx_L1_error)
          if (__pyx_t_3) {

            /* "tofu/geom/_GG03.pyx":2510
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)
 */
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2510, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2510, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2510, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2510, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2);
            __pyx_t_4 = 0;
            __pyx_t_9 = 0;
            __pyx_t_2 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2510, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_7) < 0)) __PYX_ERR(0, 2510, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "tofu/geom/_GG03.pyx":2509
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2511
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_romb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2511, __pyx_L1_error)
          __pyx_t_9 = __pyx_t_4;
          __pyx_t_4 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2511, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2511, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2512
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
          __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2512, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2512, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dx, __pyx_t_7) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2512, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_axis, __pyx_t_7) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_show, Py_False) < 0) __PYX_ERR(0, 2512, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2511
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_slice__265);
          __Pyx_GIVEREF(__pyx_slice__265);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__265);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_9, __pyx_t_7) < 0)) __PYX_ERR(0, 2511, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __pyx_L21:;

      /* "tofu/geom/_GG03.pyx":2460
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             N = <long>(Cceil(1./dL))
 *             if method=='sum':
 */
      goto __pyx_L20;
    }

    /* "tofu/geom/_GG03.pyx":2515
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
    /*else*/ {
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2515, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2516
 *         else:
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2517
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 */
          __pyx_t_91 = 0;
          __pyx_t_92 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_91 * __pyx_v_DLs.strides[0]) )) + __pyx_t_92)) )));

          /* "tofu/geom/_GG03.pyx":2519
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_93 = 1;
          __pyx_t_94 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_93 * __pyx_v_DLs.strides[0]) )) + __pyx_t_94)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2519, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_dL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2519, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2519, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2520
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_95 = 1;
          __pyx_t_96 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_95 * __pyx_v_DLs.strides[0]) )) + __pyx_t_96)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2521
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_97 = 0;
          __pyx_t_98 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_97 * __pyx_v_Ds.strides[0]) )) + __pyx_t_98)) )));
          __pyx_t_99 = 1;
          __pyx_t_100 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_99 * __pyx_v_Ds.strides[0]) )) + __pyx_t_100)) )));
          __pyx_t_101 = 2;
          __pyx_t_102 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_101 * __pyx_v_Ds.strides[0]) )) + __pyx_t_102)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2522
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_103 = 0;
          __pyx_t_104 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_103 * __pyx_v_us.strides[0]) )) + __pyx_t_104)) )));
          __pyx_t_105 = 1;
          __pyx_t_106 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_105 * __pyx_v_us.strides[0]) )) + __pyx_t_106)) )));
          __pyx_t_107 = 2;
          __pyx_t_108 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_107 * __pyx_v_us.strides[0]) )) + __pyx_t_108)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2523
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2523, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2523, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2523, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2523, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2524
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_38 = __pyx_v_N;
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2525
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2526
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_109 = 0;
            __pyx_t_110 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2527
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_111 = 1;
            __pyx_t_112 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_111, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_112, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2528
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_113 = 2;
            __pyx_t_114 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_113, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2529
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2529, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":2530
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 */
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2530, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2530, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2530, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2530, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_9);
            __pyx_t_2 = 0;
            __pyx_t_4 = 0;
            __pyx_t_9 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2530, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_7) < 0)) __PYX_ERR(0, 2530, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "tofu/geom/_GG03.pyx":2529
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          }

          /* "tofu/geom/_GG03.pyx":2531
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2531, __pyx_L1_error)
          __pyx_t_4 = __pyx_t_2;
          __pyx_t_2 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2531, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_4, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2531, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_t_7) < 0) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyNumber_Multiply(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_slice__266);
          __Pyx_GIVEREF(__pyx_slice__266);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_slice__266);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_7, __pyx_t_4) < 0)) __PYX_ERR(0, 2531, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2515
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L37;
      }

      /* "tofu/geom/_GG03.pyx":2533
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2533, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2534
 * 
 *             elif method=='simps':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2535
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 */
          __pyx_t_115 = 0;
          __pyx_t_116 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_115 * __pyx_v_DLs.strides[0]) )) + __pyx_t_116)) )));

          /* "tofu/geom/_GG03.pyx":2537
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))             # <<<<<<<<<<<<<<
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_117 = 1;
          __pyx_t_118 = __pyx_v_ii;
          __pyx_t_4 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_117 * __pyx_v_DLs.strides[0]) )) + __pyx_t_118)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2537, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_dL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2537, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2537, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2538
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          if ((((__pyx_v_N % 2) == 0) != 0)) {
            __pyx_t_46 = __pyx_v_N;
          } else {
            __pyx_t_46 = (__pyx_v_N + 1);
          }
          __pyx_v_N = __pyx_t_46;

          /* "tofu/geom/_GG03.pyx":2539
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_119 = 1;
          __pyx_t_120 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_119 * __pyx_v_DLs.strides[0]) )) + __pyx_t_120)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2540
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_121 = 0;
          __pyx_t_122 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_121 * __pyx_v_Ds.strides[0]) )) + __pyx_t_122)) )));
          __pyx_t_123 = 1;
          __pyx_t_124 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_123 * __pyx_v_Ds.strides[0]) )) + __pyx_t_124)) )));
          __pyx_t_125 = 2;
          __pyx_t_126 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_125 * __pyx_v_Ds.strides[0]) )) + __pyx_t_126)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2541
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_127 = 0;
          __pyx_t_128 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_127 * __pyx_v_us.strides[0]) )) + __pyx_t_128)) )));
          __pyx_t_129 = 1;
          __pyx_t_130 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_129 * __pyx_v_us.strides[0]) )) + __pyx_t_130)) )));
          __pyx_t_131 = 2;
          __pyx_t_132 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_131 * __pyx_v_us.strides[0]) )) + __pyx_t_132)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2542
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2542, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2542, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2542, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_9);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2542, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2543
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2544
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2545
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_133 = 0;
            __pyx_t_134 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_133, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_134, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2546
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_135 = 1;
            __pyx_t_136 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_135, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_136, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2547
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_137 = 2;
            __pyx_t_138 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_137, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_138, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2548
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2548, __pyx_L1_error)
          if (__pyx_t_3) {

            /* "tofu/geom/_GG03.pyx":2549
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)
 */
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2549, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2549, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2549, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2549, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_7);
            __pyx_t_9 = 0;
            __pyx_t_2 = 0;
            __pyx_t_7 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2549, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_4) < 0)) __PYX_ERR(0, 2549, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

            /* "tofu/geom/_GG03.pyx":2548
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2550
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_simps); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2550, __pyx_L1_error)
          __pyx_t_2 = __pyx_t_9;
          __pyx_t_9 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2550, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_2, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2550, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2551
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2551, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_x, Py_None) < 0) __PYX_ERR(0, 2551, __pyx_L1_error)
          __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2551, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dx, __pyx_t_4) < 0) __PYX_ERR(0, 2551, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2551, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_axis, __pyx_t_4) < 0) __PYX_ERR(0, 2551, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2550
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_slice__267);
          __Pyx_GIVEREF(__pyx_slice__267);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_slice__267);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_2, __pyx_t_4) < 0)) __PYX_ERR(0, 2550, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2533
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L37;
      }

      /* "tofu/geom/_GG03.pyx":2554
 * 
 *             else:
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
      /*else*/ {
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2555
 *             else:
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 */
          __pyx_t_139 = 0;
          __pyx_t_140 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_139 * __pyx_v_DLs.strides[0]) )) + __pyx_t_140)) )));

          /* "tofu/geom/_GG03.pyx":2557
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))             # <<<<<<<<<<<<<<
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_141 = 1;
          __pyx_t_142 = __pyx_v_ii;
          __pyx_t_4 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_141 * __pyx_v_DLs.strides[0]) )) + __pyx_t_142)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2557, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_v_dL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2557, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2557, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2558
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

          /* "tofu/geom/_GG03.pyx":2559
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_143 = 1;
          __pyx_t_144 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_143 * __pyx_v_DLs.strides[0]) )) + __pyx_t_144)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2560
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_145 = 0;
          __pyx_t_146 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_145 * __pyx_v_Ds.strides[0]) )) + __pyx_t_146)) )));
          __pyx_t_147 = 1;
          __pyx_t_148 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_147 * __pyx_v_Ds.strides[0]) )) + __pyx_t_148)) )));
          __pyx_t_149 = 2;
          __pyx_t_150 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_149 * __pyx_v_Ds.strides[0]) )) + __pyx_t_150)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2561
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_151 = 0;
          __pyx_t_152 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_151 * __pyx_v_us.strides[0]) )) + __pyx_t_152)) )));
          __pyx_t_153 = 1;
          __pyx_t_154 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_153 * __pyx_v_us.strides[0]) )) + __pyx_t_154)) )));
          __pyx_t_155 = 2;
          __pyx_t_156 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_155 * __pyx_v_us.strides[0]) )) + __pyx_t_156)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2562
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2562, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2562, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2562, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_7);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2562, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_7));
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2563
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2564
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2565
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_157 = 0;
            __pyx_t_158 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_157, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_158, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2566
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_159 = 1;
            __pyx_t_160 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_159, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_160, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2567
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_161 = 2;
            __pyx_t_162 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_161, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_162, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2568
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2568, __pyx_L1_error)
          if (__pyx_t_3) {

            /* "tofu/geom/_GG03.pyx":2569
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)
 */
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2569, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2569, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2569, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2569, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
            __pyx_t_7 = 0;
            __pyx_t_9 = 0;
            __pyx_t_2 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2569, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_4) < 0)) __PYX_ERR(0, 2569, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

            /* "tofu/geom/_GG03.pyx":2568
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2570
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_romb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2570, __pyx_L1_error)
          __pyx_t_9 = __pyx_t_7;
          __pyx_t_7 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2570, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2570, __pyx_L1_error)
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
          __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2571
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)             # <<<<<<<<<<<<<<
 * 
 *     # Case with different resolution for each LOS
 */
          __pyx_t_7 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2571, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2571, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dx, __pyx_t_4) < 0) __PYX_ERR(0, 2571, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2571, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_axis, __pyx_t_4) < 0) __PYX_ERR(0, 2571, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_show, Py_False) < 0) __PYX_ERR(0, 2571, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2570
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_slice__268);
          __Pyx_GIVEREF(__pyx_slice__268);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__268);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
          __pyx_t_7 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_9, __pyx_t_4) < 0)) __PYX_ERR(0, 2570, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
      }
      __pyx_L37:;
    }
    __pyx_L20:;

    /* "tofu/geom/_GG03.pyx":2459
 *     method = method.lower()
 *     # Case with unique dL
 *     if not hasattr(dL,'__iter__'):             # <<<<<<<<<<<<<<
 *         if dLMode=='rel':
 *             N = <long>(Cceil(1./dL))
 */
    goto __pyx_L19;
  }

  /* "tofu/geom/_GG03.pyx":2575
 *     # Case with different resolution for each LOS
 *     else:
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             if method=='sum':
 *                 for ii in range(0,ND):
 */
  /*else*/ {
    __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_dLMode, __pyx_n_s_rel, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2575, __pyx_L1_error)
    __pyx_t_1 = (__pyx_t_3 != 0);
    if (__pyx_t_1) {

      /* "tofu/geom/_GG03.pyx":2576
 *     else:
 *         if dLMode=='rel':
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2576, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2577
 *         if dLMode=='rel':
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     dl0 = DLs[0,ii]
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2578
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2578, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_t_4, 1., 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2578, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2578, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2579
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_163 = 0;
          __pyx_t_164 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_163 * __pyx_v_DLs.strides[0]) )) + __pyx_t_164)) )));

          /* "tofu/geom/_GG03.pyx":2580
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_165 = 1;
          __pyx_t_166 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_165 * __pyx_v_DLs.strides[0]) )) + __pyx_t_166)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2581
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_167 = 0;
          __pyx_t_168 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_167 * __pyx_v_Ds.strides[0]) )) + __pyx_t_168)) )));
          __pyx_t_169 = 1;
          __pyx_t_170 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_169 * __pyx_v_Ds.strides[0]) )) + __pyx_t_170)) )));
          __pyx_t_171 = 2;
          __pyx_t_172 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_171 * __pyx_v_Ds.strides[0]) )) + __pyx_t_172)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2582
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_173 = 0;
          __pyx_t_174 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_173 * __pyx_v_us.strides[0]) )) + __pyx_t_174)) )));
          __pyx_t_175 = 1;
          __pyx_t_176 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_175 * __pyx_v_us.strides[0]) )) + __pyx_t_176)) )));
          __pyx_t_177 = 2;
          __pyx_t_178 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_177 * __pyx_v_us.strides[0]) )) + __pyx_t_178)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2583
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_empty); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2583, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2583, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2583, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2583, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2584
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_38 = __pyx_v_N;
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2585
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2586
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_179 = 0;
            __pyx_t_180 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_179, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_180, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2587
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_181 = 1;
            __pyx_t_182 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_181, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_182, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2588
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_183 = 2;
            __pyx_t_184 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_183, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_184, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2589
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2589, __pyx_L1_error)
          if (__pyx_t_3) {

            /* "tofu/geom/_GG03.pyx":2590
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 *             elif method=='simps':
 */
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2590, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2590, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2590, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2590, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_9);
            __pyx_t_2 = 0;
            __pyx_t_7 = 0;
            __pyx_t_9 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2590, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_4) < 0)) __PYX_ERR(0, 2590, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

            /* "tofu/geom/_GG03.pyx":2589
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          }

          /* "tofu/geom/_GG03.pyx":2591
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
          __pyx_t_7 = __pyx_t_2;
          __pyx_t_2 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2591, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_7, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_t_4) < 0) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_INCREF(__pyx_slice__269);
          __Pyx_GIVEREF(__pyx_slice__269);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_slice__269);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_4, __pyx_t_7) < 0)) __PYX_ERR(0, 2591, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2576
 *     else:
 *         if dLMode=='rel':
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
        goto __pyx_L54;
      }

      /* "tofu/geom/_GG03.pyx":2592
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2592, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2593
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 *             elif method=='simps':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = N if N%2==0 else N+1
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2594
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = N if N%2==0 else N+1
 *                     dl0 = DLs[0,ii]
 */
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2594, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_t_7, 1., 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2594, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2594, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2595
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          if ((((__pyx_v_N % 2) == 0) != 0)) {
            __pyx_t_46 = __pyx_v_N;
          } else {
            __pyx_t_46 = (__pyx_v_N + 1);
          }
          __pyx_v_N = __pyx_t_46;

          /* "tofu/geom/_GG03.pyx":2596
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = N if N%2==0 else N+1
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_185 = 0;
          __pyx_t_186 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_185 * __pyx_v_DLs.strides[0]) )) + __pyx_t_186)) )));

          /* "tofu/geom/_GG03.pyx":2597
 *                     N = N if N%2==0 else N+1
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_187 = 1;
          __pyx_t_188 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_187 * __pyx_v_DLs.strides[0]) )) + __pyx_t_188)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2598
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_189 = 0;
          __pyx_t_190 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_189 * __pyx_v_Ds.strides[0]) )) + __pyx_t_190)) )));
          __pyx_t_191 = 1;
          __pyx_t_192 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_191 * __pyx_v_Ds.strides[0]) )) + __pyx_t_192)) )));
          __pyx_t_193 = 2;
          __pyx_t_194 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_193 * __pyx_v_Ds.strides[0]) )) + __pyx_t_194)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2599
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_195 = 0;
          __pyx_t_196 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_195 * __pyx_v_us.strides[0]) )) + __pyx_t_196)) )));
          __pyx_t_197 = 1;
          __pyx_t_198 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_197 * __pyx_v_us.strides[0]) )) + __pyx_t_198)) )));
          __pyx_t_199 = 2;
          __pyx_t_200 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_199 * __pyx_v_us.strides[0]) )) + __pyx_t_200)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2600
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2600, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2600, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2600, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_9);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2600, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2601
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2602
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2603
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_201 = 0;
            __pyx_t_202 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_201, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_202, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2604
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_203 = 1;
            __pyx_t_204 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_203, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_204, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2605
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_205 = 2;
            __pyx_t_206 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_205, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_206, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2606
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2606, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":2607
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)
 */
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2607, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
            __pyx_t_9 = 0;
            __pyx_t_2 = 0;
            __pyx_t_4 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2607, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_7) < 0)) __PYX_ERR(0, 2607, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "tofu/geom/_GG03.pyx":2606
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2608
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_simps); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
          __pyx_t_2 = __pyx_t_9;
          __pyx_t_9 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2608, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_2, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2608, __pyx_L1_error)
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2609
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          __pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2609, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_x, Py_None) < 0) __PYX_ERR(0, 2609, __pyx_L1_error)
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2609, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dx, __pyx_t_7) < 0) __PYX_ERR(0, 2609, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2609, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_axis, __pyx_t_7) < 0) __PYX_ERR(0, 2609, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

          /* "tofu/geom/_GG03.pyx":2608
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_slice__270);
          __Pyx_GIVEREF(__pyx_slice__270);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_slice__270);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9);
          __pyx_t_9 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_2, __pyx_t_7) < 0)) __PYX_ERR(0, 2608, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2592
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 */
        goto __pyx_L54;
      }

      /* "tofu/geom/_GG03.pyx":2612
 * 
 *             else:
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 */
      /*else*/ {
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2613
 *             else:
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl0 = DLs[0,ii]
 */
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2613, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_, __pyx_t_7, 1., 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2613, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2613, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2614
 *                 for ii in range(0,ND):
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

          /* "tofu/geom/_GG03.pyx":2615
 *                     N = <long>(Cceil(1./dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_207 = 0;
          __pyx_t_208 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_207 * __pyx_v_DLs.strides[0]) )) + __pyx_t_208)) )));

          /* "tofu/geom/_GG03.pyx":2616
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_209 = 1;
          __pyx_t_210 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_209 * __pyx_v_DLs.strides[0]) )) + __pyx_t_210)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2617
 *                     dl0 = DLs[0,ii]
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_211 = 0;
          __pyx_t_212 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_211 * __pyx_v_Ds.strides[0]) )) + __pyx_t_212)) )));
          __pyx_t_213 = 1;
          __pyx_t_214 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_213 * __pyx_v_Ds.strides[0]) )) + __pyx_t_214)) )));
          __pyx_t_215 = 2;
          __pyx_t_216 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_215 * __pyx_v_Ds.strides[0]) )) + __pyx_t_216)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2618
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_217 = 0;
          __pyx_t_218 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_217 * __pyx_v_us.strides[0]) )) + __pyx_t_218)) )));
          __pyx_t_219 = 1;
          __pyx_t_220 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_219 * __pyx_v_us.strides[0]) )) + __pyx_t_220)) )));
          __pyx_t_221 = 2;
          __pyx_t_222 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_221 * __pyx_v_us.strides[0]) )) + __pyx_t_222)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2619
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2619, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2619, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2619, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2619, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2620
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2621
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2622
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_223 = 0;
            __pyx_t_224 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_223, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_224, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2623
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_225 = 1;
            __pyx_t_226 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_225, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_226, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2624
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_227 = 2;
            __pyx_t_228 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_227, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_228, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2625
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2625, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":2626
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)
 */
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2626, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_2);
            __pyx_t_4 = 0;
            __pyx_t_9 = 0;
            __pyx_t_2 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2626, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_7) < 0)) __PYX_ERR(0, 2626, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "tofu/geom/_GG03.pyx":2625
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2627
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_romb); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2627, __pyx_L1_error)
          __pyx_t_9 = __pyx_t_4;
          __pyx_t_4 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2627, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2627, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2628
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
          __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dx, __pyx_t_7) < 0) __PYX_ERR(0, 2628, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2628, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_axis, __pyx_t_7) < 0) __PYX_ERR(0, 2628, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_show, Py_False) < 0) __PYX_ERR(0, 2628, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2627
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_slice__271);
          __Pyx_GIVEREF(__pyx_slice__271);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__271);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_9, __pyx_t_7) < 0)) __PYX_ERR(0, 2627, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __pyx_L54:;

      /* "tofu/geom/_GG03.pyx":2575
 *     # Case with different resolution for each LOS
 *     else:
 *         if dLMode=='rel':             # <<<<<<<<<<<<<<
 *             if method=='sum':
 *                 for ii in range(0,ND):
 */
      goto __pyx_L53;
    }

    /* "tofu/geom/_GG03.pyx":2631
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
    /*else*/ {
      __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_sum, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2631, __pyx_L1_error)
      __pyx_t_3 = (__pyx_t_1 != 0);
      if (__pyx_t_3) {

        /* "tofu/geom/_GG03.pyx":2632
 *         else:
 *             if method=='sum':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2633
 *             if method=='sum':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 */
          __pyx_t_229 = 0;
          __pyx_t_230 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_229 * __pyx_v_DLs.strides[0]) )) + __pyx_t_230)) )));

          /* "tofu/geom/_GG03.pyx":2635
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_t_231 = 1;
          __pyx_t_232 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_231 * __pyx_v_DLs.strides[0]) )) + __pyx_t_232)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2635, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2635, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2635, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2635, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2636
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_233 = 1;
          __pyx_t_234 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_233 * __pyx_v_DLs.strides[0]) )) + __pyx_t_234)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2637
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 */
          __pyx_t_235 = 0;
          __pyx_t_236 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_235 * __pyx_v_Ds.strides[0]) )) + __pyx_t_236)) )));
          __pyx_t_237 = 1;
          __pyx_t_238 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_237 * __pyx_v_Ds.strides[0]) )) + __pyx_t_238)) )));
          __pyx_t_239 = 2;
          __pyx_t_240 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_239 * __pyx_v_Ds.strides[0]) )) + __pyx_t_240)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2638
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 */
          __pyx_t_241 = 0;
          __pyx_t_242 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_241 * __pyx_v_us.strides[0]) )) + __pyx_t_242)) )));
          __pyx_t_243 = 1;
          __pyx_t_244 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_243 * __pyx_v_us.strides[0]) )) + __pyx_t_244)) )));
          __pyx_t_245 = 2;
          __pyx_t_246 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_245 * __pyx_v_us.strides[0]) )) + __pyx_t_246)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2639
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_N); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2639, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2639, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2639, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2639, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2640
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_38 = __pyx_v_N;
          for (__pyx_t_39 = 0; __pyx_t_39 < __pyx_t_38; __pyx_t_39+=1) {
            __pyx_v_jj = __pyx_t_39;

            /* "tofu/geom/_GG03.pyx":2641
 *                     pts = np.empty((3,N),dtype=float)
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + ((0.5 + ((double)__pyx_v_jj)) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2642
 *                     for jj in range(0,N):
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_247 = 0;
            __pyx_t_248 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_247, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_248, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2643
 *                         kkk = dl0 + (0.5+<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_249 = 1;
            __pyx_t_250 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_249, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_250, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2644
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_251 = 2;
            __pyx_t_252 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_251, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_252, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2645
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2645, __pyx_L1_error)
          if (__pyx_t_3) {

            /* "tofu/geom/_GG03.pyx":2646
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 */
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2646, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2646, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2646, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2646, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_4);
            __pyx_t_2 = 0;
            __pyx_t_7 = 0;
            __pyx_t_4 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2646, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_9) < 0)) __PYX_ERR(0, 2646, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

            /* "tofu/geom/_GG03.pyx":2645
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 */
          }

          /* "tofu/geom/_GG03.pyx":2647
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2647, __pyx_L1_error)
          __pyx_t_7 = __pyx_t_2;
          __pyx_t_2 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2647, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_7, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2647, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_t_9) < 0) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_slice__272);
          __Pyx_GIVEREF(__pyx_slice__272);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__272);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_9, __pyx_t_7) < 0)) __PYX_ERR(0, 2647, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2631
 * 
 *         else:
 *             if method=='sum':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L70;
      }

      /* "tofu/geom/_GG03.pyx":2649
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
      __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_method, __pyx_n_s_simps, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 2649, __pyx_L1_error)
      __pyx_t_1 = (__pyx_t_3 != 0);
      if (__pyx_t_1) {

        /* "tofu/geom/_GG03.pyx":2650
 * 
 *             elif method=='simps':
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2651
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 */
          __pyx_t_253 = 0;
          __pyx_t_254 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_253 * __pyx_v_DLs.strides[0]) )) + __pyx_t_254)) )));

          /* "tofu/geom/_GG03.pyx":2653
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_255 = 1;
          __pyx_t_256 = __pyx_v_ii;
          __pyx_t_7 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_255 * __pyx_v_DLs.strides[0]) )) + __pyx_t_256)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2653, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_9 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2653, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2653, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2653, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2654
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = N if N%2==0 else N+1             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          if ((((__pyx_v_N % 2) == 0) != 0)) {
            __pyx_t_46 = __pyx_v_N;
          } else {
            __pyx_t_46 = (__pyx_v_N + 1);
          }
          __pyx_v_N = __pyx_t_46;

          /* "tofu/geom/_GG03.pyx":2655
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_257 = 1;
          __pyx_t_258 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_257 * __pyx_v_DLs.strides[0]) )) + __pyx_t_258)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2656
 *                     N = N if N%2==0 else N+1
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_259 = 0;
          __pyx_t_260 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_259 * __pyx_v_Ds.strides[0]) )) + __pyx_t_260)) )));
          __pyx_t_261 = 1;
          __pyx_t_262 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_261 * __pyx_v_Ds.strides[0]) )) + __pyx_t_262)) )));
          __pyx_t_263 = 2;
          __pyx_t_264 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_263 * __pyx_v_Ds.strides[0]) )) + __pyx_t_264)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2657
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_265 = 0;
          __pyx_t_266 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_265 * __pyx_v_us.strides[0]) )) + __pyx_t_266)) )));
          __pyx_t_267 = 1;
          __pyx_t_268 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_267 * __pyx_v_us.strides[0]) )) + __pyx_t_268)) )));
          __pyx_t_269 = 2;
          __pyx_t_270 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_269 * __pyx_v_us.strides[0]) )) + __pyx_t_270)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2658
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_7);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
          __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2658, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2658, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2658, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_4);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_35, &__pyx_t_36, &__pyx_t_37);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_35); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_37);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_35, __pyx_t_36, __pyx_t_37);
              }
              __pyx_t_35 = __pyx_t_36 = __pyx_t_37 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2658, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_4));
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2659
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2660
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2661
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_271 = 0;
            __pyx_t_272 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_271, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_272, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2662
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_273 = 1;
            __pyx_t_274 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_273, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_274, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2663
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_275 = 2;
            __pyx_t_276 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_275, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_276, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2664
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2664, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":2665
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)
 */
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2665, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_7 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2665, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2665, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2665, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
            __Pyx_GIVEREF(__pyx_t_7);
            PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_2);
            __pyx_t_4 = 0;
            __pyx_t_7 = 0;
            __pyx_t_2 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2665, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_9) < 0)) __PYX_ERR(0, 2665, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

            /* "tofu/geom/_GG03.pyx":2664
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2666
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_simps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
          __pyx_t_7 = __pyx_t_4;
          __pyx_t_4 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2666, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_7, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2666, __pyx_L1_error)
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "tofu/geom/_GG03.pyx":2667
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),
 *                                               x=None,dx=dl,axis=axm)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
          __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2667, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_x, Py_None) < 0) __PYX_ERR(0, 2667, __pyx_L1_error)
          __pyx_t_9 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2667, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dx, __pyx_t_9) < 0) __PYX_ERR(0, 2667, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2667, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_axis, __pyx_t_9) < 0) __PYX_ERR(0, 2667, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

          /* "tofu/geom/_GG03.pyx":2666
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
          __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(__pyx_slice__273);
          __Pyx_GIVEREF(__pyx_slice__273);
          PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_slice__273);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_7, __pyx_t_9) < 0)) __PYX_ERR(0, 2666, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        }

        /* "tofu/geom/_GG03.pyx":2649
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl
 * 
 *             elif method=='simps':             # <<<<<<<<<<<<<<
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]
 */
        goto __pyx_L70;
      }

      /* "tofu/geom/_GG03.pyx":2670
 * 
 *             else:
 *                 for ii in range(0,ND):             # <<<<<<<<<<<<<<
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 */
      /*else*/ {
        __pyx_t_13 = __pyx_v_ND;
        for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
          __pyx_v_ii = __pyx_t_14;

          /* "tofu/geom/_GG03.pyx":2671
 *             else:
 *                 for ii in range(0,ND):
 *                     dl0 = DLs[0,ii]             # <<<<<<<<<<<<<<
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 */
          __pyx_t_277 = 0;
          __pyx_t_278 = __pyx_v_ii;
          __pyx_v_dl0 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_277 * __pyx_v_DLs.strides[0]) )) + __pyx_t_278)) )));

          /* "tofu/geom/_GG03.pyx":2673
 *                     dl0 = DLs[0,ii]
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))             # <<<<<<<<<<<<<<
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 */
          __pyx_t_279 = 1;
          __pyx_t_280 = __pyx_v_ii;
          __pyx_t_9 = PyFloat_FromDouble(((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_279 * __pyx_v_DLs.strides[0]) )) + __pyx_t_280)) ))) - __pyx_v_dl0)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2673, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_dL, __pyx_v_ii, unsigned int, 0, __Pyx_PyInt_From_unsigned_int, 0, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2673, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2673, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2673, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_v_N = ((long)ceil(__pyx_t_12));

          /* "tofu/geom/_GG03.pyx":2674
 *                     # Compute the number of intervals to satisfy the resolution
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))             # <<<<<<<<<<<<<<
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 */
          __pyx_v_N = __Pyx_pow_long(2, ((long)ceil(log2(((double)__pyx_v_N)))));

          /* "tofu/geom/_GG03.pyx":2675
 *                     N = <long>(Cceil((DLs[1,ii]-dl0)/dL[ii]))
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N             # <<<<<<<<<<<<<<
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 */
          __pyx_t_281 = 1;
          __pyx_t_282 = __pyx_v_ii;
          __pyx_v_dl = (((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_DLs.data + __pyx_t_281 * __pyx_v_DLs.strides[0]) )) + __pyx_t_282)) ))) - __pyx_v_dl0) / ((double)__pyx_v_N));

          /* "tofu/geom/_GG03.pyx":2676
 *                     N = 2**(<long>(Cceil(Clog2(<double>N))))
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]             # <<<<<<<<<<<<<<
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 */
          __pyx_t_283 = 0;
          __pyx_t_284 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_283 * __pyx_v_Ds.strides[0]) )) + __pyx_t_284)) )));
          __pyx_t_285 = 1;
          __pyx_t_286 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_285 * __pyx_v_Ds.strides[0]) )) + __pyx_t_286)) )));
          __pyx_t_287 = 2;
          __pyx_t_288 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_Ds.data + __pyx_t_287 * __pyx_v_Ds.strides[0]) )) + __pyx_t_288)) )));
          __pyx_v_D0 = __pyx_t_12;
          __pyx_v_D1 = __pyx_t_23;
          __pyx_v_D2 = __pyx_t_26;

          /* "tofu/geom/_GG03.pyx":2677
 *                     dl = (DLs[1,ii]-dl0)/<double>N
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]             # <<<<<<<<<<<<<<
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 */
          __pyx_t_289 = 0;
          __pyx_t_290 = __pyx_v_ii;
          __pyx_t_26 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_289 * __pyx_v_us.strides[0]) )) + __pyx_t_290)) )));
          __pyx_t_291 = 1;
          __pyx_t_292 = __pyx_v_ii;
          __pyx_t_23 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_291 * __pyx_v_us.strides[0]) )) + __pyx_t_292)) )));
          __pyx_t_293 = 2;
          __pyx_t_294 = __pyx_v_ii;
          __pyx_t_12 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_us.data + __pyx_t_293 * __pyx_v_us.strides[0]) )) + __pyx_t_294)) )));
          __pyx_v_u0 = __pyx_t_26;
          __pyx_v_u1 = __pyx_t_23;
          __pyx_v_u2 = __pyx_t_12;

          /* "tofu/geom/_GG03.pyx":2678
 *                     D0, D1, D2 = Ds[0,ii], Ds[1,ii], Ds[2,ii]
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)             # <<<<<<<<<<<<<<
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 */
          __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_empty); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_t_4 = __Pyx_PyInt_From_long((__pyx_v_N + 1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_int_3);
          __Pyx_GIVEREF(__pyx_int_3);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_3);
          __Pyx_GIVEREF(__pyx_t_4);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4);
          __pyx_t_4 = 0;
          __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9);
          __pyx_t_9 = 0;
          __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 2678, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2678, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2678, __pyx_L1_error)
          __pyx_t_33 = ((PyArrayObject *)__pyx_t_2);
          {
            __Pyx_BufFmt_StackElem __pyx_stack[1];
            __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
            __pyx_t_34 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack);
            if (unlikely(__pyx_t_34 < 0)) {
              PyErr_Fetch(&__pyx_t_37, &__pyx_t_36, &__pyx_t_35);
              if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pts.rcbuffer->pybuffer, (PyObject*)__pyx_v_pts, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
                Py_XDECREF(__pyx_t_37); Py_XDECREF(__pyx_t_36); Py_XDECREF(__pyx_t_35);
                __Pyx_RaiseBufferFallbackError();
              } else {
                PyErr_Restore(__pyx_t_37, __pyx_t_36, __pyx_t_35);
              }
              __pyx_t_37 = __pyx_t_36 = __pyx_t_35 = 0;
            }
            __pyx_pybuffernd_pts.diminfo[0].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pts.diminfo[0].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pts.diminfo[1].strides = __pyx_pybuffernd_pts.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pts.diminfo[1].shape = __pyx_pybuffernd_pts.rcbuffer->pybuffer.shape[1];
            if (unlikely(__pyx_t_34 < 0)) __PYX_ERR(0, 2678, __pyx_L1_error)
          }
          __pyx_t_33 = 0;
          __Pyx_XDECREF_SET(__pyx_v_pts, ((PyArrayObject *)__pyx_t_2));
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2679
 *                     u0, u1, u2 = us[0,ii], us[1,ii], us[2,ii]
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):             # <<<<<<<<<<<<<<
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 */
          __pyx_t_46 = (__pyx_v_N + 1);
          for (__pyx_t_38 = 0; __pyx_t_38 < __pyx_t_46; __pyx_t_38+=1) {
            __pyx_v_jj = __pyx_t_38;

            /* "tofu/geom/_GG03.pyx":2680
 *                     pts = np.empty((3,N+1),dtype=float)
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl             # <<<<<<<<<<<<<<
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 */
            __pyx_v_kkk = (__pyx_v_dl0 + (((double)__pyx_v_jj) * __pyx_v_dl));

            /* "tofu/geom/_GG03.pyx":2681
 *                     for jj in range(0,N+1):
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0             # <<<<<<<<<<<<<<
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 */
            __pyx_t_295 = 0;
            __pyx_t_296 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_295, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_296, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D0 + (__pyx_v_kkk * __pyx_v_u0));

            /* "tofu/geom/_GG03.pyx":2682
 *                         kkk = dl0 + (<double>jj)*dl
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1             # <<<<<<<<<<<<<<
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 */
            __pyx_t_297 = 1;
            __pyx_t_298 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_297, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_298, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D1 + (__pyx_v_kkk * __pyx_v_u1));

            /* "tofu/geom/_GG03.pyx":2683
 *                         pts[0,jj] = D0 + kkk*u0
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2             # <<<<<<<<<<<<<<
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 */
            __pyx_t_299 = 2;
            __pyx_t_300 = __pyx_v_jj;
            *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_pts.rcbuffer->pybuffer.buf, __pyx_t_299, __pyx_pybuffernd_pts.diminfo[0].strides, __pyx_t_300, __pyx_pybuffernd_pts.diminfo[1].strides) = (__pyx_v_D2 + (__pyx_v_kkk * __pyx_v_u2));
          }

          /* "tofu/geom/_GG03.pyx":2684
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_ani)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 2684, __pyx_L1_error)
          if (__pyx_t_1) {

            /* "tofu/geom/_GG03.pyx":2685
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)             # <<<<<<<<<<<<<<
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)
 */
            __pyx_t_2 = PyFloat_FromDouble((-__pyx_v_u0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2685, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_2);
            __pyx_t_9 = PyFloat_FromDouble((-__pyx_v_u1)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2685, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_4 = PyFloat_FromDouble((-__pyx_v_u2)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2685, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2685, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_7);
            __Pyx_GIVEREF(__pyx_t_2);
            PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
            __Pyx_GIVEREF(__pyx_t_9);
            PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_9);
            __Pyx_GIVEREF(__pyx_t_4);
            PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
            __pyx_t_2 = 0;
            __pyx_t_9 = 0;
            __pyx_t_4 = 0;
            if (unlikely(__pyx_v_fkwdargs == Py_None)) {
              PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
              __PYX_ERR(0, 2685, __pyx_L1_error)
            }
            if (unlikely(PyDict_SetItem(__pyx_v_fkwdargs, __pyx_n_s_Vect, __pyx_t_7) < 0)) __PYX_ERR(0, 2685, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

            /* "tofu/geom/_GG03.pyx":2684
 *                         pts[1,jj] = D1 + kkk*u1
 *                         pts[2,jj] = D2 + kkk*u2
 *                     if ani:             # <<<<<<<<<<<<<<
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 */
          }

          /* "tofu/geom/_GG03.pyx":2686
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_scpintg); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_romb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_INCREF(((PyObject *)__pyx_v_pts));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_pts));
          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_pts));
          __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_t, __pyx_v_t) < 0) __PYX_ERR(0, 2686, __pyx_L1_error)
          __pyx_t_9 = __pyx_t_2;
          __pyx_t_2 = 0;
          if (unlikely(__pyx_v_fkwdargs == Py_None)) {
            PyErr_SetString(PyExc_TypeError, "argument after ** must be a mapping, not NoneType");
            __PYX_ERR(0, 2686, __pyx_L1_error)
          }
          if (__Pyx_MergeKeywords(__pyx_t_9, __pyx_v_fkwdargs) < 0) __PYX_ERR(0, 2686, __pyx_L1_error)
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_v_ff, __pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "tofu/geom/_GG03.pyx":2687
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),
 *                                              dx=dl,axis=axm,show=False)             # <<<<<<<<<<<<<<
 * 
 *     if nt==1:
 */
          __pyx_t_2 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2687, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dl); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2687, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dx, __pyx_t_7) < 0) __PYX_ERR(0, 2687, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __pyx_t_7 = __Pyx_PyInt_From_unsigned_int(__pyx_v_axm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2687, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_axis, __pyx_t_7) < 0) __PYX_ERR(0, 2687, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_show, Py_False) < 0) __PYX_ERR(0, 2687, __pyx_L1_error)

          /* "tofu/geom/_GG03.pyx":2686
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
          __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_ii); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_INCREF(__pyx_slice__274);
          __Pyx_GIVEREF(__pyx_slice__274);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_slice__274);
          __Pyx_GIVEREF(__pyx_t_2);
          PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2);
          __pyx_t_2 = 0;
          if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_sig), __pyx_t_9, __pyx_t_7) < 0)) __PYX_ERR(0, 2686, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        }
      }
      __pyx_L70:;
    }
    __pyx_L53:;
  }
  __pyx_L19:;

  /* "tofu/geom/_GG03.pyx":2689
 *                                              dx=dl,axis=axm,show=False)
 * 
 *     if nt==1:             # <<<<<<<<<<<<<<
 *         return sig.ravel()
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_nt == 1) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2690
 * 
 *     if nt==1:
 *         return sig.ravel()             # <<<<<<<<<<<<<<
 *     else:
 *         return sig
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sig), __pyx_n_s_ravel); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2690, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_9);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_9, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2690, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2690, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;

    /* "tofu/geom/_GG03.pyx":2689
 *                                              dx=dl,axis=axm,show=False)
 * 
 *     if nt==1:             # <<<<<<<<<<<<<<
 *         return sig.ravel()
 *     else:
 */
  }

  /* "tofu/geom/_GG03.pyx":2692
 *         return sig.ravel()
 *     else:
 *         return sig             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_sig));
    __pyx_r = ((PyObject *)__pyx_v_sig);
    goto __pyx_L0;
  }

  /* "tofu/geom/_GG03.pyx":2421
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},
 *                    str dLMode='abs', str method='simps',
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sig.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_calc_signal", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pts.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sig.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_C0);
  __Pyx_XDECREF(__pyx_v_C1);
  __Pyx_XDECREF((PyObject *)__pyx_v_ani);
  __Pyx_XDECREF((PyObject *)__pyx_v_pts);
  __Pyx_XDECREF((PyObject *)__pyx_v_sig);
  __PYX_XDEC_MEMVIEW(&__pyx_v_Ds, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_us, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_DLs, 1);
  __Pyx_XDECREF(__pyx_v_dLMode);
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2706
 * 
 * 
 * cdef LOS_sino_findRootkPMin_Tor(double uParN, double uN, double Sca, double RZ0, double RZ1, double ScaP, double DParN, double kOut, double D0, double D1, double D2, double u0, double u1, double u2, str Mode='LOS'):             # <<<<<<<<<<<<<<
 *     cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 )
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor(double __pyx_v_uParN, double __pyx_v_uN, double __pyx_v_Sca, double __pyx_v_RZ0, double __pyx_v_RZ1, double __pyx_v_ScaP, double __pyx_v_DParN, double __pyx_v_kOut, double __pyx_v_D0, double __pyx_v_D1, double __pyx_v_D2, double __pyx_v_u0, double __pyx_v_u1, double __pyx_v_u2, struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor *__pyx_optional_args) {
  PyObject *__pyx_v_Mode = ((PyObject*)__pyx_n_s_LOS);
  double __pyx_v_a4;
  double __pyx_v_a3;
  double __pyx_v_a2;
  double __pyx_v_a1;
  double __pyx_v_a0;
  PyArrayObject *__pyx_v_roo = 0;
  PyObject *__pyx_v_KK = 0;
  PyObject *__pyx_v_Pk = 0;
  PyObject *__pyx_v_Pk2D = 0;
  PyObject *__pyx_v_rk = 0;
  double __pyx_v_kk;
  double __pyx_v_kPMin;
  PyObject *__pyx_v_pp = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  double __pyx_t_14;
  __Pyx_RefNannySetupContext("LOS_sino_findRootkPMin_Tor", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_Mode = __pyx_optional_args->Mode;
    }
  }

  /* "tofu/geom/_GG03.pyx":2707
 * 
 * cdef LOS_sino_findRootkPMin_Tor(double uParN, double uN, double Sca, double RZ0, double RZ1, double ScaP, double DParN, double kOut, double D0, double D1, double D2, double u0, double u1, double u2, str Mode='LOS'):
 *     cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 )             # <<<<<<<<<<<<<<
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2
 *     cdef double a1 = 2*( ScaP*(Sca-RZ1*u2)**2 + (Sca-RZ1*u2)*(DParN*uN)**2 - ScaP*(RZ0*uParN)**2 )
 */
  __pyx_v_a4 = pow(((__pyx_v_uParN * __pyx_v_uN) * __pyx_v_uN), 2.0);
  __pyx_v_a3 = (2.0 * (((__pyx_v_Sca - (__pyx_v_RZ1 * __pyx_v_u2)) * pow((__pyx_v_uParN * __pyx_v_uN), 2.0)) + (__pyx_v_ScaP * pow(__pyx_v_uN, 4.0))));

  /* "tofu/geom/_GG03.pyx":2708
 * cdef LOS_sino_findRootkPMin_Tor(double uParN, double uN, double Sca, double RZ0, double RZ1, double ScaP, double DParN, double kOut, double D0, double D1, double D2, double u0, double u1, double u2, str Mode='LOS'):
 *     cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 )
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2             # <<<<<<<<<<<<<<
 *     cdef double a1 = 2*( ScaP*(Sca-RZ1*u2)**2 + (Sca-RZ1*u2)*(DParN*uN)**2 - ScaP*(RZ0*uParN)**2 )
 *     cdef double a0 = ((Sca-RZ1*u2)*DParN)**2 - (RZ0*ScaP)**2
 */
  __pyx_v_a2 = (((pow((__pyx_v_uParN * (__pyx_v_Sca - (__pyx_v_RZ1 * __pyx_v_u2))), 2.0) + (((4. * __pyx_v_ScaP) * (__pyx_v_Sca - (__pyx_v_RZ1 * __pyx_v_u2))) * pow(__pyx_v_uN, 2.0))) + pow(((__pyx_v_DParN * __pyx_v_uN) * __pyx_v_uN), 2.0)) - pow(((__pyx_v_RZ0 * __pyx_v_uParN) * __pyx_v_uParN), 2.0));

  /* "tofu/geom/_GG03.pyx":2709
 *     cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 )
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2
 *     cdef double a1 = 2*( ScaP*(Sca-RZ1*u2)**2 + (Sca-RZ1*u2)*(DParN*uN)**2 - ScaP*(RZ0*uParN)**2 )             # <<<<<<<<<<<<<<
 *     cdef double a0 = ((Sca-RZ1*u2)*DParN)**2 - (RZ0*ScaP)**2
 *     cdef cnp.ndarray roo = np.roots(np.array([a4,a3,a2,a1,a0]))
 */
  __pyx_v_a1 = (2.0 * (((__pyx_v_ScaP * pow((__pyx_v_Sca - (__pyx_v_RZ1 * __pyx_v_u2)), 2.0)) + ((__pyx_v_Sca - (__pyx_v_RZ1 * __pyx_v_u2)) * pow((__pyx_v_DParN * __pyx_v_uN), 2.0))) - (__pyx_v_ScaP * pow((__pyx_v_RZ0 * __pyx_v_uParN), 2.0))));

  /* "tofu/geom/_GG03.pyx":2710
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2
 *     cdef double a1 = 2*( ScaP*(Sca-RZ1*u2)**2 + (Sca-RZ1*u2)*(DParN*uN)**2 - ScaP*(RZ0*uParN)**2 )
 *     cdef double a0 = ((Sca-RZ1*u2)*DParN)**2 - (RZ0*ScaP)**2             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray roo = np.roots(np.array([a4,a3,a2,a1,a0]))
 *     cdef list KK = list(np.real(roo[np.isreal(roo)]))   # There might be several solutions
 */
  __pyx_v_a0 = (pow(((__pyx_v_Sca - (__pyx_v_RZ1 * __pyx_v_u2)) * __pyx_v_DParN), 2.0) - pow((__pyx_v_RZ0 * __pyx_v_ScaP), 2.0));

  /* "tofu/geom/_GG03.pyx":2711
 *     cdef double a1 = 2*( ScaP*(Sca-RZ1*u2)**2 + (Sca-RZ1*u2)*(DParN*uN)**2 - ScaP*(RZ0*uParN)**2 )
 *     cdef double a0 = ((Sca-RZ1*u2)*DParN)**2 - (RZ0*ScaP)**2
 *     cdef cnp.ndarray roo = np.roots(np.array([a4,a3,a2,a1,a0]))             # <<<<<<<<<<<<<<
 *     cdef list KK = list(np.real(roo[np.isreal(roo)]))   # There might be several solutions
 *     cdef list Pk, Pk2D, rk
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_roots); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_a4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_a3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_a2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_a1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_a0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyList_New(5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2711, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyList_SET_ITEM(__pyx_t_10, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyList_SET_ITEM(__pyx_t_10, 3, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyList_SET_ITEM(__pyx_t_10, 4, __pyx_t_9);
  __pyx_t_4 = 0;
  __pyx_t_6 = 0;
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_9 = 0;
  __pyx_t_9 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_9) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL;
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_2};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2711, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2711, __pyx_L1_error)
  __pyx_v_roo = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2712
 *     cdef double a0 = ((Sca-RZ1*u2)*DParN)**2 - (RZ0*ScaP)**2
 *     cdef cnp.ndarray roo = np.roots(np.array([a4,a3,a2,a1,a0]))
 *     cdef list KK = list(np.real(roo[np.isreal(roo)]))   # There might be several solutions             # <<<<<<<<<<<<<<
 *     cdef list Pk, Pk2D, rk
 *     cdef double kk, kPMin
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_real); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_isreal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_roo)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2712, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_roo)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_roo)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_roo));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_roo));
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, ((PyObject *)__pyx_v_roo));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_roo), __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2712, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2712, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2712, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_KK = ((PyObject*)__pyx_t_8);
  __pyx_t_8 = 0;

  /* "tofu/geom/_GG03.pyx":2715
 *     cdef list Pk, Pk2D, rk
 *     cdef double kk, kPMin
 *     if Mode=='LOS':                     # Take solution on physical LOS             # <<<<<<<<<<<<<<
 *         if any([kk>=0 and kk<=kOut for kk in KK]):
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]
 */
  __pyx_t_11 = (__Pyx_PyString_Equals(__pyx_v_Mode, __pyx_n_s_LOS, Py_EQ)); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 2715, __pyx_L1_error)
  __pyx_t_12 = (__pyx_t_11 != 0);
  if (__pyx_t_12) {

    /* "tofu/geom/_GG03.pyx":2716
 *     cdef double kk, kPMin
 *     if Mode=='LOS':                     # Take solution on physical LOS
 *         if any([kk>=0 and kk<=kOut for kk in KK]):             # <<<<<<<<<<<<<<
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]
 *             Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 */
    __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __pyx_v_KK; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2716, __pyx_L1_error)
      #else
      __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_v_kk = __pyx_t_14;
      __pyx_t_12 = (__pyx_v_kk >= 0.0);
      if (__pyx_t_12) {
      } else {
        __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2716, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_10 = __pyx_t_5;
        __pyx_t_5 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_12 = (__pyx_v_kk <= __pyx_v_kOut);
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2716, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_10 = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_L7_bool_binop_done:;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 2716, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
    __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_any, __pyx_t_1, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 2716, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_12) {

      /* "tofu/geom/_GG03.pyx":2717
 *     if Mode=='LOS':                     # Take solution on physical LOS
 *         if any([kk>=0 and kk<=kOut for kk in KK]):
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]             # <<<<<<<<<<<<<<
 *             Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 *             Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2717, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __pyx_v_KK; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
      for (;;) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2717, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2717, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2717, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_v_kk = __pyx_t_14;
        __pyx_t_11 = ((__pyx_v_kk >= 0.0) != 0);
        if (__pyx_t_11) {
        } else {
          __pyx_t_12 = __pyx_t_11;
          goto __pyx_L12_bool_binop_done;
        }
        __pyx_t_11 = ((__pyx_v_kk <= __pyx_v_kOut) != 0);
        __pyx_t_12 = __pyx_t_11;
        __pyx_L12_bool_binop_done:;
        if (__pyx_t_12) {
          __pyx_t_10 = PyFloat_FromDouble(__pyx_v_kk); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2717, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 2717, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_KK, ((PyObject*)__pyx_t_8));
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":2718
 *         if any([kk>=0 and kk<=kOut for kk in KK]):
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]
 *             Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]             # <<<<<<<<<<<<<<
 *             Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 *             rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2718, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __pyx_v_KK; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
      for (;;) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_10 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2718, __pyx_L1_error)
        #else
        __pyx_t_10 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_10); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_v_kk = __pyx_t_14;
        __pyx_t_10 = PyFloat_FromDouble((__pyx_v_D0 + (__pyx_v_kk * __pyx_v_u0))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_5 = PyFloat_FromDouble((__pyx_v_D1 + (__pyx_v_kk * __pyx_v_u1))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = PyFloat_FromDouble((__pyx_v_D2 + (__pyx_v_kk * __pyx_v_u2))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
        __pyx_t_10 = 0;
        __pyx_t_5 = 0;
        __pyx_t_3 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 2718, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_Pk = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":2719
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]
 *             Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 *             Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]             # <<<<<<<<<<<<<<
 *             rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 *             kPMin = KK[rk.index(min(rk))]
 */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2719, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __pyx_v_Pk; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
      for (;;) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2719, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyFloat_FromDouble(sqrt(__pyx_t_14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_pp, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
        __pyx_t_2 = 0;
        __pyx_t_5 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 2719, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_Pk2D = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":2720
 *             Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 *             Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 *             rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]             # <<<<<<<<<<<<<<
 *             kPMin = KK[rk.index(min(rk))]
 *         else:
 */
      __pyx_t_8 = PyList_New(0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2720, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = __pyx_v_Pk2D; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0;
      for (;;) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_3); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2720, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = PyFloat_FromDouble(__pyx_v_RZ0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyFloat_FromDouble(__pyx_v_RZ1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_10 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = PyNumber_Power(__pyx_t_10, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_10 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_8, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 2720, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_rk = ((PyObject*)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "tofu/geom/_GG03.pyx":2721
 *             Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 *             rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 *             kPMin = KK[rk.index(min(rk))]             # <<<<<<<<<<<<<<
 *         else:
 *             kPMin = min([Cabs(kk) for kk in KK])  # Else, take the one closest to D
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rk, __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_rk);
      __Pyx_GIVEREF(__pyx_v_rk);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_rk);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_min, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (!__pyx_t_10) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2721, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_3};
          __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2721, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_3};
          __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2721, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else
        #endif
        {
          __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2721, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_10); __pyx_t_10 = NULL;
          __Pyx_GIVEREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
          __pyx_t_3 = 0;
          __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2721, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetItem(__pyx_v_KK, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2721, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2721, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_kPMin = __pyx_t_14;

      /* "tofu/geom/_GG03.pyx":2716
 *     cdef double kk, kPMin
 *     if Mode=='LOS':                     # Take solution on physical LOS
 *         if any([kk>=0 and kk<=kOut for kk in KK]):             # <<<<<<<<<<<<<<
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]
 *             Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 */
      goto __pyx_L4;
    }

    /* "tofu/geom/_GG03.pyx":2723
 *             kPMin = KK[rk.index(min(rk))]
 *         else:
 *             kPMin = min([Cabs(kk) for kk in KK])  # Else, take the one closest to D             # <<<<<<<<<<<<<<
 *     else:
 *         Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 */
    /*else*/ {
      __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = __pyx_v_KK; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0;
      for (;;) {
        if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2723, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2723, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_v_kk = __pyx_t_14;
        __pyx_t_5 = PyFloat_FromDouble(fabs(__pyx_v_kk)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2723, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 2723, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_min, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2723, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2723, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_kPMin = __pyx_t_14;
    }
    __pyx_L4:;

    /* "tofu/geom/_GG03.pyx":2715
 *     cdef list Pk, Pk2D, rk
 *     cdef double kk, kPMin
 *     if Mode=='LOS':                     # Take solution on physical LOS             # <<<<<<<<<<<<<<
 *         if any([kk>=0 and kk<=kOut for kk in KK]):
 *             KK = [kk for kk in KK if kk>=0 and kk<=kOut]
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":2725
 *             kPMin = min([Cabs(kk) for kk in KK])  # Else, take the one closest to D
 *     else:
 *         Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]             # <<<<<<<<<<<<<<
 *         Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 *         rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 */
  /*else*/ {
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2725, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_v_KK; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2725, __pyx_L1_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_kk = __pyx_t_14;
      __pyx_t_5 = PyFloat_FromDouble((__pyx_v_D0 + (__pyx_v_kk * __pyx_v_u0))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = PyFloat_FromDouble((__pyx_v_D1 + (__pyx_v_kk * __pyx_v_u1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = PyFloat_FromDouble((__pyx_v_D2 + (__pyx_v_kk * __pyx_v_u2))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_10);
      __pyx_t_5 = 0;
      __pyx_t_3 = 0;
      __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_2))) __PYX_ERR(0, 2725, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_Pk = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":2726
 *     else:
 *         Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 *         Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]             # <<<<<<<<<<<<<<
 *         rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 *         kPMin = KK[rk.index(min(rk))]
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2726, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_v_Pk; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_2); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2726, __pyx_L1_error)
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyNumber_Add(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyFloat_FromDouble(sqrt(__pyx_t_14)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pp, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 2726, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_Pk2D = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":2727
 *         Pk = [(D0+kk*u0,D1+kk*u1,D2+kk*u2) for kk in KK]
 *         Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 *         rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]             # <<<<<<<<<<<<<<
 *         kPMin = KK[rk.index(min(rk))]
 *     return kPMin
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2727, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __pyx_v_Pk2D; __Pyx_INCREF(__pyx_t_8); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_8)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_10 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_13); __Pyx_INCREF(__pyx_t_10); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 2727, __pyx_L1_error)
      #else
      __pyx_t_10 = PySequence_ITEM(__pyx_t_8, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_pp, __pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_GetItemInt(__pyx_v_pp, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_RZ0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyNumber_Subtract(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pp, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = PyFloat_FromDouble(__pyx_v_RZ1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 2727, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_rk = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":2728
 *         Pk2D = [(Csqrt(pp[0]**2+pp[1]**2), pp[2]) for pp in Pk]
 *         rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 *         kPMin = KK[rk.index(min(rk))]             # <<<<<<<<<<<<<<
 *     return kPMin
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_rk, __pyx_n_s_index); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_rk);
    __Pyx_GIVEREF(__pyx_v_rk);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_rk);
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_min, __pyx_t_5, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2728, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2728, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_10};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2728, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_GetItem(__pyx_v_KK, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2728, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_kPMin = __pyx_t_14;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":2729
 *         rk = [(pp[0]-RZ0)**2+(pp[1]-RZ1)**2 for pp in Pk2D]
 *         kPMin = KK[rk.index(min(rk))]
 *     return kPMin             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_kPMin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2729, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2706
 * 
 * 
 * cdef LOS_sino_findRootkPMin_Tor(double uParN, double uN, double Sca, double RZ0, double RZ1, double ScaP, double DParN, double kOut, double D0, double D1, double D2, double u0, double u1, double u2, str Mode='LOS'):             # <<<<<<<<<<<<<<
 *     cdef double a4 = (uParN*uN*uN)**2, a3 = 2*( (Sca-RZ1*u2)*(uParN*uN)**2 + ScaP*uN**4 )
 *     cdef double a2 = (uParN*(Sca-RZ1*u2))**2 + 4.*ScaP*(Sca-RZ1*u2)*uN**2 + (DParN*uN*uN)**2 - (RZ0*uParN*uParN)**2
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_sino_findRootkPMin_Tor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_roo);
  __Pyx_XDECREF(__pyx_v_KK);
  __Pyx_XDECREF(__pyx_v_Pk);
  __Pyx_XDECREF(__pyx_v_Pk2D);
  __Pyx_XDECREF(__pyx_v_rk);
  __Pyx_XDECREF(__pyx_v_pp);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2733
 * 
 * 
 * cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2)
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03_LOS_sino_Tor(double __pyx_v_D0, double __pyx_v_D1, double __pyx_v_D2, double __pyx_v_u0, double __pyx_v_u1, double __pyx_v_u2, double __pyx_v_RZ0, double __pyx_v_RZ1, struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Tor *__pyx_optional_args) {
  PyObject *__pyx_v_Mode = ((PyObject*)__pyx_n_s_LOS);
  double __pyx_v_kOut = __pyx_k__275;
  double __pyx_v_uN;
  double __pyx_v_uParN;
  double __pyx_v_DParN;
  double __pyx_v_Sca;
  double __pyx_v_ScaP;
  double __pyx_v_kPMin;
  double __pyx_v_PMin0;
  double __pyx_v_PMin1;
  double __pyx_v_PMin2;
  double __pyx_v_PMin2norm;
  double __pyx_v_PMin2D0;
  double __pyx_v_PMin2D1;
  double __pyx_v_RMin;
  double __pyx_v_eTheta0;
  double __pyx_v_eTheta1;
  double __pyx_v_eTheta2;
  double __pyx_v_vP0;
  double __pyx_v_vP1;
  double __pyx_v_Theta;
  double __pyx_v_ImpTheta;
  double __pyx_v_er2D0;
  double __pyx_v_er2D1;
  double __pyx_v_p;
  double __pyx_v_uN0;
  double __pyx_v_uN1;
  double __pyx_v_uN2;
  double __pyx_v_phi;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  double __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("LOS_sino_Tor", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_Mode = __pyx_optional_args->Mode;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_kOut = __pyx_optional_args->kOut;
      }
    }
  }

  /* "tofu/geom/_GG03.pyx":2734
 * 
 * cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2)             # <<<<<<<<<<<<<<
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 *     cdef double    kPMin
 */
  __pyx_v_uN = sqrt(((pow(__pyx_v_u0, 2.0) + pow(__pyx_v_u1, 2.0)) + pow(__pyx_v_u2, 2.0)));
  __pyx_v_uParN = sqrt((pow(__pyx_v_u0, 2.0) + pow(__pyx_v_u1, 2.0)));
  __pyx_v_DParN = sqrt((pow(__pyx_v_D0, 2.0) + pow(__pyx_v_D1, 2.0)));

  /* "tofu/geom/_GG03.pyx":2735
 * cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2)
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1             # <<<<<<<<<<<<<<
 *     cdef double    kPMin
 *     if uParN == 0.:
 */
  __pyx_v_Sca = (((__pyx_v_u0 * __pyx_v_D0) + (__pyx_v_u1 * __pyx_v_D1)) + (__pyx_v_u2 * __pyx_v_D2));
  __pyx_v_ScaP = ((__pyx_v_u0 * __pyx_v_D0) + (__pyx_v_u1 * __pyx_v_D1));

  /* "tofu/geom/_GG03.pyx":2737
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 *     cdef double    kPMin
 *     if uParN == 0.:             # <<<<<<<<<<<<<<
 *         kPMin = (RZ1-D2)/u2
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_uParN == 0.) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2738
 *     cdef double    kPMin
 *     if uParN == 0.:
 *         kPMin = (RZ1-D2)/u2             # <<<<<<<<<<<<<<
 *     else:
 *         kPMin = LOS_sino_findRootkPMin_Tor(uParN, uN, Sca, RZ0, RZ1, ScaP, DParN, kOut, D0, D1, D2, u0, u1, u2, Mode=Mode)
 */
    __pyx_t_2 = (__pyx_v_RZ1 - __pyx_v_D2);
    if (unlikely(__pyx_v_u2 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 2738, __pyx_L1_error)
    }
    __pyx_v_kPMin = (__pyx_t_2 / __pyx_v_u2);

    /* "tofu/geom/_GG03.pyx":2737
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 *     cdef double    kPMin
 *     if uParN == 0.:             # <<<<<<<<<<<<<<
 *         kPMin = (RZ1-D2)/u2
 *     else:
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":2740
 *         kPMin = (RZ1-D2)/u2
 *     else:
 *         kPMin = LOS_sino_findRootkPMin_Tor(uParN, uN, Sca, RZ0, RZ1, ScaP, DParN, kOut, D0, D1, D2, u0, u1, u2, Mode=Mode)             # <<<<<<<<<<<<<<
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 *     cdef double    PMin2norm = Csqrt(PMin0**2+PMin1**2)
 */
  /*else*/ {
    __pyx_t_4.__pyx_n = 1;
    __pyx_t_4.Mode = __pyx_v_Mode;
    __pyx_t_3 = __pyx_f_4tofu_4geom_5_GG03_LOS_sino_findRootkPMin_Tor(__pyx_v_uParN, __pyx_v_uN, __pyx_v_Sca, __pyx_v_RZ0, __pyx_v_RZ1, __pyx_v_ScaP, __pyx_v_DParN, __pyx_v_kOut, __pyx_v_D0, __pyx_v_D1, __pyx_v_D2, __pyx_v_u0, __pyx_v_u1, __pyx_v_u2, &__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2740, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2740, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_kPMin = __pyx_t_2;
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":2741
 *     else:
 *         kPMin = LOS_sino_findRootkPMin_Tor(uParN, uN, Sca, RZ0, RZ1, ScaP, DParN, kOut, D0, D1, D2, u0, u1, u2, Mode=Mode)
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2             # <<<<<<<<<<<<<<
 *     cdef double    PMin2norm = Csqrt(PMin0**2+PMin1**2)
 *     cdef double    PMin2D0 = PMin2norm, PMin2D1 = PMin2
 */
  __pyx_v_PMin0 = (__pyx_v_D0 + (__pyx_v_kPMin * __pyx_v_u0));
  __pyx_v_PMin1 = (__pyx_v_D1 + (__pyx_v_kPMin * __pyx_v_u1));
  __pyx_v_PMin2 = (__pyx_v_D2 + (__pyx_v_kPMin * __pyx_v_u2));

  /* "tofu/geom/_GG03.pyx":2742
 *         kPMin = LOS_sino_findRootkPMin_Tor(uParN, uN, Sca, RZ0, RZ1, ScaP, DParN, kOut, D0, D1, D2, u0, u1, u2, Mode=Mode)
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 *     cdef double    PMin2norm = Csqrt(PMin0**2+PMin1**2)             # <<<<<<<<<<<<<<
 *     cdef double    PMin2D0 = PMin2norm, PMin2D1 = PMin2
 *     cdef double    RMin = Csqrt((PMin2D0-RZ0)**2+(PMin2D1-RZ1)**2)
 */
  __pyx_v_PMin2norm = sqrt((pow(__pyx_v_PMin0, 2.0) + pow(__pyx_v_PMin1, 2.0)));

  /* "tofu/geom/_GG03.pyx":2743
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 *     cdef double    PMin2norm = Csqrt(PMin0**2+PMin1**2)
 *     cdef double    PMin2D0 = PMin2norm, PMin2D1 = PMin2             # <<<<<<<<<<<<<<
 *     cdef double    RMin = Csqrt((PMin2D0-RZ0)**2+(PMin2D1-RZ1)**2)
 *     cdef double    eTheta0 = -PMin1/PMin2norm, eTheta1 = PMin0/PMin2norm, eTheta2 = 0.
 */
  __pyx_v_PMin2D0 = __pyx_v_PMin2norm;
  __pyx_v_PMin2D1 = __pyx_v_PMin2;

  /* "tofu/geom/_GG03.pyx":2744
 *     cdef double    PMin2norm = Csqrt(PMin0**2+PMin1**2)
 *     cdef double    PMin2D0 = PMin2norm, PMin2D1 = PMin2
 *     cdef double    RMin = Csqrt((PMin2D0-RZ0)**2+(PMin2D1-RZ1)**2)             # <<<<<<<<<<<<<<
 *     cdef double    eTheta0 = -PMin1/PMin2norm, eTheta1 = PMin0/PMin2norm, eTheta2 = 0.
 *     cdef double    vP0 = PMin2D0-RZ0, vP1 = PMin2D1-RZ1
 */
  __pyx_v_RMin = sqrt((pow((__pyx_v_PMin2D0 - __pyx_v_RZ0), 2.0) + pow((__pyx_v_PMin2D1 - __pyx_v_RZ1), 2.0)));

  /* "tofu/geom/_GG03.pyx":2745
 *     cdef double    PMin2D0 = PMin2norm, PMin2D1 = PMin2
 *     cdef double    RMin = Csqrt((PMin2D0-RZ0)**2+(PMin2D1-RZ1)**2)
 *     cdef double    eTheta0 = -PMin1/PMin2norm, eTheta1 = PMin0/PMin2norm, eTheta2 = 0.             # <<<<<<<<<<<<<<
 *     cdef double    vP0 = PMin2D0-RZ0, vP1 = PMin2D1-RZ1
 *     cdef double    Theta = Catan2(vP1,vP0)
 */
  __pyx_t_2 = (-__pyx_v_PMin1);
  if (unlikely(__pyx_v_PMin2norm == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2745, __pyx_L1_error)
  }
  __pyx_v_eTheta0 = (__pyx_t_2 / __pyx_v_PMin2norm);
  if (unlikely(__pyx_v_PMin2norm == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2745, __pyx_L1_error)
  }
  __pyx_v_eTheta1 = (__pyx_v_PMin0 / __pyx_v_PMin2norm);
  __pyx_v_eTheta2 = 0.;

  /* "tofu/geom/_GG03.pyx":2746
 *     cdef double    RMin = Csqrt((PMin2D0-RZ0)**2+(PMin2D1-RZ1)**2)
 *     cdef double    eTheta0 = -PMin1/PMin2norm, eTheta1 = PMin0/PMin2norm, eTheta2 = 0.
 *     cdef double    vP0 = PMin2D0-RZ0, vP1 = PMin2D1-RZ1             # <<<<<<<<<<<<<<
 *     cdef double    Theta = Catan2(vP1,vP0)
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 */
  __pyx_v_vP0 = (__pyx_v_PMin2D0 - __pyx_v_RZ0);
  __pyx_v_vP1 = (__pyx_v_PMin2D1 - __pyx_v_RZ1);

  /* "tofu/geom/_GG03.pyx":2747
 *     cdef double    eTheta0 = -PMin1/PMin2norm, eTheta1 = PMin0/PMin2norm, eTheta2 = 0.
 *     cdef double    vP0 = PMin2D0-RZ0, vP1 = PMin2D1-RZ1
 *     cdef double    Theta = Catan2(vP1,vP0)             # <<<<<<<<<<<<<<
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 */
  __pyx_v_Theta = atan2(__pyx_v_vP1, __pyx_v_vP0);

  /* "tofu/geom/_GG03.pyx":2748
 *     cdef double    vP0 = PMin2D0-RZ0, vP1 = PMin2D1-RZ1
 *     cdef double    Theta = Catan2(vP1,vP0)
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi             # <<<<<<<<<<<<<<
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 */
  if (((__pyx_v_Theta >= 0.0) != 0)) {
    __pyx_t_2 = __pyx_v_Theta;
  } else {
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_Theta); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_pi); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2748, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_2 = __pyx_t_7;
  }
  __pyx_v_ImpTheta = __pyx_t_2;

  /* "tofu/geom/_GG03.pyx":2749
 *     cdef double    Theta = Catan2(vP1,vP0)
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)             # <<<<<<<<<<<<<<
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 */
  __pyx_v_er2D0 = cos(__pyx_v_ImpTheta);
  __pyx_v_er2D1 = sin(__pyx_v_ImpTheta);

  /* "tofu/geom/_GG03.pyx":2750
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 *     cdef double    p = vP0*er2D0 + vP1*er2D1             # <<<<<<<<<<<<<<
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 *     cdef double    phi = Casin(-uN0*eTheta0 -uN1*eTheta1 -uN2*eTheta2)
 */
  __pyx_v_p = ((__pyx_v_vP0 * __pyx_v_er2D0) + (__pyx_v_vP1 * __pyx_v_er2D1));

  /* "tofu/geom/_GG03.pyx":2751
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN             # <<<<<<<<<<<<<<
 *     cdef double    phi = Casin(-uN0*eTheta0 -uN1*eTheta1 -uN2*eTheta2)
 *     return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi
 */
  if (unlikely(__pyx_v_uN == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2751, __pyx_L1_error)
  }
  __pyx_v_uN0 = (__pyx_v_u0 / __pyx_v_uN);
  if (unlikely(__pyx_v_uN == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2751, __pyx_L1_error)
  }
  __pyx_v_uN1 = (__pyx_v_u1 / __pyx_v_uN);
  if (unlikely(__pyx_v_uN == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2751, __pyx_L1_error)
  }
  __pyx_v_uN2 = (__pyx_v_u2 / __pyx_v_uN);

  /* "tofu/geom/_GG03.pyx":2752
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 *     cdef double    phi = Casin(-uN0*eTheta0 -uN1*eTheta1 -uN2*eTheta2)             # <<<<<<<<<<<<<<
 *     return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi
 * 
 */
  __pyx_v_phi = asin(((((-__pyx_v_uN0) * __pyx_v_eTheta0) - (__pyx_v_uN1 * __pyx_v_eTheta1)) - (__pyx_v_uN2 * __pyx_v_eTheta2)));

  /* "tofu/geom/_GG03.pyx":2753
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 *     cdef double    phi = Casin(-uN0*eTheta0 -uN1*eTheta1 -uN2*eTheta2)
 *     return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_PMin0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_PMin1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_PMin2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_3);
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_kPMin); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_RMin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = PyFloat_FromDouble(__pyx_v_Theta); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_9 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_ImpTheta); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_phi); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyTuple_New(7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_12, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_12, 4, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_12, 5, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_12, 6, __pyx_t_11);
  __pyx_t_8 = 0;
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_5 = 0;
  __pyx_t_9 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_r = __pyx_t_12;
  __pyx_t_12 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2733
 * 
 * 
 * cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2)
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_sino_Tor", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2757
 * 
 * 
 * cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    kPMin
 *     if u0**2==1.:
 */

static PyObject *__pyx_f_4tofu_4geom_5_GG03_LOS_sino_Lin(double __pyx_v_D0, double __pyx_v_D1, double __pyx_v_D2, double __pyx_v_u0, double __pyx_v_u1, double __pyx_v_u2, double __pyx_v_RZ0, double __pyx_v_RZ1, struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Lin *__pyx_optional_args) {
  PyObject *__pyx_v_Mode = ((PyObject*)__pyx_n_s_LOS);
  double __pyx_v_kOut = __pyx_k__276;
  double __pyx_v_kPMin;
  double __pyx_v_PMin0;
  double __pyx_v_PMin1;
  double __pyx_v_PMin2;
  double __pyx_v_RMin;
  double __pyx_v_vP0;
  double __pyx_v_vP1;
  double __pyx_v_Theta;
  double __pyx_v_ImpTheta;
  double __pyx_v_er2D0;
  double __pyx_v_er2D1;
  double __pyx_v_p;
  double __pyx_v_uN;
  double __pyx_v_uN0;
  double __pyx_v_uN1;
  double __pyx_v_uN2;
  double __pyx_v_phi;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  double __pyx_t_2;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("LOS_sino_Lin", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_Mode = __pyx_optional_args->Mode;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_kOut = __pyx_optional_args->kOut;
      }
    }
  }

  /* "tofu/geom/_GG03.pyx":2759
 * cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):
 *     cdef double    kPMin
 *     if u0**2==1.:             # <<<<<<<<<<<<<<
 *         kPMin = 0.
 *     else:
 */
  __pyx_t_1 = ((pow(__pyx_v_u0, 2.0) == 1.) != 0);
  if (__pyx_t_1) {

    /* "tofu/geom/_GG03.pyx":2760
 *     cdef double    kPMin
 *     if u0**2==1.:
 *         kPMin = 0.             # <<<<<<<<<<<<<<
 *     else:
 *         kPMin = ( (RZ0-D1)*u1+(RZ1-D2)*u2 ) / (1-u0**2)
 */
    __pyx_v_kPMin = 0.;

    /* "tofu/geom/_GG03.pyx":2759
 * cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):
 *     cdef double    kPMin
 *     if u0**2==1.:             # <<<<<<<<<<<<<<
 *         kPMin = 0.
 *     else:
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":2762
 *         kPMin = 0.
 *     else:
 *         kPMin = ( (RZ0-D1)*u1+(RZ1-D2)*u2 ) / (1-u0**2)             # <<<<<<<<<<<<<<
 *     kPMin = kOut if Mode=='LOS' and kPMin > kOut else kPMin
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 */
  /*else*/ {
    __pyx_t_2 = (((__pyx_v_RZ0 - __pyx_v_D1) * __pyx_v_u1) + ((__pyx_v_RZ1 - __pyx_v_D2) * __pyx_v_u2));
    __pyx_t_3 = (1.0 - pow(__pyx_v_u0, 2.0));
    if (unlikely(__pyx_t_3 == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "float division");
      __PYX_ERR(0, 2762, __pyx_L1_error)
    }
    __pyx_v_kPMin = (__pyx_t_2 / __pyx_t_3);
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":2763
 *     else:
 *         kPMin = ( (RZ0-D1)*u1+(RZ1-D2)*u2 ) / (1-u0**2)
 *     kPMin = kOut if Mode=='LOS' and kPMin > kOut else kPMin             # <<<<<<<<<<<<<<
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 *     cdef double    RMin = Csqrt((PMin1-RZ0)**2+(PMin2-RZ1)**2)
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_Mode, __pyx_n_s_LOS, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 2763, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_1 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = ((__pyx_v_kPMin > __pyx_v_kOut) != 0);
  __pyx_t_1 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {
    __pyx_t_3 = __pyx_v_kOut;
  } else {
    __pyx_t_3 = __pyx_v_kPMin;
  }
  __pyx_v_kPMin = __pyx_t_3;

  /* "tofu/geom/_GG03.pyx":2764
 *         kPMin = ( (RZ0-D1)*u1+(RZ1-D2)*u2 ) / (1-u0**2)
 *     kPMin = kOut if Mode=='LOS' and kPMin > kOut else kPMin
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2             # <<<<<<<<<<<<<<
 *     cdef double    RMin = Csqrt((PMin1-RZ0)**2+(PMin2-RZ1)**2)
 *     cdef double    vP0 = PMin1-RZ0, vP1 = PMin2-RZ1
 */
  __pyx_v_PMin0 = (__pyx_v_D0 + (__pyx_v_kPMin * __pyx_v_u0));
  __pyx_v_PMin1 = (__pyx_v_D1 + (__pyx_v_kPMin * __pyx_v_u1));
  __pyx_v_PMin2 = (__pyx_v_D2 + (__pyx_v_kPMin * __pyx_v_u2));

  /* "tofu/geom/_GG03.pyx":2765
 *     kPMin = kOut if Mode=='LOS' and kPMin > kOut else kPMin
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 *     cdef double    RMin = Csqrt((PMin1-RZ0)**2+(PMin2-RZ1)**2)             # <<<<<<<<<<<<<<
 *     cdef double    vP0 = PMin1-RZ0, vP1 = PMin2-RZ1
 *     cdef double    Theta = Catan2(vP1,vP0)
 */
  __pyx_v_RMin = sqrt((pow((__pyx_v_PMin1 - __pyx_v_RZ0), 2.0) + pow((__pyx_v_PMin2 - __pyx_v_RZ1), 2.0)));

  /* "tofu/geom/_GG03.pyx":2766
 *     cdef double    PMin0 = D0+kPMin*u0, PMin1 = D1+kPMin*u1, PMin2 = D2+kPMin*u2
 *     cdef double    RMin = Csqrt((PMin1-RZ0)**2+(PMin2-RZ1)**2)
 *     cdef double    vP0 = PMin1-RZ0, vP1 = PMin2-RZ1             # <<<<<<<<<<<<<<
 *     cdef double    Theta = Catan2(vP1,vP0)
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 */
  __pyx_v_vP0 = (__pyx_v_PMin1 - __pyx_v_RZ0);
  __pyx_v_vP1 = (__pyx_v_PMin2 - __pyx_v_RZ1);

  /* "tofu/geom/_GG03.pyx":2767
 *     cdef double    RMin = Csqrt((PMin1-RZ0)**2+(PMin2-RZ1)**2)
 *     cdef double    vP0 = PMin1-RZ0, vP1 = PMin2-RZ1
 *     cdef double    Theta = Catan2(vP1,vP0)             # <<<<<<<<<<<<<<
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 */
  __pyx_v_Theta = atan2(__pyx_v_vP1, __pyx_v_vP0);

  /* "tofu/geom/_GG03.pyx":2768
 *     cdef double    vP0 = PMin1-RZ0, vP1 = PMin2-RZ1
 *     cdef double    Theta = Catan2(vP1,vP0)
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi             # <<<<<<<<<<<<<<
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 */
  if (((__pyx_v_Theta >= 0.0) != 0)) {
    __pyx_t_3 = __pyx_v_Theta;
  } else {
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_Theta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_pi); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Add(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2768, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __pyx_t_2;
  }
  __pyx_v_ImpTheta = __pyx_t_3;

  /* "tofu/geom/_GG03.pyx":2769
 *     cdef double    Theta = Catan2(vP1,vP0)
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)             # <<<<<<<<<<<<<<
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2)
 */
  __pyx_v_er2D0 = cos(__pyx_v_ImpTheta);
  __pyx_v_er2D1 = sin(__pyx_v_ImpTheta);

  /* "tofu/geom/_GG03.pyx":2770
 *     cdef double    ImpTheta = Theta if Theta>=0 else Theta + np.pi
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 *     cdef double    p = vP0*er2D0 + vP1*er2D1             # <<<<<<<<<<<<<<
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2)
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 */
  __pyx_v_p = ((__pyx_v_vP0 * __pyx_v_er2D0) + (__pyx_v_vP1 * __pyx_v_er2D1));

  /* "tofu/geom/_GG03.pyx":2771
 *     cdef double    er2D0 = Ccos(ImpTheta), er2D1 = Csin(ImpTheta)
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2)             # <<<<<<<<<<<<<<
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 *     cdef double    phi = Catan2(uN0, Csqrt(uN1**2+uN2**2))
 */
  __pyx_v_uN = sqrt(((pow(__pyx_v_u0, 2.0) + pow(__pyx_v_u1, 2.0)) + pow(__pyx_v_u2, 2.0)));

  /* "tofu/geom/_GG03.pyx":2772
 *     cdef double    p = vP0*er2D0 + vP1*er2D1
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2)
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN             # <<<<<<<<<<<<<<
 *     cdef double    phi = Catan2(uN0, Csqrt(uN1**2+uN2**2))
 *     return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi
 */
  if (unlikely(__pyx_v_uN == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2772, __pyx_L1_error)
  }
  __pyx_v_uN0 = (__pyx_v_u0 / __pyx_v_uN);
  if (unlikely(__pyx_v_uN == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2772, __pyx_L1_error)
  }
  __pyx_v_uN1 = (__pyx_v_u1 / __pyx_v_uN);
  if (unlikely(__pyx_v_uN == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "float division");
    __PYX_ERR(0, 2772, __pyx_L1_error)
  }
  __pyx_v_uN2 = (__pyx_v_u2 / __pyx_v_uN);

  /* "tofu/geom/_GG03.pyx":2773
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2)
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 *     cdef double    phi = Catan2(uN0, Csqrt(uN1**2+uN2**2))             # <<<<<<<<<<<<<<
 *     return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi
 * 
 */
  __pyx_v_phi = atan2(__pyx_v_uN0, sqrt((pow(__pyx_v_uN1, 2.0) + pow(__pyx_v_uN2, 2.0))));

  /* "tofu/geom/_GG03.pyx":2774
 *     cdef double    uN0 = u0/uN, uN1 = u1/uN, uN2 = u2/uN
 *     cdef double    phi = Catan2(uN0, Csqrt(uN1**2+uN2**2))
 *     return (PMin0,PMin1,PMin2), kPMin, RMin, Theta, p, ImpTheta, phi             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_PMin0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_PMin1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_PMin2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_6);
  __pyx_t_7 = 0;
  __pyx_t_8 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyFloat_FromDouble(__pyx_v_kPMin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_8 = PyFloat_FromDouble(__pyx_v_RMin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_7 = PyFloat_FromDouble(__pyx_v_Theta); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = PyFloat_FromDouble(__pyx_v_ImpTheta); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_phi); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = PyTuple_New(7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2774, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_9);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_13, 3, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_13, 4, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_13, 5, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_13, 6, __pyx_t_12);
  __pyx_t_9 = 0;
  __pyx_t_6 = 0;
  __pyx_t_8 = 0;
  __pyx_t_7 = 0;
  __pyx_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_r = __pyx_t_13;
  __pyx_t_13 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2757
 * 
 * 
 * cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    kPMin
 *     if u0**2==1.:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_sino_Lin", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "tofu/geom/_GG03.pyx":2777
 * 
 * 
 * def LOS_sino(double[:,::1] D, double[:,::1] u, double[::1] RZ, double[::1] kOut, str Mode='LOS', str VType='Tor'):             # <<<<<<<<<<<<<<
 *     cdef unsigned int nL = D.shape[1], ii
 *     cdef tuple out
 */

/* Python wrapper */
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_53LOS_sino(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_4tofu_4geom_5_GG03_53LOS_sino = {"LOS_sino", (PyCFunction)__pyx_pw_4tofu_4geom_5_GG03_53LOS_sino, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_4tofu_4geom_5_GG03_53LOS_sino(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __Pyx_memviewslice __pyx_v_D = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_u = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_RZ = { 0, 0, { 0 }, { 0 }, { 0 } };
  __Pyx_memviewslice __pyx_v_kOut = { 0, 0, { 0 }, { 0 }, { 0 } };
  PyObject *__pyx_v_Mode = 0;
  PyObject *__pyx_v_VType = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("LOS_sino (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_D,&__pyx_n_s_u,&__pyx_n_s_RZ,&__pyx_n_s_kOut,&__pyx_n_s_Mode,&__pyx_n_s_VType,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[4] = ((PyObject*)__pyx_n_s_LOS);
    values[5] = ((PyObject*)__pyx_n_s_Tor);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_D)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_u)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_sino", 0, 4, 6, 1); __PYX_ERR(0, 2777, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RZ)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_sino", 0, 4, 6, 2); __PYX_ERR(0, 2777, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kOut)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("LOS_sino", 0, 4, 6, 3); __PYX_ERR(0, 2777, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Mode);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_VType);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "LOS_sino") < 0)) __PYX_ERR(0, 2777, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_D = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[0]); if (unlikely(!__pyx_v_D.memview)) __PYX_ERR(0, 2777, __pyx_L3_error)
    __pyx_v_u = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[1]); if (unlikely(!__pyx_v_u.memview)) __PYX_ERR(0, 2777, __pyx_L3_error)
    __pyx_v_RZ = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[2]); if (unlikely(!__pyx_v_RZ.memview)) __PYX_ERR(0, 2777, __pyx_L3_error)
    __pyx_v_kOut = __Pyx_PyObject_to_MemoryviewSlice_dc_double(values[3]); if (unlikely(!__pyx_v_kOut.memview)) __PYX_ERR(0, 2777, __pyx_L3_error)
    __pyx_v_Mode = ((PyObject*)values[4]);
    __pyx_v_VType = ((PyObject*)values[5]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("LOS_sino", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 2777, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_sino", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Mode), (&PyString_Type), 1, "Mode", 1))) __PYX_ERR(0, 2777, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_VType), (&PyString_Type), 1, "VType", 1))) __PYX_ERR(0, 2777, __pyx_L1_error)
  __pyx_r = __pyx_pf_4tofu_4geom_5_GG03_52LOS_sino(__pyx_self, __pyx_v_D, __pyx_v_u, __pyx_v_RZ, __pyx_v_kOut, __pyx_v_Mode, __pyx_v_VType);

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_4tofu_4geom_5_GG03_52LOS_sino(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_D, __Pyx_memviewslice __pyx_v_u, __Pyx_memviewslice __pyx_v_RZ, __Pyx_memviewslice __pyx_v_kOut, PyObject *__pyx_v_Mode, PyObject *__pyx_v_VType) {
  unsigned int __pyx_v_nL;
  unsigned int __pyx_v_ii;
  PyObject *__pyx_v_out = 0;
  PyArrayObject *__pyx_v_PMin = 0;
  PyArrayObject *__pyx_v_kPMin = 0;
  PyArrayObject *__pyx_v_RMin = 0;
  PyArrayObject *__pyx_v_Theta = 0;
  PyArrayObject *__pyx_v_p = 0;
  PyArrayObject *__pyx_v_ImpTheta = 0;
  PyArrayObject *__pyx_v_phi = 0;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_ImpTheta;
  __Pyx_Buffer __pyx_pybuffer_ImpTheta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_PMin;
  __Pyx_Buffer __pyx_pybuffer_PMin;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_RMin;
  __Pyx_Buffer __pyx_pybuffer_RMin;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_Theta;
  __Pyx_Buffer __pyx_pybuffer_Theta;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_kPMin;
  __Pyx_Buffer __pyx_pybuffer_kPMin;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_p;
  __Pyx_Buffer __pyx_pybuffer_p;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_phi;
  __Pyx_Buffer __pyx_pybuffer_phi;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyArrayObject *__pyx_t_6 = NULL;
  PyArrayObject *__pyx_t_7 = NULL;
  PyArrayObject *__pyx_t_8 = NULL;
  PyArrayObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  unsigned int __pyx_t_11;
  unsigned int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  size_t __pyx_t_14;
  int __pyx_t_15;
  Py_ssize_t __pyx_t_16;
  size_t __pyx_t_17;
  Py_ssize_t __pyx_t_18;
  size_t __pyx_t_19;
  Py_ssize_t __pyx_t_20;
  size_t __pyx_t_21;
  Py_ssize_t __pyx_t_22;
  size_t __pyx_t_23;
  Py_ssize_t __pyx_t_24;
  size_t __pyx_t_25;
  Py_ssize_t __pyx_t_26;
  Py_ssize_t __pyx_t_27;
  size_t __pyx_t_28;
  struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Tor __pyx_t_29;
  PyObject *__pyx_t_30 = NULL;
  PyObject *__pyx_t_31 = NULL;
  double __pyx_t_32;
  double __pyx_t_33;
  double __pyx_t_34;
  double __pyx_t_35;
  double __pyx_t_36;
  double __pyx_t_37;
  PyObject *__pyx_t_38 = NULL;
  PyObject *__pyx_t_39 = NULL;
  PyObject *__pyx_t_40 = NULL;
  PyObject *__pyx_t_41 = NULL;
  PyObject *(*__pyx_t_42)(PyObject *);
  double __pyx_t_43;
  double __pyx_t_44;
  double __pyx_t_45;
  Py_ssize_t __pyx_t_46;
  size_t __pyx_t_47;
  Py_ssize_t __pyx_t_48;
  size_t __pyx_t_49;
  Py_ssize_t __pyx_t_50;
  size_t __pyx_t_51;
  size_t __pyx_t_52;
  size_t __pyx_t_53;
  size_t __pyx_t_54;
  size_t __pyx_t_55;
  size_t __pyx_t_56;
  size_t __pyx_t_57;
  Py_ssize_t __pyx_t_58;
  size_t __pyx_t_59;
  Py_ssize_t __pyx_t_60;
  size_t __pyx_t_61;
  Py_ssize_t __pyx_t_62;
  size_t __pyx_t_63;
  Py_ssize_t __pyx_t_64;
  size_t __pyx_t_65;
  Py_ssize_t __pyx_t_66;
  size_t __pyx_t_67;
  Py_ssize_t __pyx_t_68;
  size_t __pyx_t_69;
  Py_ssize_t __pyx_t_70;
  Py_ssize_t __pyx_t_71;
  size_t __pyx_t_72;
  struct __pyx_opt_args_4tofu_4geom_5_GG03_LOS_sino_Lin __pyx_t_73;
  Py_ssize_t __pyx_t_74;
  size_t __pyx_t_75;
  Py_ssize_t __pyx_t_76;
  size_t __pyx_t_77;
  Py_ssize_t __pyx_t_78;
  size_t __pyx_t_79;
  size_t __pyx_t_80;
  size_t __pyx_t_81;
  size_t __pyx_t_82;
  size_t __pyx_t_83;
  size_t __pyx_t_84;
  size_t __pyx_t_85;
  __Pyx_RefNannySetupContext("LOS_sino", 0);
  __pyx_pybuffer_PMin.pybuffer.buf = NULL;
  __pyx_pybuffer_PMin.refcount = 0;
  __pyx_pybuffernd_PMin.data = NULL;
  __pyx_pybuffernd_PMin.rcbuffer = &__pyx_pybuffer_PMin;
  __pyx_pybuffer_kPMin.pybuffer.buf = NULL;
  __pyx_pybuffer_kPMin.refcount = 0;
  __pyx_pybuffernd_kPMin.data = NULL;
  __pyx_pybuffernd_kPMin.rcbuffer = &__pyx_pybuffer_kPMin;
  __pyx_pybuffer_RMin.pybuffer.buf = NULL;
  __pyx_pybuffer_RMin.refcount = 0;
  __pyx_pybuffernd_RMin.data = NULL;
  __pyx_pybuffernd_RMin.rcbuffer = &__pyx_pybuffer_RMin;
  __pyx_pybuffer_Theta.pybuffer.buf = NULL;
  __pyx_pybuffer_Theta.refcount = 0;
  __pyx_pybuffernd_Theta.data = NULL;
  __pyx_pybuffernd_Theta.rcbuffer = &__pyx_pybuffer_Theta;
  __pyx_pybuffer_p.pybuffer.buf = NULL;
  __pyx_pybuffer_p.refcount = 0;
  __pyx_pybuffernd_p.data = NULL;
  __pyx_pybuffernd_p.rcbuffer = &__pyx_pybuffer_p;
  __pyx_pybuffer_ImpTheta.pybuffer.buf = NULL;
  __pyx_pybuffer_ImpTheta.refcount = 0;
  __pyx_pybuffernd_ImpTheta.data = NULL;
  __pyx_pybuffernd_ImpTheta.rcbuffer = &__pyx_pybuffer_ImpTheta;
  __pyx_pybuffer_phi.pybuffer.buf = NULL;
  __pyx_pybuffer_phi.refcount = 0;
  __pyx_pybuffernd_phi.data = NULL;
  __pyx_pybuffernd_phi.rcbuffer = &__pyx_pybuffer_phi;

  /* "tofu/geom/_GG03.pyx":2778
 * 
 * def LOS_sino(double[:,::1] D, double[:,::1] u, double[::1] RZ, double[::1] kOut, str Mode='LOS', str VType='Tor'):
 *     cdef unsigned int nL = D.shape[1], ii             # <<<<<<<<<<<<<<
 *     cdef tuple out
 *     cdef cnp.ndarray[double,ndim=2] PMin = np.empty((3,nL))
 */
  __pyx_v_nL = (__pyx_v_D.shape[1]);

  /* "tofu/geom/_GG03.pyx":2780
 *     cdef unsigned int nL = D.shape[1], ii
 *     cdef tuple out
 *     cdef cnp.ndarray[double,ndim=2] PMin = np.empty((3,nL))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] kPMin=np.empty((nL,)), RMin=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,))
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_3);
  __Pyx_GIVEREF(__pyx_int_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2780, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2780, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2780, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2780, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2780, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2780, __pyx_L1_error)
  __pyx_t_6 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_PMin.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {
      __pyx_v_PMin = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2780, __pyx_L1_error)
    } else {__pyx_pybuffernd_PMin.diminfo[0].strides = __pyx_pybuffernd_PMin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_PMin.diminfo[0].shape = __pyx_pybuffernd_PMin.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_PMin.diminfo[1].strides = __pyx_pybuffernd_PMin.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_PMin.diminfo[1].shape = __pyx_pybuffernd_PMin.rcbuffer->pybuffer.shape[1];
    }
  }
  __pyx_t_6 = 0;
  __pyx_v_PMin = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2781
 *     cdef tuple out
 *     cdef cnp.ndarray[double,ndim=2] PMin = np.empty((3,nL))
 *     cdef cnp.ndarray[double,ndim=1] kPMin=np.empty((nL,)), RMin=np.empty((nL,))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,))
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2781, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_kPMin.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_kPMin = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_kPMin.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2781, __pyx_L1_error)
    } else {__pyx_pybuffernd_kPMin.diminfo[0].strides = __pyx_pybuffernd_kPMin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_kPMin.diminfo[0].shape = __pyx_pybuffernd_kPMin.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_kPMin = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2781, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2781, __pyx_L1_error)
  __pyx_t_7 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_RMin.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_RMin = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_RMin.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2781, __pyx_L1_error)
    } else {__pyx_pybuffernd_RMin.diminfo[0].strides = __pyx_pybuffernd_RMin.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_RMin.diminfo[0].shape = __pyx_pybuffernd_RMin.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_7 = 0;
  __pyx_v_RMin = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2782
 *     cdef cnp.ndarray[double,ndim=2] PMin = np.empty((3,nL))
 *     cdef cnp.ndarray[double,ndim=1] kPMin=np.empty((nL,)), RMin=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,))             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,))
 *     if VType.lower()=='tor':
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2782, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_Theta.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_Theta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_Theta.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2782, __pyx_L1_error)
    } else {__pyx_pybuffernd_Theta.diminfo[0].strides = __pyx_pybuffernd_Theta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_Theta.diminfo[0].shape = __pyx_pybuffernd_Theta.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_Theta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_empty); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2782, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2782, __pyx_L1_error)
  __pyx_t_8 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_p.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_p = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_p.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2782, __pyx_L1_error)
    } else {__pyx_pybuffernd_p.diminfo[0].strides = __pyx_pybuffernd_p.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_p.diminfo[0].shape = __pyx_pybuffernd_p.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_8 = 0;
  __pyx_v_p = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2783
 *     cdef cnp.ndarray[double,ndim=1] kPMin=np.empty((nL,)), RMin=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,))             # <<<<<<<<<<<<<<
 *     if VType.lower()=='tor':
 *         for ii in range(0,nL):
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2783, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_ImpTheta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2783, __pyx_L1_error)
    } else {__pyx_pybuffernd_ImpTheta.diminfo[0].strides = __pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ImpTheta.diminfo[0].shape = __pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_ImpTheta = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_unsigned_int(__pyx_v_nL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2783, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2783, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 2783, __pyx_L1_error)
  __pyx_t_9 = ((PyArrayObject *)__pyx_t_1);
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_phi.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
      __pyx_v_phi = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_phi.rcbuffer->pybuffer.buf = NULL;
      __PYX_ERR(0, 2783, __pyx_L1_error)
    } else {__pyx_pybuffernd_phi.diminfo[0].strides = __pyx_pybuffernd_phi.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_phi.diminfo[0].shape = __pyx_pybuffernd_phi.rcbuffer->pybuffer.shape[0];
    }
  }
  __pyx_t_9 = 0;
  __pyx_v_phi = ((PyArrayObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2784
 *     cdef cnp.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,))
 *     if VType.lower()=='tor':             # <<<<<<<<<<<<<<
 *         for ii in range(0,nL):
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_VType, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2784, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2784, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2784, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_10 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_tor, Py_EQ)); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 2784, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_10) {

    /* "tofu/geom/_GG03.pyx":2785
 *     cdef cnp.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,))
 *     if VType.lower()=='tor':
 *         for ii in range(0,nL):             # <<<<<<<<<<<<<<
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 */
    __pyx_t_11 = __pyx_v_nL;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_ii = __pyx_t_12;

      /* "tofu/geom/_GG03.pyx":2786
 *     if VType.lower()=='tor':
 *         for ii in range(0,nL):
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],             # <<<<<<<<<<<<<<
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 */
      __pyx_t_13 = 0;
      __pyx_t_14 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_13 < 0) {
        __pyx_t_13 += __pyx_v_D.shape[0];
        if (unlikely(__pyx_t_13 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_13 >= __pyx_v_D.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_14 >= (size_t)__pyx_v_D.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2786, __pyx_L1_error)
      }
      __pyx_t_16 = 1;
      __pyx_t_17 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_16 < 0) {
        __pyx_t_16 += __pyx_v_D.shape[0];
        if (unlikely(__pyx_t_16 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_16 >= __pyx_v_D.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_17 >= (size_t)__pyx_v_D.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2786, __pyx_L1_error)
      }
      __pyx_t_18 = 2;
      __pyx_t_19 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_18 < 0) {
        __pyx_t_18 += __pyx_v_D.shape[0];
        if (unlikely(__pyx_t_18 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_18 >= __pyx_v_D.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_19 >= (size_t)__pyx_v_D.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2786, __pyx_L1_error)
      }
      __pyx_t_20 = 0;
      __pyx_t_21 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_20 < 0) {
        __pyx_t_20 += __pyx_v_u.shape[0];
        if (unlikely(__pyx_t_20 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_20 >= __pyx_v_u.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_21 >= (size_t)__pyx_v_u.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2786, __pyx_L1_error)
      }
      __pyx_t_22 = 1;
      __pyx_t_23 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_22 < 0) {
        __pyx_t_22 += __pyx_v_u.shape[0];
        if (unlikely(__pyx_t_22 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_22 >= __pyx_v_u.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_23 >= (size_t)__pyx_v_u.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2786, __pyx_L1_error)
      }
      __pyx_t_24 = 2;
      __pyx_t_25 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_24 < 0) {
        __pyx_t_24 += __pyx_v_u.shape[0];
        if (unlikely(__pyx_t_24 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_24 >= __pyx_v_u.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_25 >= (size_t)__pyx_v_u.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2786, __pyx_L1_error)
      }

      /* "tofu/geom/_GG03.pyx":2787
 *         for ii in range(0,nL):
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])             # <<<<<<<<<<<<<<
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out
 */
      __pyx_t_26 = 0;
      __pyx_t_15 = -1;
      if (__pyx_t_26 < 0) {
        __pyx_t_26 += __pyx_v_RZ.shape[0];
        if (unlikely(__pyx_t_26 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_26 >= __pyx_v_RZ.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2787, __pyx_L1_error)
      }
      __pyx_t_27 = 1;
      __pyx_t_15 = -1;
      if (__pyx_t_27 < 0) {
        __pyx_t_27 += __pyx_v_RZ.shape[0];
        if (unlikely(__pyx_t_27 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_27 >= __pyx_v_RZ.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2787, __pyx_L1_error)
      }
      __pyx_t_28 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_28 >= (size_t)__pyx_v_kOut.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2787, __pyx_L1_error)
      }

      /* "tofu/geom/_GG03.pyx":2786
 *     if VType.lower()=='tor':
 *         for ii in range(0,nL):
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],             # <<<<<<<<<<<<<<
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 */
      __pyx_t_29.__pyx_n = 2;
      __pyx_t_29.Mode = __pyx_v_Mode;
      __pyx_t_29.kOut = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_kOut.data) + __pyx_t_28)) )));
      __pyx_t_1 = __pyx_f_4tofu_4geom_5_GG03_LOS_sino_Tor((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_13 * __pyx_v_D.strides[0]) )) + __pyx_t_14)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_16 * __pyx_v_D.strides[0]) )) + __pyx_t_17)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_18 * __pyx_v_D.strides[0]) )) + __pyx_t_19)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_20 * __pyx_v_u.strides[0]) )) + __pyx_t_21)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_22 * __pyx_v_u.strides[0]) )) + __pyx_t_23)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_24 * __pyx_v_u.strides[0]) )) + __pyx_t_25)) ))), (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_RZ.data) + __pyx_t_26)) ))), (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_RZ.data) + __pyx_t_27)) ))), &__pyx_t_29); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2786, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 2786, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_1));
      __pyx_t_1 = 0;

      /* "tofu/geom/_GG03.pyx":2789
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out             # <<<<<<<<<<<<<<
 *     else:
 *         for ii in range(0,nL):
 */
      if (likely(__pyx_v_out != Py_None)) {
        PyObject* sequence = __pyx_v_out;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 7)) {
          if (size > 7) __Pyx_RaiseTooManyValuesError(7);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2788, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_30 = PyTuple_GET_ITEM(sequence, 5); 
        __pyx_t_31 = PyTuple_GET_ITEM(sequence, 6); 
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_30);
        __Pyx_INCREF(__pyx_t_31);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[7] = {&__pyx_t_1,&__pyx_t_3,&__pyx_t_5,&__pyx_t_4,&__pyx_t_2,&__pyx_t_30,&__pyx_t_31};
          for (i=0; i < 7; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2788, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2788, __pyx_L1_error)
      }

      /* "tofu/geom/_GG03.pyx":2788
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),             # <<<<<<<<<<<<<<
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out
 *     else:
 */
      __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_32 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_33 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_33 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_34 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_34 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_35 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_35 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_36 = __pyx_PyFloat_AsDouble(__pyx_t_30); if (unlikely((__pyx_t_36 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __pyx_t_37 = __pyx_PyFloat_AsDouble(__pyx_t_31); if (unlikely((__pyx_t_37 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
        PyObject* sequence = __pyx_t_1;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2788, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_38 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_39 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_40 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_38 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_39 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_40 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_38);
        __Pyx_INCREF(__pyx_t_39);
        __Pyx_INCREF(__pyx_t_40);
        #else
        __pyx_t_38 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 2788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_38);
        __pyx_t_39 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 2788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_39);
        __pyx_t_40 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        #endif
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_41 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2788, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_42 = Py_TYPE(__pyx_t_41)->tp_iternext;
        index = 0; __pyx_t_38 = __pyx_t_42(__pyx_t_41); if (unlikely(!__pyx_t_38)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_38);
        index = 1; __pyx_t_39 = __pyx_t_42(__pyx_t_41); if (unlikely(!__pyx_t_39)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_39);
        index = 2; __pyx_t_40 = __pyx_t_42(__pyx_t_41); if (unlikely(!__pyx_t_40)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_40);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_42(__pyx_t_41), 3) < 0) __PYX_ERR(0, 2788, __pyx_L1_error)
        __pyx_t_42 = NULL;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        goto __pyx_L7_unpacking_done;
        __pyx_L6_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_42 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 2788, __pyx_L1_error)
        __pyx_L7_unpacking_done:;
      }
      __pyx_t_43 = __pyx_PyFloat_AsDouble(__pyx_t_38); if (unlikely((__pyx_t_43 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
      __pyx_t_44 = __pyx_PyFloat_AsDouble(__pyx_t_39); if (unlikely((__pyx_t_44 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
      __pyx_t_45 = __pyx_PyFloat_AsDouble(__pyx_t_40); if (unlikely((__pyx_t_45 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2788, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_46 = 0;
      __pyx_t_47 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_46 < 0) {
        __pyx_t_46 += __pyx_pybuffernd_PMin.diminfo[0].shape;
        if (unlikely(__pyx_t_46 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_PMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_47 >= (size_t)__pyx_pybuffernd_PMin.diminfo[1].shape)) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2788, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_PMin.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_PMin.diminfo[1].strides) = __pyx_t_43;
      __pyx_t_48 = 1;
      __pyx_t_49 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_48 < 0) {
        __pyx_t_48 += __pyx_pybuffernd_PMin.diminfo[0].shape;
        if (unlikely(__pyx_t_48 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_PMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_49 >= (size_t)__pyx_pybuffernd_PMin.diminfo[1].shape)) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2788, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_PMin.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_PMin.diminfo[1].strides) = __pyx_t_44;
      __pyx_t_50 = 2;
      __pyx_t_51 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_50 < 0) {
        __pyx_t_50 += __pyx_pybuffernd_PMin.diminfo[0].shape;
        if (unlikely(__pyx_t_50 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_PMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_51 >= (size_t)__pyx_pybuffernd_PMin.diminfo[1].shape)) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2788, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_PMin.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_PMin.diminfo[1].strides) = __pyx_t_45;

      /* "tofu/geom/_GG03.pyx":2789
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out             # <<<<<<<<<<<<<<
 *     else:
 *         for ii in range(0,nL):
 */
      __pyx_t_52 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_52 >= (size_t)__pyx_pybuffernd_kPMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2789, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kPMin.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_kPMin.diminfo[0].strides) = __pyx_t_32;
      __pyx_t_53 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_53 >= (size_t)__pyx_pybuffernd_RMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2789, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_RMin.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_RMin.diminfo[0].strides) = __pyx_t_33;
      __pyx_t_54 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_54 >= (size_t)__pyx_pybuffernd_Theta.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2789, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_Theta.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_Theta.diminfo[0].strides) = __pyx_t_34;
      __pyx_t_55 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_55 >= (size_t)__pyx_pybuffernd_p.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2789, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_p.diminfo[0].strides) = __pyx_t_35;
      __pyx_t_56 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_56 >= (size_t)__pyx_pybuffernd_ImpTheta.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2789, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ImpTheta.diminfo[0].strides) = __pyx_t_36;
      __pyx_t_57 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_57 >= (size_t)__pyx_pybuffernd_phi.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2789, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_phi.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_phi.diminfo[0].strides) = __pyx_t_37;
    }

    /* "tofu/geom/_GG03.pyx":2784
 *     cdef cnp.ndarray[double,ndim=1] Theta=np.empty((nL,)), p=np.empty((nL,))
 *     cdef cnp.ndarray[double,ndim=1] ImpTheta=np.empty((nL,)), phi=np.empty((nL,))
 *     if VType.lower()=='tor':             # <<<<<<<<<<<<<<
 *         for ii in range(0,nL):
 *             out = LOS_sino_Tor(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 */
    goto __pyx_L3;
  }

  /* "tofu/geom/_GG03.pyx":2791
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out
 *     else:
 *         for ii in range(0,nL):             # <<<<<<<<<<<<<<
 *             out = LOS_sino_Lin(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 */
  /*else*/ {
    __pyx_t_11 = __pyx_v_nL;
    for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
      __pyx_v_ii = __pyx_t_12;

      /* "tofu/geom/_GG03.pyx":2792
 *     else:
 *         for ii in range(0,nL):
 *             out = LOS_sino_Lin(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],             # <<<<<<<<<<<<<<
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 */
      __pyx_t_58 = 0;
      __pyx_t_59 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_58 < 0) {
        __pyx_t_58 += __pyx_v_D.shape[0];
        if (unlikely(__pyx_t_58 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_58 >= __pyx_v_D.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_59 >= (size_t)__pyx_v_D.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2792, __pyx_L1_error)
      }
      __pyx_t_60 = 1;
      __pyx_t_61 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_60 < 0) {
        __pyx_t_60 += __pyx_v_D.shape[0];
        if (unlikely(__pyx_t_60 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_60 >= __pyx_v_D.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_61 >= (size_t)__pyx_v_D.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2792, __pyx_L1_error)
      }
      __pyx_t_62 = 2;
      __pyx_t_63 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_62 < 0) {
        __pyx_t_62 += __pyx_v_D.shape[0];
        if (unlikely(__pyx_t_62 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_62 >= __pyx_v_D.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_63 >= (size_t)__pyx_v_D.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2792, __pyx_L1_error)
      }
      __pyx_t_64 = 0;
      __pyx_t_65 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_64 < 0) {
        __pyx_t_64 += __pyx_v_u.shape[0];
        if (unlikely(__pyx_t_64 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_64 >= __pyx_v_u.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_65 >= (size_t)__pyx_v_u.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2792, __pyx_L1_error)
      }
      __pyx_t_66 = 1;
      __pyx_t_67 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_66 < 0) {
        __pyx_t_66 += __pyx_v_u.shape[0];
        if (unlikely(__pyx_t_66 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_66 >= __pyx_v_u.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_67 >= (size_t)__pyx_v_u.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2792, __pyx_L1_error)
      }
      __pyx_t_68 = 2;
      __pyx_t_69 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_68 < 0) {
        __pyx_t_68 += __pyx_v_u.shape[0];
        if (unlikely(__pyx_t_68 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_68 >= __pyx_v_u.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_69 >= (size_t)__pyx_v_u.shape[1])) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2792, __pyx_L1_error)
      }

      /* "tofu/geom/_GG03.pyx":2793
 *         for ii in range(0,nL):
 *             out = LOS_sino_Lin(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])             # <<<<<<<<<<<<<<
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out
 */
      __pyx_t_70 = 0;
      __pyx_t_15 = -1;
      if (__pyx_t_70 < 0) {
        __pyx_t_70 += __pyx_v_RZ.shape[0];
        if (unlikely(__pyx_t_70 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_70 >= __pyx_v_RZ.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2793, __pyx_L1_error)
      }
      __pyx_t_71 = 1;
      __pyx_t_15 = -1;
      if (__pyx_t_71 < 0) {
        __pyx_t_71 += __pyx_v_RZ.shape[0];
        if (unlikely(__pyx_t_71 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_71 >= __pyx_v_RZ.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2793, __pyx_L1_error)
      }
      __pyx_t_72 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_72 >= (size_t)__pyx_v_kOut.shape[0])) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2793, __pyx_L1_error)
      }

      /* "tofu/geom/_GG03.pyx":2792
 *     else:
 *         for ii in range(0,nL):
 *             out = LOS_sino_Lin(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],             # <<<<<<<<<<<<<<
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 */
      __pyx_t_73.__pyx_n = 2;
      __pyx_t_73.Mode = __pyx_v_Mode;
      __pyx_t_73.kOut = (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_kOut.data) + __pyx_t_72)) )));
      __pyx_t_31 = __pyx_f_4tofu_4geom_5_GG03_LOS_sino_Lin((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_58 * __pyx_v_D.strides[0]) )) + __pyx_t_59)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_60 * __pyx_v_D.strides[0]) )) + __pyx_t_61)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_D.data + __pyx_t_62 * __pyx_v_D.strides[0]) )) + __pyx_t_63)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_64 * __pyx_v_u.strides[0]) )) + __pyx_t_65)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_66 * __pyx_v_u.strides[0]) )) + __pyx_t_67)) ))), (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_u.data + __pyx_t_68 * __pyx_v_u.strides[0]) )) + __pyx_t_69)) ))), (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_RZ.data) + __pyx_t_70)) ))), (*((double *) ( /* dim=0 */ ((char *) (((double *) __pyx_v_RZ.data) + __pyx_t_71)) ))), &__pyx_t_73); if (unlikely(!__pyx_t_31)) __PYX_ERR(0, 2792, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_31);
      if (!(likely(PyTuple_CheckExact(__pyx_t_31))||((__pyx_t_31) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_31)->tp_name), 0))) __PYX_ERR(0, 2792, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_out, ((PyObject*)__pyx_t_31));
      __pyx_t_31 = 0;

      /* "tofu/geom/_GG03.pyx":2795
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out             # <<<<<<<<<<<<<<
 *     return PMin, kPMin, RMin, Theta, p, ImpTheta, phi
 */
      if (likely(__pyx_v_out != Py_None)) {
        PyObject* sequence = __pyx_v_out;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 7)) {
          if (size > 7) __Pyx_RaiseTooManyValuesError(7);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2794, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_31 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_30 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 5); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 6); 
        __Pyx_INCREF(__pyx_t_31);
        __Pyx_INCREF(__pyx_t_30);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[7] = {&__pyx_t_31,&__pyx_t_30,&__pyx_t_2,&__pyx_t_4,&__pyx_t_5,&__pyx_t_3,&__pyx_t_1};
          for (i=0; i < 7; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 2794, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 2794, __pyx_L1_error)
      }

      /* "tofu/geom/_GG03.pyx":2794
 *             out = LOS_sino_Lin(D[0,ii],D[1,ii],D[2,ii],u[0,ii],u[1,ii],u[2,ii],
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),             # <<<<<<<<<<<<<<
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out
 *     return PMin, kPMin, RMin, Theta, p, ImpTheta, phi
 */
      __pyx_t_37 = __pyx_PyFloat_AsDouble(__pyx_t_30); if (unlikely((__pyx_t_37 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0;
      __pyx_t_36 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_36 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_35 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_35 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_34 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_34 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_33 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_33 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_31))) || (PyList_CheckExact(__pyx_t_31))) {
        PyObject* sequence = __pyx_t_31;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 2794, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_40 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_39 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_38 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_40 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_39 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_38 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_40);
        __Pyx_INCREF(__pyx_t_39);
        __Pyx_INCREF(__pyx_t_38);
        #else
        __pyx_t_40 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_40)) __PYX_ERR(0, 2794, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_40);
        __pyx_t_39 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_39)) __PYX_ERR(0, 2794, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_39);
        __pyx_t_38 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_38)) __PYX_ERR(0, 2794, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_38);
        #endif
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_41 = PyObject_GetIter(__pyx_t_31); if (unlikely(!__pyx_t_41)) __PYX_ERR(0, 2794, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_41);
        __Pyx_DECREF(__pyx_t_31); __pyx_t_31 = 0;
        __pyx_t_42 = Py_TYPE(__pyx_t_41)->tp_iternext;
        index = 0; __pyx_t_40 = __pyx_t_42(__pyx_t_41); if (unlikely(!__pyx_t_40)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_40);
        index = 1; __pyx_t_39 = __pyx_t_42(__pyx_t_41); if (unlikely(!__pyx_t_39)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_39);
        index = 2; __pyx_t_38 = __pyx_t_42(__pyx_t_41); if (unlikely(!__pyx_t_38)) goto __pyx_L10_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_38);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_42(__pyx_t_41), 3) < 0) __PYX_ERR(0, 2794, __pyx_L1_error)
        __pyx_t_42 = NULL;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        goto __pyx_L11_unpacking_done;
        __pyx_L10_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0;
        __pyx_t_42 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 2794, __pyx_L1_error)
        __pyx_L11_unpacking_done:;
      }
      __pyx_t_45 = __pyx_PyFloat_AsDouble(__pyx_t_40); if (unlikely((__pyx_t_45 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_40); __pyx_t_40 = 0;
      __pyx_t_44 = __pyx_PyFloat_AsDouble(__pyx_t_39); if (unlikely((__pyx_t_44 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_39); __pyx_t_39 = 0;
      __pyx_t_43 = __pyx_PyFloat_AsDouble(__pyx_t_38); if (unlikely((__pyx_t_43 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2794, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0;
      __pyx_t_74 = 0;
      __pyx_t_75 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_74 < 0) {
        __pyx_t_74 += __pyx_pybuffernd_PMin.diminfo[0].shape;
        if (unlikely(__pyx_t_74 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_74 >= __pyx_pybuffernd_PMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_75 >= (size_t)__pyx_pybuffernd_PMin.diminfo[1].shape)) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2794, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_PMin.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_PMin.diminfo[1].strides) = __pyx_t_45;
      __pyx_t_76 = 1;
      __pyx_t_77 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_76 < 0) {
        __pyx_t_76 += __pyx_pybuffernd_PMin.diminfo[0].shape;
        if (unlikely(__pyx_t_76 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_76 >= __pyx_pybuffernd_PMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_77 >= (size_t)__pyx_pybuffernd_PMin.diminfo[1].shape)) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2794, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_PMin.diminfo[0].strides, __pyx_t_77, __pyx_pybuffernd_PMin.diminfo[1].strides) = __pyx_t_44;
      __pyx_t_78 = 2;
      __pyx_t_79 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (__pyx_t_78 < 0) {
        __pyx_t_78 += __pyx_pybuffernd_PMin.diminfo[0].shape;
        if (unlikely(__pyx_t_78 < 0)) __pyx_t_15 = 0;
      } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_PMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_79 >= (size_t)__pyx_pybuffernd_PMin.diminfo[1].shape)) __pyx_t_15 = 1;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2794, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided2d(double *, __pyx_pybuffernd_PMin.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_PMin.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_PMin.diminfo[1].strides) = __pyx_t_43;

      /* "tofu/geom/_GG03.pyx":2795
 *                                RZ[0],RZ[1], Mode=Mode, kOut=kOut[ii])
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out             # <<<<<<<<<<<<<<
 *     return PMin, kPMin, RMin, Theta, p, ImpTheta, phi
 */
      __pyx_t_80 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_80 >= (size_t)__pyx_pybuffernd_kPMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2795, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_kPMin.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_kPMin.diminfo[0].strides) = __pyx_t_37;
      __pyx_t_81 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_81 >= (size_t)__pyx_pybuffernd_RMin.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2795, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_RMin.rcbuffer->pybuffer.buf, __pyx_t_81, __pyx_pybuffernd_RMin.diminfo[0].strides) = __pyx_t_36;
      __pyx_t_82 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_82 >= (size_t)__pyx_pybuffernd_Theta.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2795, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_Theta.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_Theta.diminfo[0].strides) = __pyx_t_35;
      __pyx_t_83 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_83 >= (size_t)__pyx_pybuffernd_p.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2795, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_p.rcbuffer->pybuffer.buf, __pyx_t_83, __pyx_pybuffernd_p.diminfo[0].strides) = __pyx_t_34;
      __pyx_t_84 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_84 >= (size_t)__pyx_pybuffernd_ImpTheta.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2795, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_ImpTheta.diminfo[0].strides) = __pyx_t_33;
      __pyx_t_85 = __pyx_v_ii;
      __pyx_t_15 = -1;
      if (unlikely(__pyx_t_85 >= (size_t)__pyx_pybuffernd_phi.diminfo[0].shape)) __pyx_t_15 = 0;
      if (unlikely(__pyx_t_15 != -1)) {
        __Pyx_RaiseBufferIndexError(__pyx_t_15);
        __PYX_ERR(0, 2795, __pyx_L1_error)
      }
      *__Pyx_BufPtrStrided1d(double *, __pyx_pybuffernd_phi.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_phi.diminfo[0].strides) = __pyx_t_32;
    }
  }
  __pyx_L3:;

  /* "tofu/geom/_GG03.pyx":2796
 *             ((PMin[0,ii],PMin[1,ii],PMin[2,ii]),
 *              kPMin[ii], RMin[ii], Theta[ii], p[ii], ImpTheta[ii], phi[ii]) = out
 *     return PMin, kPMin, RMin, Theta, p, ImpTheta, phi             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_PMin));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_PMin));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_PMin));
  __Pyx_INCREF(((PyObject *)__pyx_v_kPMin));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_kPMin));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_kPMin));
  __Pyx_INCREF(((PyObject *)__pyx_v_RMin));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_RMin));
  PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_RMin));
  __Pyx_INCREF(((PyObject *)__pyx_v_Theta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_Theta));
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_v_Theta));
  __Pyx_INCREF(((PyObject *)__pyx_v_p));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_p));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_p));
  __Pyx_INCREF(((PyObject *)__pyx_v_ImpTheta));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_ImpTheta));
  PyTuple_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_v_ImpTheta));
  __Pyx_INCREF(((PyObject *)__pyx_v_phi));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_phi));
  PyTuple_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_v_phi));
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "tofu/geom/_GG03.pyx":2777
 * 
 * 
 * def LOS_sino(double[:,::1] D, double[:,::1] u, double[::1] RZ, double[::1] kOut, str Mode='LOS', str VType='Tor'):             # <<<<<<<<<<<<<<
 *     cdef unsigned int nL = D.shape[1], ii
 *     cdef tuple out
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_30);
  __Pyx_XDECREF(__pyx_t_31);
  __Pyx_XDECREF(__pyx_t_38);
  __Pyx_XDECREF(__pyx_t_39);
  __Pyx_XDECREF(__pyx_t_40);
  __Pyx_XDECREF(__pyx_t_41);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PMin.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_RMin.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Theta.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kPMin.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_phi.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("tofu.geom._GG03.LOS_sino", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_ImpTheta.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_PMin.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_RMin.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_Theta.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_kPMin.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_p.rcbuffer->pybuffer);
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_phi.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF(__pyx_v_out);
  __Pyx_XDECREF((PyObject *)__pyx_v_PMin);
  __Pyx_XDECREF((PyObject *)__pyx_v_kPMin);
  __Pyx_XDECREF((PyObject *)__pyx_v_RMin);
  __Pyx_XDECREF((PyObject *)__pyx_v_Theta);
  __Pyx_XDECREF((PyObject *)__pyx_v_p);
  __Pyx_XDECREF((PyObject *)__pyx_v_ImpTheta);
  __Pyx_XDECREF((PyObject *)__pyx_v_phi);
  __PYX_XDEC_MEMVIEW(&__pyx_v_D, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_u, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_RZ, 1);
  __PYX_XDEC_MEMVIEW(&__pyx_v_kOut, 1);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":214
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_v_copy_shape;
  int __pyx_v_i;
  int __pyx_v_ndim;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  int __pyx_v_t;
  char *__pyx_v_f;
  PyArray_Descr *__pyx_v_descr = 0;
  int __pyx_v_offset;
  int __pyx_v_hasfields;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  char *__pyx_t_7;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":220
 *             # of flags
 * 
 *             if info == NULL: return             # <<<<<<<<<<<<<<
 * 
 *             cdef int copy_shape, i, ndim
 */
  __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
  if (__pyx_t_1) {
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":223
 * 
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 */
  __pyx_v_endian_detector = 1;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":224
 *             cdef int copy_shape, i, ndim
 *             cdef int endian_detector = 1
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 * 
 *             ndim = PyArray_NDIM(self)
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":226
 *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 * 
 *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":228
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":229
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 copy_shape = 1             # <<<<<<<<<<<<<<
 *             else:
 *                 copy_shape = 0
 */
    __pyx_v_copy_shape = 1;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":228
 *             ndim = PyArray_NDIM(self)
 * 
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 copy_shape = 1
 *             else:
 */
    goto __pyx_L4;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":231
 *                 copy_shape = 1
 *             else:
 *                 copy_shape = 0             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 */
  /*else*/ {
    __pyx_v_copy_shape = 0;
  }
  __pyx_L4:;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":233
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":234
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":233
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":235
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__277, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 235, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 235, __pyx_L1_error)

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":233
 *                 copy_shape = 0
 * 
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":237
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L9_bool_binop_done;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":238
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 */
  __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L9_bool_binop_done:;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":237
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":239
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__278, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 239, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(1, 239, __pyx_L1_error)

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":237
 *                 raise ValueError(u"ndarray is not C contiguous")
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":241
 *                 raise ValueError(u"ndarray is not Fortran contiguous")
 * 
 *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
 *             info.ndim = ndim
 *             if copy_shape:
 */
  __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":242
 * 
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim             # <<<<<<<<<<<<<<
 *             if copy_shape:
 *                 # Allocate new buffer for strides and shape info.
 */
  __pyx_v_info->ndim = __pyx_v_ndim;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":243
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
  __pyx_t_1 = (__pyx_v_copy_shape != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":246
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)             # <<<<<<<<<<<<<<
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 */
    __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":247
 *                 # This is allocated as one block, strides first.
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 */
    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":248
 *                 info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):             # <<<<<<<<<<<<<<
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 */
    __pyx_t_4 = __pyx_v_ndim;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":249
 *                 info.shape = info.strides + ndim
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 */
      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":250
 *                 for i in range(ndim):
 *                     info.strides[i] = PyArray_STRIDES(self)[i]
 *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 */
      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":243
 *             info.buf = PyArray_DATA(self)
 *             info.ndim = ndim
 *             if copy_shape:             # <<<<<<<<<<<<<<
 *                 # Allocate new buffer for strides and shape info.
 *                 # This is allocated as one block, strides first.
 */
    goto __pyx_L11;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":252
 *                     info.shape[i] = PyArray_DIMS(self)[i]
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 */
  /*else*/ {
    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":253
 *             else:
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 */
    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  }
  __pyx_L11:;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":254
 *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 */
  __pyx_v_info->suboffsets = NULL;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":255
 *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
 *             info.readonly = not PyArray_ISWRITEABLE(self)
 * 
 */
  __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":256
 *             info.suboffsets = NULL
 *             info.itemsize = PyArray_ITEMSIZE(self)
 *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
 * 
 *             cdef int t
 */
  __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":259
 * 
 *             cdef int t
 *             cdef char* f = NULL             # <<<<<<<<<<<<<<
 *             cdef dtype descr = self.descr
 *             cdef int offset
 */
  __pyx_v_f = NULL;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":260
 *             cdef int t
 *             cdef char* f = NULL
 *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
 *             cdef int offset
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":263
 *             cdef int offset
 * 
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields and not copy_shape:
 */
  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
  __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L15_bool_binop_done;
  }
  __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L15_bool_binop_done:;
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":267
 *             if not hasfields and not copy_shape:
 *                 # do not call releasebuffer
 *                 info.obj = None             # <<<<<<<<<<<<<<
 *             else:
 *                 # need to call releasebuffer
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = Py_None;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265
 *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
 * 
 *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
 *                 # do not call releasebuffer
 *                 info.obj = None
 */
    goto __pyx_L14;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270
 *             else:
 *                 # need to call releasebuffer
 *                 info.obj = self             # <<<<<<<<<<<<<<
 * 
 *             if not hasfields:
 */
  /*else*/ {
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj);
    __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  }
  __pyx_L14:;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":273
 * 
 *             if not hasfields:
 *                 t = descr.type_num             # <<<<<<<<<<<<<<
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 */
    __pyx_t_4 = __pyx_v_descr->type_num;
    __pyx_v_t = __pyx_t_4;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
    if (!__pyx_t_2) {
      goto __pyx_L20_next_or;
    } else {
    }
    __pyx_t_2 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_L20_next_or:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 */
    __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L19_bool_binop_done;
    }
    __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L19_bool_binop_done:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    if (__pyx_t_1) {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__279, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 276, __pyx_L1_error)

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274
 *             if not hasfields:
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":277
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 */
    switch (__pyx_v_t) {
      case NPY_BYTE:
      __pyx_v_f = ((char *)"b");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278
 *                     raise ValueError(u"Non-native byte order not supported")
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 */
      case NPY_UBYTE:
      __pyx_v_f = ((char *)"B");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 */
      case NPY_SHORT:
      __pyx_v_f = ((char *)"h");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280
 *                 elif t == NPY_UBYTE:       f = "B"
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 */
      case NPY_USHORT:
      __pyx_v_f = ((char *)"H");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":281
 *                 elif t == NPY_SHORT:       f = "h"
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 */
      case NPY_INT:
      __pyx_v_f = ((char *)"i");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":282
 *                 elif t == NPY_USHORT:      f = "H"
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 */
      case NPY_UINT:
      __pyx_v_f = ((char *)"I");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283
 *                 elif t == NPY_INT:         f = "i"
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 */
      case NPY_LONG:
      __pyx_v_f = ((char *)"l");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284
 *                 elif t == NPY_UINT:        f = "I"
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 */
      case NPY_ULONG:
      __pyx_v_f = ((char *)"L");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285
 *                 elif t == NPY_LONG:        f = "l"
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 */
      case NPY_LONGLONG:
      __pyx_v_f = ((char *)"q");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286
 *                 elif t == NPY_ULONG:       f = "L"
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 */
      case NPY_ULONGLONG:
      __pyx_v_f = ((char *)"Q");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287
 *                 elif t == NPY_LONGLONG:    f = "q"
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 */
      case NPY_FLOAT:
      __pyx_v_f = ((char *)"f");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":288
 *                 elif t == NPY_ULONGLONG:   f = "Q"
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 */
      case NPY_DOUBLE:
      __pyx_v_f = ((char *)"d");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289
 *                 elif t == NPY_FLOAT:       f = "f"
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 */
      case NPY_LONGDOUBLE:
      __pyx_v_f = ((char *)"g");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290
 *                 elif t == NPY_DOUBLE:      f = "d"
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 */
      case NPY_CFLOAT:
      __pyx_v_f = ((char *)"Zf");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291
 *                 elif t == NPY_LONGDOUBLE:  f = "g"
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"
 */
      case NPY_CDOUBLE:
      __pyx_v_f = ((char *)"Zd");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292
 *                 elif t == NPY_CFLOAT:      f = "Zf"
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 */
      case NPY_CLONGDOUBLE:
      __pyx_v_f = ((char *)"Zg");
      break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293
 *                 elif t == NPY_CDOUBLE:     f = "Zd"
 *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
 *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      case NPY_OBJECT:
      __pyx_v_f = ((char *)"O");
      break;
      default:

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":295
 *                 elif t == NPY_OBJECT:      f = "O"
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *                 info.format = f
 *                 return
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 295, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(1, 295, __pyx_L1_error)
      break;
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296
 *                 else:
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f             # <<<<<<<<<<<<<<
 *                 return
 *             else:
 */
    __pyx_v_info->format = __pyx_v_f;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297
 *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *                 info.format = f
 *                 return             # <<<<<<<<<<<<<<
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 */
    __pyx_r = 0;
    goto __pyx_L0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272
 *                 info.obj = self
 * 
 *             if not hasfields:             # <<<<<<<<<<<<<<
 *                 t = descr.type_num
 *                 if ((descr.byteorder == c'>' and little_endian) or
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":299
 *                 return
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 */
  /*else*/ {
    __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300
 *             else:
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,
 */
    (__pyx_v_info->format[0]) = '^';

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":301
 *                 info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0             # <<<<<<<<<<<<<<
 *                 f = _util_dtypestring(descr, info.format + 1,
 *                                       info.format + _buffer_format_string_len,
 */
    __pyx_v_offset = 0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302
 *                 info.format[0] = c'^' # Native data types, manual alignment
 *                 offset = 0
 *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 */
    __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 302, __pyx_L1_error)
    __pyx_v_f = __pyx_t_7;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305
 *                                       info.format + _buffer_format_string_len,
 *                                       &offset)
 *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 */
    (__pyx_v_f[0]) = '\x00';
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":214
 *         # experimental exception made for __getbuffer__ and __releasebuffer__
 *         # -- the details of this may change.
 *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fullfill the PEP.
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

/* Python wrapper */
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__releasebuffer__", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)             # <<<<<<<<<<<<<<
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)
 */
    PyObject_Free(__pyx_v_info->format);

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):
 *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
 *                 PyObject_Free(info.strides)             # <<<<<<<<<<<<<<
 *                 # info.shape was stored after info.strides in the same block
 * 
 */
    PyObject_Free(__pyx_v_info->strides);

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
 *                 PyObject_Free(info.strides)
 *                 # info.shape was stored after info.strides in the same block
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307
 *                 f[0] = c'\0' # Terminate format string
 * 
 *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             if PyArray_HASFIELDS(self):
 *                 PyObject_Free(info.format)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":788
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":789
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":788
 * ctypedef npy_cdouble     complex_t
 * 
 * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":792
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
 *     return PyArray_MultiIterNew(1, <void*>a)
 * 
 * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":794
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":795
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 */
  __Pyx_XDECREF(__pyx_r);
  __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, 795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":794
 *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
 * 
 * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":797
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":798
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 */
  __Pyx_XDECREF(__pyx_r);
  __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, 798, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":797
 *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
 * 
 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 */
  __Pyx_XDECREF(__pyx_r);
  __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, 801, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
 *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
 * 
 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":803
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape             # <<<<<<<<<<<<<<
 *     else:
 *         return ()
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
    __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
    goto __pyx_L0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):
 *     if PyDataType_HASSUBARRAY(d):             # <<<<<<<<<<<<<<
 *         return <tuple>d.subarray.shape
 *     else:
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":807
 *         return <tuple>d.subarray.shape
 *     else:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_empty_tuple);
    __pyx_r = __pyx_empty_tuple;
    goto __pyx_L0;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":803
 *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
 * 
 * cdef inline tuple PyDataType_SHAPE(dtype d):             # <<<<<<<<<<<<<<
 *     if PyDataType_HASSUBARRAY(d):
 *         return <tuple>d.subarray.shape
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  PyArray_Descr *__pyx_v_child = 0;
  int __pyx_v_endian_detector;
  int __pyx_v_little_endian;
  PyObject *__pyx_v_fields = 0;
  PyObject *__pyx_v_childname = NULL;
  PyObject *__pyx_v_new_offset = NULL;
  PyObject *__pyx_v_t = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  long __pyx_t_8;
  char *__pyx_t_9;
  __Pyx_RefNannySetupContext("_util_dtypestring", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":814
 * 
 *     cdef dtype child
 *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
 *     cdef tuple fields
 */
  __pyx_v_endian_detector = 1;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
 *     cdef dtype child
 *     cdef int endian_detector = 1
 *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
 *     cdef tuple fields
 * 
 */
  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":818
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  if (unlikely(__pyx_v_descr->names == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(1, 818, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  for (;;) {
    if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 818, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
 * 
 *     for childname in descr.names:
 *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
 *         child, new_offset = fields
 * 
 */
    if (unlikely(__pyx_v_descr->fields == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(1, 819, __pyx_L1_error)
    }
    __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 819, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 819, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":820
 *     for childname in descr.names:
 *         fields = descr.fields[childname]
 *         child, new_offset = fields             # <<<<<<<<<<<<<<
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 */
    if (likely(__pyx_v_fields != Py_None)) {
      PyObject* sequence = __pyx_v_fields;
      #if !CYTHON_COMPILING_IN_PYPY
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(1, 820, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 820, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
    } else {
      __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 820, __pyx_L1_error)
    }
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 820, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 822, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
    if (__pyx_t_6) {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":823
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__280, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 823, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 823, __pyx_L1_error)

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822
 *         child, new_offset = fields
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 */
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
    if (!__pyx_t_7) {
      goto __pyx_L8_next_or;
    } else {
    }
    __pyx_t_7 = (__pyx_v_little_endian != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_L8_next_or:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":826
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):             # <<<<<<<<<<<<<<
 *             raise ValueError(u"Non-native byte order not supported")
 *             # One could encode it in the format string and have Cython
 */
    __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
    if (__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    if (__pyx_t_6) {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__281, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __PYX_ERR(1, 827, __pyx_L1_error)

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
 * 
 *         if ((child.byteorder == c'>' and little_endian) or             # <<<<<<<<<<<<<<
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")
 */
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837
 * 
 *         # Output padding bytes
 *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 */
    while (1) {
      __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_6) break;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838
 *         # Output padding bytes
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
 *             f += 1
 *             offset[0] += 1
 */
      (__pyx_v_f[0]) = 0x78;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":839
 *         while offset[0] < new_offset:
 *             f[0] = 120 # "x"; pad byte
 *             f += 1             # <<<<<<<<<<<<<<
 *             offset[0] += 1
 * 
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840
 *             f[0] = 120 # "x"; pad byte
 *             f += 1
 *             offset[0] += 1             # <<<<<<<<<<<<<<
 * 
 *         offset[0] += child.itemsize
 */
      __pyx_t_8 = 0;
      (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842
 *             offset[0] += 1
 * 
 *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not PyDataType_HASFIELDS(child):
 */
    __pyx_t_8 = 0;
    (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":844
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
    __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
    if (__pyx_t_6) {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":845
 * 
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num             # <<<<<<<<<<<<<<
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")
 */
      __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":846
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
      if (__pyx_t_6) {

        /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__282, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_Raise(__pyx_t_4, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __PYX_ERR(1, 847, __pyx_L1_error)

        /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":846
 *         if not PyDataType_HASFIELDS(child):
 *             t = child.type_num
 *             if end - f < 5:             # <<<<<<<<<<<<<<
 *                 raise RuntimeError(u"Format string allocated too short.")
 * 
 */
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":850
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 98;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 66;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852
 *             if   t == NPY_BYTE:        f[0] =  98 #"b"
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x68;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853
 *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 72;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":854
 *             elif t == NPY_SHORT:       f[0] = 104 #"h"
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 854, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 854, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 854, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x69;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855
 *             elif t == NPY_USHORT:      f[0] =  72 #"H"
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 855, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 73;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856
 *             elif t == NPY_INT:         f[0] = 105 #"i"
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 856, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 856, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x6C;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":857
 *             elif t == NPY_UINT:        f[0] =  73 #"I"
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 857, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 857, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 857, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 76;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858
 *             elif t == NPY_LONG:        f[0] = 108 #"l"
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 858, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 858, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 858, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x71;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859
 *             elif t == NPY_ULONG:       f[0] = 76  #"L"
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 859, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 859, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 859, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 81;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860
 *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 860, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 860, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x66;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":861
 *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 861, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 861, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 861, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x64;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":862
 *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 862, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 862, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 862, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 0x67;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":863
 *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 863, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 863, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x66;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":864
 *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 864, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 864, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 864, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x64;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":865
 *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 */
      __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 865, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 865, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 90;
        (__pyx_v_f[1]) = 0x67;
        __pyx_v_f = (__pyx_v_f + 1);
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":866
 *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
 *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 */
      __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 866, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 866, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 866, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_6) {
        (__pyx_v_f[0]) = 79;
        goto __pyx_L15;
      }

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":868
 *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
 *             f += 1
 *         else:
 */
      /*else*/ {
        __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 868, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 868, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 868, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_Raise(__pyx_t_3, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __PYX_ERR(1, 868, __pyx_L1_error)
      }
      __pyx_L15:;

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":869
 *             else:
 *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
 *             f += 1             # <<<<<<<<<<<<<<
 *         else:
 *             # Cython ignores struct boundary information ("T{...}"),
 */
      __pyx_v_f = (__pyx_v_f + 1);

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":844
 *         offset[0] += child.itemsize
 * 
 *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
 *             t = child.type_num
 *             if end - f < 5:
 */
      goto __pyx_L13;
    }

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873
 *             # Cython ignores struct boundary information ("T{...}"),
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
 *     return f
 * 
 */
    /*else*/ {
      __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 873, __pyx_L1_error)
      __pyx_v_f = __pyx_t_9;
    }
    __pyx_L13:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":818
 *     cdef tuple fields
 * 
 *     for childname in descr.names:             # <<<<<<<<<<<<<<
 *         fields = descr.fields[childname]
 *         child, new_offset = fields
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":874
 *             # so don't output it
 *             f = _util_dtypestring(child, f, end, offset)
 *     return f             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_f;
  goto __pyx_L0;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
 *         return ()
 * 
 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
 *     # Recursive utility function used in __getbuffer__ to get format
 *     # string. The new location in the format string is returned.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_fields);
  __Pyx_XDECREF(__pyx_v_childname);
  __Pyx_XDECREF(__pyx_v_new_offset);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":990
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  PyObject *__pyx_v_baseptr;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("set_array_base", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":992
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
  __pyx_t_1 = (__pyx_v_base == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":993
 *      cdef PyObject* baseptr
 *      if base is None:
 *          baseptr = NULL             # <<<<<<<<<<<<<<
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 */
    __pyx_v_baseptr = NULL;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":992
 * cdef inline void set_array_base(ndarray arr, object base):
 *      cdef PyObject* baseptr
 *      if base is None:             # <<<<<<<<<<<<<<
 *          baseptr = NULL
 *      else:
 */
    goto __pyx_L3;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":995
 *          baseptr = NULL
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 */
  /*else*/ {
    Py_INCREF(__pyx_v_base);

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":996
 *      else:
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr
 */
    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
  }
  __pyx_L3:;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":997
 *          Py_INCREF(base) # important to do this before decref below!
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
 *      arr.base = baseptr
 * 
 */
  Py_XDECREF(__pyx_v_arr->base);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":998
 *          baseptr = <PyObject*>base
 *      Py_XDECREF(arr.base)
 *      arr.base = baseptr             # <<<<<<<<<<<<<<
 * 
 * cdef inline object get_array_base(ndarray arr):
 */
  __pyx_v_arr->base = __pyx_v_baseptr;

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":990
 * 
 * 
 * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
 *      cdef PyObject* baseptr
 *      if base is None:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1000
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("get_array_base", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1001
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
  if (__pyx_t_1) {

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1002
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         return <object>arr.base
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1001
 * 
 * cdef inline object get_array_base(ndarray arr):
 *     if arr.base is NULL:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1004
 *         return None
 *     else:
 *         return <object>arr.base             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
    __pyx_r = ((PyObject *)__pyx_v_arr->base);
    goto __pyx_L0;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1000
 *      arr.base = baseptr
 * 
 * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
 *     if arr.base is NULL:
 *         return None
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1009
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_array", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1010
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1011
 * cdef inline int import_array() except -1:
 *     try:
 *         _import_array()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")
 */
      __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1011, __pyx_L3_error)

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1010
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1012
 *     try:
 *         _import_array()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1012, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1013
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__283, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1013, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1013, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1010
 * # Cython code.
 * cdef inline int import_array() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_array()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1009
 * # Versions of the import_* functions which are more suitable for
 * # Cython code.
 * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_array()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1015
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_umath", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1016
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1017
 * cdef inline int import_umath() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1017, __pyx_L3_error)

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1016
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1018
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1018, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1019
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__284, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1019, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1019, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1016
 * 
 * cdef inline int import_umath() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1015
 *         raise ImportError("numpy.core.multiarray failed to import")
 * 
 * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1021
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("import_ufunc", 0);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023
 * cdef inline int import_ufunc() except -1:
 *     try:
 *         _import_umath()             # <<<<<<<<<<<<<<
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")
 */
      __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1023, __pyx_L3_error)

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_try_end;
    __pyx_L3_error:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024
 *     try:
 *         _import_umath()
 *     except Exception:             # <<<<<<<<<<<<<<
 *         raise ImportError("numpy.core.umath failed to import")
 */
    __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
    if (__pyx_t_4) {
      __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1024, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);

      /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1025
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__285, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1025, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_Raise(__pyx_t_8, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __PYX_ERR(1, 1025, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022
 * 
 * cdef inline int import_ufunc() except -1:
 *     try:             # <<<<<<<<<<<<<<
 *         _import_umath()
 *     except Exception:
 */
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L8_try_end:;
  }

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1021
 *         raise ImportError("numpy.core.umath failed to import")
 * 
 * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
 *     try:
 *         _import_umath()
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":120
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_shape = 0;
  Py_ssize_t __pyx_v_itemsize;
  PyObject *__pyx_v_format = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_allocate_buffer;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    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};
    PyObject* values[5] = {0,0,0,0,0};
    values[3] = ((PyObject *)__pyx_n_s_c);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 120, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 120, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mode);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_allocate_buffer);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 120, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_shape = ((PyObject*)values[0]);
    __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 120, __pyx_L3_error)
    __pyx_v_format = values[2];
    __pyx_v_mode = values[3];
    if (values[4]) {
      __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 121, __pyx_L3_error)
    } else {

      /* "View.MemoryView":121
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
 *                   mode="c", bint allocate_buffer=True):             # <<<<<<<<<<<<<<
 * 
 *         cdef int idx
 */
      __pyx_v_allocate_buffer = ((int)1);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 120, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 120, __pyx_L1_error)
  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 120, __pyx_L1_error)
  }
  __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);

  /* "View.MemoryView":120
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_dim;
  PyObject **__pyx_v_p;
  char __pyx_v_order;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__cinit__", 0);
  __Pyx_INCREF(__pyx_v_format);

  /* "View.MemoryView":127
 *         cdef PyObject **p
 * 
 *         self.ndim = <int> len(shape)             # <<<<<<<<<<<<<<
 *         self.itemsize = itemsize
 * 
 */
  if (unlikely(__pyx_v_shape == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 127, __pyx_L1_error)
  }
  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 127, __pyx_L1_error)
  __pyx_v_self->ndim = ((int)__pyx_t_1);

  /* "View.MemoryView":128
 * 
 *         self.ndim = <int> len(shape)
 *         self.itemsize = itemsize             # <<<<<<<<<<<<<<
 * 
 *         if not self.ndim:
 */
  __pyx_v_self->itemsize = __pyx_v_itemsize;

  /* "View.MemoryView":130
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":131
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__286, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 131, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 131, __pyx_L1_error)

    /* "View.MemoryView":130
 *         self.itemsize = itemsize
 * 
 *         if not self.ndim:             # <<<<<<<<<<<<<<
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 */
  }

  /* "View.MemoryView":133
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":134
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__287, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 134, __pyx_L1_error)

    /* "View.MemoryView":133
 *             raise ValueError("Empty shape tuple for cython.array")
 * 
 *         if itemsize <= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 */
  }

  /* "View.MemoryView":136
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  __pyx_t_2 = PyBytes_Check(__pyx_v_format); 
  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":137
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__288, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "View.MemoryView":136
 *             raise ValueError("itemsize <= 0 for cython.array")
 * 
 *         if not isinstance(format, bytes):             # <<<<<<<<<<<<<<
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 */
  }

  /* "View.MemoryView":138
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string             # <<<<<<<<<<<<<<
 *         self.format = self._format
 * 
 */
  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, 138, __pyx_L1_error)
  __pyx_t_5 = __pyx_v_format;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_GOTREF(__pyx_v_self->_format);
  __Pyx_DECREF(__pyx_v_self->_format);
  __pyx_v_self->_format = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "View.MemoryView":139
 *             format = format.encode('ASCII')
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_self->_format == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(2, 139, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 139, __pyx_L1_error)
  __pyx_v_self->format = __pyx_t_6;

  /* "View.MemoryView":142
 * 
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)             # <<<<<<<<<<<<<<
 *         self._strides = self._shape + self.ndim
 * 
 */
  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));

  /* "View.MemoryView":143
 * 
 *         self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
 *         self._strides = self._shape + self.ndim             # <<<<<<<<<<<<<<
 * 
 *         if not self._shape:
 */
  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);

  /* "View.MemoryView":145
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":146
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__289, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 146, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(2, 146, __pyx_L1_error)

    /* "View.MemoryView":145
 *         self._strides = self._shape + self.ndim
 * 
 *         if not self._shape:             # <<<<<<<<<<<<<<
 *             raise MemoryError("unable to allocate shape and strides.")
 * 
 */
  }

  /* "View.MemoryView":149
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  __pyx_t_7 = 0;
  __pyx_t_5 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
  for (;;) {
    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 149, __pyx_L1_error)
    #else
    __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 149, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_dim = __pyx_t_8;
    __pyx_v_idx = __pyx_t_7;
    __pyx_t_7 = (__pyx_t_7 + 1);

    /* "View.MemoryView":150
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":151
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))             # <<<<<<<<<<<<<<
 *             self._shape[idx] = dim
 * 
 */
      __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
      __pyx_t_3 = 0;
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_Raise(__pyx_t_9, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __PYX_ERR(2, 151, __pyx_L1_error)

      /* "View.MemoryView":150
 * 
 *         for idx, dim in enumerate(shape):
 *             if dim <= 0:             # <<<<<<<<<<<<<<
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim
 */
    }

    /* "View.MemoryView":152
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 *             self._shape[idx] = dim             # <<<<<<<<<<<<<<
 * 
 *         cdef char order
 */
    (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;

    /* "View.MemoryView":149
 * 
 * 
 *         for idx, dim in enumerate(shape):             # <<<<<<<<<<<<<<
 *             if dim <= 0:
 *                 raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
 */
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "View.MemoryView":155
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 155, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":156
 *         cdef char order
 *         if mode == 'fortran':
 *             order = b'F'             # <<<<<<<<<<<<<<
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 */
    __pyx_v_order = 'F';

    /* "View.MemoryView":157
 *         if mode == 'fortran':
 *             order = b'F'
 *             self.mode = u'fortran'             # <<<<<<<<<<<<<<
 *         elif mode == 'c':
 *             order = b'C'
 */
    __Pyx_INCREF(__pyx_n_u_fortran);
    __Pyx_GIVEREF(__pyx_n_u_fortran);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_fortran;

    /* "View.MemoryView":155
 * 
 *         cdef char order
 *         if mode == 'fortran':             # <<<<<<<<<<<<<<
 *             order = b'F'
 *             self.mode = u'fortran'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":158
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":159
 *             self.mode = u'fortran'
 *         elif mode == 'c':
 *             order = b'C'             # <<<<<<<<<<<<<<
 *             self.mode = u'c'
 *         else:
 */
    __pyx_v_order = 'C';

    /* "View.MemoryView":160
 *         elif mode == 'c':
 *             order = b'C'
 *             self.mode = u'c'             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 */
    __Pyx_INCREF(__pyx_n_u_c);
    __Pyx_GIVEREF(__pyx_n_u_c);
    __Pyx_GOTREF(__pyx_v_self->mode);
    __Pyx_DECREF(__pyx_v_self->mode);
    __pyx_v_self->mode = __pyx_n_u_c;

    /* "View.MemoryView":158
 *             order = b'F'
 *             self.mode = u'fortran'
 *         elif mode == 'c':             # <<<<<<<<<<<<<<
 *             order = b'C'
 *             self.mode = u'c'
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":162
 *             self.mode = u'c'
 *         else:
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)             # <<<<<<<<<<<<<<
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 162, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(2, 162, __pyx_L1_error)
  }
  __pyx_L10:;

  /* "View.MemoryView":164
 *             raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
 * 
 *         self.len = fill_contig_strides_array(self._shape, self._strides,             # <<<<<<<<<<<<<<
 *                                              itemsize, self.ndim, order)
 * 
 */
  __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);

  /* "View.MemoryView":167
 *                                              itemsize, self.ndim, order)
 * 
 *         self.free_data = allocate_buffer             # <<<<<<<<<<<<<<
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:
 */
  __pyx_v_self->free_data = __pyx_v_allocate_buffer;

  /* "View.MemoryView":168
 * 
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'             # <<<<<<<<<<<<<<
 *         if allocate_buffer:
 * 
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 168, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 168, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_self->dtype_is_object = __pyx_t_4;

  /* "View.MemoryView":169
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  if (__pyx_t_4) {

    /* "View.MemoryView":172
 * 
 * 
 *             self.data = <char *>malloc(self.len)             # <<<<<<<<<<<<<<
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")
 */
    __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));

    /* "View.MemoryView":173
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":174
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__290, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 174, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(2, 174, __pyx_L1_error)

      /* "View.MemoryView":173
 * 
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:             # <<<<<<<<<<<<<<
 *                 raise MemoryError("unable to allocate array data.")
 * 
 */
    }

    /* "View.MemoryView":176
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":177
 * 
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data             # <<<<<<<<<<<<<<
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 */
      __pyx_v_p = ((PyObject **)__pyx_v_self->data);

      /* "View.MemoryView":178
 *             if self.dtype_is_object:
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):             # <<<<<<<<<<<<<<
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)
 */
      if (unlikely(__pyx_v_itemsize == 0)) {
        PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
        __PYX_ERR(2, 178, __pyx_L1_error)
      }
      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))) {
        PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
        __PYX_ERR(2, 178, __pyx_L1_error)
      }
      __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
      for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_1; __pyx_t_8+=1) {
        __pyx_v_i = __pyx_t_8;

        /* "View.MemoryView":179
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None             # <<<<<<<<<<<<<<
 *                     Py_INCREF(Py_None)
 * 
 */
        (__pyx_v_p[__pyx_v_i]) = Py_None;

        /* "View.MemoryView":180
 *                 for i in range(self.len / itemsize):
 *                     p[i] = Py_None
 *                     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
        Py_INCREF(Py_None);
      }

      /* "View.MemoryView":176
 *                 raise MemoryError("unable to allocate array data.")
 * 
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 p = <PyObject **> self.data
 *                 for i in range(self.len / itemsize):
 */
    }

    /* "View.MemoryView":169
 *         self.free_data = allocate_buffer
 *         self.dtype_is_object = format == b'O'
 *         if allocate_buffer:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":120
 *         cdef bint dtype_is_object
 * 
 *     def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,             # <<<<<<<<<<<<<<
 *                   mode="c", bint allocate_buffer=True):
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":183
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_v_bufmode;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "View.MemoryView":184
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1             # <<<<<<<<<<<<<<
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
  __pyx_v_bufmode = -1;

  /* "View.MemoryView":185
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
  __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, 185, __pyx_L1_error)
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":186
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 */
    __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":185
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         cdef int bufmode = -1
 *         if self.mode == u"c":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":187
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  __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, 187, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":188
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS             # <<<<<<<<<<<<<<
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 */
    __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);

    /* "View.MemoryView":187
 *         if self.mode == u"c":
 *             bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         elif self.mode == u"fortran":             # <<<<<<<<<<<<<<
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":189
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":190
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__291, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 190, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 190, __pyx_L1_error)

    /* "View.MemoryView":189
 *         elif self.mode == u"fortran":
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):             # <<<<<<<<<<<<<<
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 */
  }

  /* "View.MemoryView":191
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data             # <<<<<<<<<<<<<<
 *         info.len = self.len
 *         info.ndim = self.ndim
 */
  __pyx_t_4 = __pyx_v_self->data;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":192
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")
 *         info.buf = self.data
 *         info.len = self.len             # <<<<<<<<<<<<<<
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 */
  __pyx_t_5 = __pyx_v_self->len;
  __pyx_v_info->len = __pyx_t_5;

  /* "View.MemoryView":193
 *         info.buf = self.data
 *         info.len = self.len
 *         info.ndim = self.ndim             # <<<<<<<<<<<<<<
 *         info.shape = self._shape
 *         info.strides = self._strides
 */
  __pyx_t_6 = __pyx_v_self->ndim;
  __pyx_v_info->ndim = __pyx_t_6;

  /* "View.MemoryView":194
 *         info.len = self.len
 *         info.ndim = self.ndim
 *         info.shape = self._shape             # <<<<<<<<<<<<<<
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 */
  __pyx_t_7 = __pyx_v_self->_shape;
  __pyx_v_info->shape = __pyx_t_7;

  /* "View.MemoryView":195
 *         info.ndim = self.ndim
 *         info.shape = self._shape
 *         info.strides = self._strides             # <<<<<<<<<<<<<<
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 */
  __pyx_t_7 = __pyx_v_self->_strides;
  __pyx_v_info->strides = __pyx_t_7;

  /* "View.MemoryView":196
 *         info.shape = self._shape
 *         info.strides = self._strides
 *         info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *         info.itemsize = self.itemsize
 *         info.readonly = 0
 */
  __pyx_v_info->suboffsets = NULL;

  /* "View.MemoryView":197
 *         info.strides = self._strides
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 * 
 */
  __pyx_t_5 = __pyx_v_self->itemsize;
  __pyx_v_info->itemsize = __pyx_t_5;

  /* "View.MemoryView":198
 *         info.suboffsets = NULL
 *         info.itemsize = self.itemsize
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":200
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":201
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_4 = __pyx_v_self->format;
    __pyx_v_info->format = __pyx_t_4;

    /* "View.MemoryView":200
 *         info.readonly = 0
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.format
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":203
 *             info.format = self.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.obj = self
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":205
 *             info.format = NULL
 * 
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":183
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         cdef int bufmode = -1
 *         if self.mode == u"c":
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
    __Pyx_GOTREF(__pyx_v_info->obj);
    __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
  }
  goto __pyx_L2;
  __pyx_L0:;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __pyx_L2:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":209
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":210
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":211
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)             # <<<<<<<<<<<<<<
 *         elif self.free_data:
 *             if self.dtype_is_object:
 */
    __pyx_v_self->callback_free_data(__pyx_v_self->data);

    /* "View.MemoryView":210
 * 
 *     def __dealloc__(array self):
 *         if self.callback_free_data != NULL:             # <<<<<<<<<<<<<<
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":212
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  __pyx_t_1 = (__pyx_v_self->free_data != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":213
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":214
 *         elif self.free_data:
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,             # <<<<<<<<<<<<<<
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);

      /* "View.MemoryView":213
 *             self.callback_free_data(self.data)
 *         elif self.free_data:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 */
    }

    /* "View.MemoryView":216
 *                 refcount_objects_in_slice(self.data, self._shape,
 *                                           self._strides, self.ndim, False)
 *             free(self.data)             # <<<<<<<<<<<<<<
 *         PyObject_Free(self._shape)
 * 
 */
    free(__pyx_v_self->data);

    /* "View.MemoryView":212
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 *         elif self.free_data:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 refcount_objects_in_slice(self.data, self._shape,
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":217
 *                                           self._strides, self.ndim, False)
 *             free(self.data)
 *         PyObject_Free(self._shape)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  PyObject_Free(__pyx_v_self->_shape);

  /* "View.MemoryView":209
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
 * 
 *     def __dealloc__(array self):             # <<<<<<<<<<<<<<
 *         if self.callback_free_data != NULL:
 *             self.callback_free_data(self.data)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":220
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":221
 *     @property
 *     def memview(self):
 *         return self.get_memview()             # <<<<<<<<<<<<<<
 * 
 *     @cname('get_memview')
 */
  __Pyx_XDECREF(__pyx_r);
  __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, 221, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":220
 * 
 *     @property
 *     def memview(self):             # <<<<<<<<<<<<<<
 *         return self.get_memview()
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":224
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_memview", 0);

  /* "View.MemoryView":225
 *     @cname('get_memview')
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE             # <<<<<<<<<<<<<<
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 */
  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);

  /* "View.MemoryView":226
 *     cdef get_memview(self):
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 226, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":224
 * 
 *     @cname('get_memview')
 *     cdef get_memview(self):             # <<<<<<<<<<<<<<
 *         flags =  PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
 *         return  memoryview(self, flags, self.dtype_is_object)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":228
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
 */

/* Python wrapper */
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":229
 * 
 *     def __len__(self):
 *         return self._shape[0]             # <<<<<<<<<<<<<<
 * 
 *     def __getattr__(self, attr):
 */
  __pyx_r = (__pyx_v_self->_shape[0]);
  goto __pyx_L0;

  /* "View.MemoryView":228
 *         return  memoryview(self, flags, self.dtype_is_object)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self._shape[0]
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":231
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "View.MemoryView":232
 * 
 *     def __getattr__(self, attr):
 *         return getattr(self.memview, attr)             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, item):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 232, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":231
 *         return self._shape[0]
 * 
 *     def __getattr__(self, attr):             # <<<<<<<<<<<<<<
 *         return getattr(self.memview, attr)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":234
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":235
 * 
 *     def __getitem__(self, item):
 *         return self.memview[item]             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, item, value):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":234
 *         return getattr(self.memview, attr)
 * 
 *     def __getitem__(self, item):             # <<<<<<<<<<<<<<
 *         return self.memview[item]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":237
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setitem__", 0);

  /* "View.MemoryView":238
 * 
 *     def __setitem__(self, item, value):
 *         self.memview[item] = value             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 238, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":237
 *         return self.memview[item]
 * 
 *     def __setitem__(self, item, value):             # <<<<<<<<<<<<<<
 *         self.memview[item] = value
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__292, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__293, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":242
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

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) {
  struct __pyx_array_obj *__pyx_v_result = 0;
  struct __pyx_array_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("array_cwrapper", 0);

  /* "View.MemoryView":246
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":247
 * 
 *     if buf == NULL:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))             # <<<<<<<<<<<<<<
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":246
 *     cdef array result
 * 
 *     if buf == NULL:             # <<<<<<<<<<<<<<
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":249
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
  /*else*/ {
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_shape);
    __Pyx_GIVEREF(__pyx_v_shape);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;

    /* "View.MemoryView":250
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)             # <<<<<<<<<<<<<<
 *         result.data = buf
 * 
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 250, __pyx_L1_error)

    /* "View.MemoryView":249
 *         result = array(shape, itemsize, format, mode.decode('ASCII'))
 *     else:
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),             # <<<<<<<<<<<<<<
 *                        allocate_buffer=False)
 *         result.data = buf
 */
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "View.MemoryView":251
 *         result = array(shape, itemsize, format, mode.decode('ASCII'),
 *                        allocate_buffer=False)
 *         result.data = buf             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
    __pyx_v_result->data = __pyx_v_buf;
  }
  __pyx_L3:;

  /* "View.MemoryView":253
 *         result.data = buf
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":242
 * 
 * @cname("__pyx_array_new")
 * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format,             # <<<<<<<<<<<<<<
 *                           char *mode, char *buf):
 *     cdef array result
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":279
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 279, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 279, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "View.MemoryView":280
 *     cdef object name
 *     def __init__(self, name):
 *         self.name = name             # <<<<<<<<<<<<<<
 *     def __repr__(self):
 *         return self.name
 */
  __Pyx_INCREF(__pyx_v_name);
  __Pyx_GIVEREF(__pyx_v_name);
  __Pyx_GOTREF(__pyx_v_self->name);
  __Pyx_DECREF(__pyx_v_self->name);
  __pyx_v_self->name = __pyx_v_name;

  /* "View.MemoryView":279
 * cdef class Enum(object):
 *     cdef object name
 *     def __init__(self, name):             # <<<<<<<<<<<<<<
 *         self.name = name
 *     def __repr__(self):
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":281
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":282
 *         self.name = name
 *     def __repr__(self):
 *         return self.name             # <<<<<<<<<<<<<<
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->name);
  __pyx_r = __pyx_v_self->name;
  goto __pyx_L0;

  /* "View.MemoryView":281
 *     def __init__(self, name):
 *         self.name = name
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return self.name
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = (self.name,)
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  int __pyx_v_use_setstate;
  PyObject *__pyx_v_state = NULL;
  PyObject *__pyx_v__dict = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     cdef bint use_setstate
 *     state = (self.name,)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->name);
  __Pyx_GIVEREF(__pyx_v_self->name);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  __pyx_v_state = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":4
 *     cdef bint use_setstate
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":5
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":6
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "(tree fragment)":7
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.name is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":5
 *     state = (self.name,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
    goto __pyx_L3;
  }

  /* "(tree fragment)":9
 *         use_setstate = True
 *     else:
 *         use_setstate = self.name is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_self->name != Py_None);
    __pyx_v_use_setstate = __pyx_t_3;
  }
  __pyx_L3:;

  /* "(tree fragment)":10
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 */
  __pyx_t_3 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_3) {

    /* "(tree fragment)":11
 *         use_setstate = self.name is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":10
 *     else:
 *         use_setstate = self.name is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 */
  }

  /* "(tree fragment)":13
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_184977713);
    __Pyx_GIVEREF(__pyx_int_184977713);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = (self.name,)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_state);
  __Pyx_XDECREF(__pyx_v__dict);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
 */
  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, 15, __pyx_L1_error)
  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":14
 *     else:
 *         return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Enum__set_state(self, __pyx_state)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":296
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  Py_intptr_t __pyx_v_aligned_p;
  size_t __pyx_v_offset;
  void *__pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":298
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory             # <<<<<<<<<<<<<<
 *     cdef size_t offset
 * 
 */
  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);

  /* "View.MemoryView":302
 * 
 *     with cython.cdivision(True):
 *         offset = aligned_p % alignment             # <<<<<<<<<<<<<<
 * 
 *     if offset > 0:
 */
  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);

  /* "View.MemoryView":304
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":305
 * 
 *     if offset > 0:
 *         aligned_p += alignment - offset             # <<<<<<<<<<<<<<
 * 
 *     return <void *> aligned_p
 */
    __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));

    /* "View.MemoryView":304
 *         offset = aligned_p % alignment
 * 
 *     if offset > 0:             # <<<<<<<<<<<<<<
 *         aligned_p += alignment - offset
 * 
 */
  }

  /* "View.MemoryView":307
 *         aligned_p += alignment - offset
 * 
 *     return <void *> aligned_p             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = ((void *)__pyx_v_aligned_p);
  goto __pyx_L0;

  /* "View.MemoryView":296
 * 
 * @cname('__pyx_align_pointer')
 * cdef void *align_pointer(void *memory, size_t alignment) nogil:             # <<<<<<<<<<<<<<
 *     "Align pointer memory on a given boundary"
 *     cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":343
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_v_flags;
  int __pyx_v_dtype_is_object;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 343, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dtype_is_object);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 343, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_obj = values[0];
    __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 343, __pyx_L3_error)
    if (values[2]) {
      __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 343, __pyx_L3_error)
    } else {
      __pyx_v_dtype_is_object = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 343, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __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);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "View.MemoryView":344
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj             # <<<<<<<<<<<<<<
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 */
  __Pyx_INCREF(__pyx_v_obj);
  __Pyx_GIVEREF(__pyx_v_obj);
  __Pyx_GOTREF(__pyx_v_self->obj);
  __Pyx_DECREF(__pyx_v_self->obj);
  __pyx_v_self->obj = __pyx_v_obj;

  /* "View.MemoryView":345
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
 *         self.obj = obj
 *         self.flags = flags             # <<<<<<<<<<<<<<
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 */
  __pyx_v_self->flags = __pyx_v_flags;

  /* "View.MemoryView":346
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_obj != Py_None);
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "View.MemoryView":347
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)             # <<<<<<<<<<<<<<
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 */
    __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, 347, __pyx_L1_error)

    /* "View.MemoryView":348
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":349
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None             # <<<<<<<<<<<<<<
 *                 Py_INCREF(Py_None)
 * 
 */
      ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;

      /* "View.MemoryView":350
 *             if <PyObject *> self.view.obj == NULL:
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *         global __pyx_memoryview_thread_locks_used
 */
      Py_INCREF(Py_None);

      /* "View.MemoryView":348
 *         if type(self) is memoryview or obj is not None:
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:             # <<<<<<<<<<<<<<
 *                 (<__pyx_buffer *> &self.view).obj = Py_None
 *                 Py_INCREF(Py_None)
 */
    }

    /* "View.MemoryView":346
 *         self.obj = obj
 *         self.flags = flags
 *         if type(self) is memoryview or obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_GetBuffer(obj, &self.view, flags)
 *             if <PyObject *> self.view.obj == NULL:
 */
  }

  /* "View.MemoryView":353
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":354
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]             # <<<<<<<<<<<<<<
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 */
    __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);

    /* "View.MemoryView":355
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1             # <<<<<<<<<<<<<<
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 */
    __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);

    /* "View.MemoryView":353
 * 
 *         global __pyx_memoryview_thread_locks_used
 *         if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:             # <<<<<<<<<<<<<<
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 */
  }

  /* "View.MemoryView":356
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":357
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()             # <<<<<<<<<<<<<<
 *             if self.lock is NULL:
 *                 raise MemoryError
 */
    __pyx_v_self->lock = PyThread_allocate_lock();

    /* "View.MemoryView":358
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":359
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
      PyErr_NoMemory(); __PYX_ERR(2, 359, __pyx_L1_error)

      /* "View.MemoryView":358
 *         if self.lock is NULL:
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 * 
 */
    }

    /* "View.MemoryView":356
 *             self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
 *             __pyx_memoryview_thread_locks_used += 1
 *         if self.lock is NULL:             # <<<<<<<<<<<<<<
 *             self.lock = PyThread_allocate_lock()
 *             if self.lock is NULL:
 */
  }

  /* "View.MemoryView":361
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":362
 * 
 *         if flags & PyBUF_FORMAT:
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')             # <<<<<<<<<<<<<<
 *         else:
 *             self.dtype_is_object = dtype_is_object
 */
    __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    __pyx_v_self->dtype_is_object = __pyx_t_1;

    /* "View.MemoryView":361
 *                 raise MemoryError
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 */
    goto __pyx_L10;
  }

  /* "View.MemoryView":364
 *             self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
 *         else:
 *             self.dtype_is_object = dtype_is_object             # <<<<<<<<<<<<<<
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 */
  /*else*/ {
    __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  }
  __pyx_L10:;

  /* "View.MemoryView":366
 *             self.dtype_is_object = dtype_is_object
 * 
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(             # <<<<<<<<<<<<<<
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL
 */
  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));

  /* "View.MemoryView":368
 *         self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
 *                   <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
 *         self.typeinfo = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(memoryview self):
 */
  __pyx_v_self->typeinfo = NULL;

  /* "View.MemoryView":343
 *     cdef __Pyx_TypeInfo *typeinfo
 * 
 *     def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):             # <<<<<<<<<<<<<<
 *         self.obj = obj
 *         self.flags = flags
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":370
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  int __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyThread_type_lock __pyx_t_5;
  PyThread_type_lock __pyx_t_6;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":371
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 * 
 */
  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":372
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)             # <<<<<<<<<<<<<<
 * 
 *         cdef int i
 */
    __Pyx_ReleaseBuffer((&__pyx_v_self->view));

    /* "View.MemoryView":371
 * 
 *     def __dealloc__(memoryview self):
 *         if self.obj is not None:             # <<<<<<<<<<<<<<
 *             __Pyx_ReleaseBuffer(&self.view)
 * 
 */
  }

  /* "View.MemoryView":376
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":377
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):             # <<<<<<<<<<<<<<
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 */
    __pyx_t_3 = __pyx_memoryview_thread_locks_used;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "View.MemoryView":378
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":379
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1             # <<<<<<<<<<<<<<
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 */
        __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);

        /* "View.MemoryView":380
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":382
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])             # <<<<<<<<<<<<<<
 *                     break
 *             else:
 */
          __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
          __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]);

          /* "View.MemoryView":381
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (             # <<<<<<<<<<<<<<
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break
 */
          (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5;
          (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6;

          /* "View.MemoryView":380
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:             # <<<<<<<<<<<<<<
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 */
        }

        /* "View.MemoryView":383
 *                         __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
 *                             __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 PyThread_free_lock(self.lock)
 */
        goto __pyx_L6_break;

        /* "View.MemoryView":378
 *         if self.lock != NULL:
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:             # <<<<<<<<<<<<<<
 *                     __pyx_memoryview_thread_locks_used -= 1
 *                     if i != __pyx_memoryview_thread_locks_used:
 */
      }
    }
    /*else*/ {

      /* "View.MemoryView":385
 *                     break
 *             else:
 *                 PyThread_free_lock(self.lock)             # <<<<<<<<<<<<<<
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 */
      PyThread_free_lock(__pyx_v_self->lock);
    }
    __pyx_L6_break:;

    /* "View.MemoryView":376
 *         cdef int i
 *         global __pyx_memoryview_thread_locks_used
 *         if self.lock != NULL:             # <<<<<<<<<<<<<<
 *             for i in range(__pyx_memoryview_thread_locks_used):
 *                 if __pyx_memoryview_thread_locks[i] is self.lock:
 */
  }

  /* "View.MemoryView":370
 *         self.typeinfo = NULL
 * 
 *     def __dealloc__(memoryview self):             # <<<<<<<<<<<<<<
 *         if self.obj is not None:
 *             __Pyx_ReleaseBuffer(&self.view)
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":387
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  Py_ssize_t __pyx_v_dim;
  char *__pyx_v_itemp;
  PyObject *__pyx_v_idx = NULL;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  char *__pyx_t_7;
  __Pyx_RefNannySetupContext("get_item_pointer", 0);

  /* "View.MemoryView":389
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf             # <<<<<<<<<<<<<<
 * 
 *         for dim, idx in enumerate(index):
 */
  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);

  /* "View.MemoryView":391
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
    __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 391, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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, 391, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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, 391, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 391, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 391, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_v_dim = __pyx_t_1;
    __pyx_t_1 = (__pyx_t_1 + 1);

    /* "View.MemoryView":392
 * 
 *         for dim, idx in enumerate(index):
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)             # <<<<<<<<<<<<<<
 * 
 *         return itemp
 */
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 392, __pyx_L1_error)
    __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, 392, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_7;

    /* "View.MemoryView":391
 *         cdef char *itemp = <char *> self.view.buf
 * 
 *         for dim, idx in enumerate(index):             # <<<<<<<<<<<<<<
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":394
 *             itemp = pybuffer_index(&self.view, itemp, idx, dim)
 * 
 *         return itemp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_itemp;
  goto __pyx_L0;

  /* "View.MemoryView":387
 *                 PyThread_free_lock(self.lock)
 * 
 *     cdef char *get_item_pointer(memoryview self, object index) except NULL:             # <<<<<<<<<<<<<<
 *         cdef Py_ssize_t dim
 *         cdef char *itemp = <char *> self.view.buf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":397
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_indices = NULL;
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  char *__pyx_t_6;
  __Pyx_RefNannySetupContext("__getitem__", 0);

  /* "View.MemoryView":398
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":399
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:
 *             return self             # <<<<<<<<<<<<<<
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __pyx_r = ((PyObject *)__pyx_v_self);
    goto __pyx_L0;

    /* "View.MemoryView":398
 * 
 *     def __getitem__(memoryview self, object index):
 *         if index is Ellipsis:             # <<<<<<<<<<<<<<
 *             return self
 * 
 */
  }

  /* "View.MemoryView":401
 *             return self
 * 
 *         have_slices, indices = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         cdef char *itemp
 */
  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(__pyx_t_3 != Py_None)) {
    PyObject* sequence = __pyx_t_3;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(2, 401, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 401, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 401, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_indices = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "View.MemoryView":404
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 404, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "View.MemoryView":405
 *         cdef char *itemp
 *         if have_slices:
 *             return memview_slice(self, indices)             # <<<<<<<<<<<<<<
 *         else:
 *             itemp = self.get_item_pointer(indices)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 405, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":404
 * 
 *         cdef char *itemp
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             return memview_slice(self, indices)
 *         else:
 */
  }

  /* "View.MemoryView":407
 *             return memview_slice(self, indices)
 *         else:
 *             itemp = self.get_item_pointer(indices)             # <<<<<<<<<<<<<<
 *             return self.convert_item_to_object(itemp)
 * 
 */
  /*else*/ {
    __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, 407, __pyx_L1_error)
    __pyx_v_itemp = __pyx_t_6;

    /* "View.MemoryView":408
 *         else:
 *             itemp = self.get_item_pointer(indices)
 *             return self.convert_item_to_object(itemp)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(memoryview self, object index, object value):
 */
    __Pyx_XDECREF(__pyx_r);
    __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, 408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":397
 * 
 * 
 *     def __getitem__(memoryview self, object index):             # <<<<<<<<<<<<<<
 *         if index is Ellipsis:
 *             return self
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_indices);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":410
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 */

/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_v_have_slices = NULL;
  PyObject *__pyx_v_obj = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_INCREF(__pyx_v_index);

  /* "View.MemoryView":411
 * 
 *     def __setitem__(memoryview self, object index, object value):
 *         have_slices, index = _unellipsify(index, self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *         if have_slices:
 */
  __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(__pyx_t_1 != Py_None)) {
    PyObject* sequence = __pyx_t_1;
    #if !CYTHON_COMPILING_IN_PYPY
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(2, 411, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 411, __pyx_L1_error)
  }
  __pyx_v_have_slices = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":413
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 413, __pyx_L1_error)
  if (__pyx_t_4) {

    /* "View.MemoryView":414
 * 
 *         if have_slices:
 *             obj = self.is_slice(value)             # <<<<<<<<<<<<<<
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_obj = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "View.MemoryView":415
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 415, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "View.MemoryView":416
 *             obj = self.is_slice(value)
 *             if obj:
 *                 self.setitem_slice_assignment(self[index], obj)             # <<<<<<<<<<<<<<
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)
 */
      __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "View.MemoryView":415
 *         if have_slices:
 *             obj = self.is_slice(value)
 *             if obj:             # <<<<<<<<<<<<<<
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":418
 *                 self.setitem_slice_assignment(self[index], obj)
 *             else:
 *                 self.setitem_slice_assign_scalar(self[index], value)             # <<<<<<<<<<<<<<
 *         else:
 *             self.setitem_indexed(index, value)
 */
    /*else*/ {
      __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 418, __pyx_L1_error)
      __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 418, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L4:;

    /* "View.MemoryView":413
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 *         if have_slices:             # <<<<<<<<<<<<<<
 *             obj = self.is_slice(value)
 *             if obj:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":420
 *                 self.setitem_slice_assign_scalar(self[index], value)
 *         else:
 *             self.setitem_indexed(index, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef is_slice(self, obj):
 */
  /*else*/ {
    __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 420, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":410
 *             return self.convert_item_to_object(itemp)
 * 
 *     def __setitem__(memoryview self, object index, object value):             # <<<<<<<<<<<<<<
 *         have_slices, index = _unellipsify(index, self.view.ndim)
 * 
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_have_slices);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":422
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  __Pyx_RefNannySetupContext("is_slice", 0);
  __Pyx_INCREF(__pyx_v_obj);

  /* "View.MemoryView":423
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":424
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      /*try:*/ {

        /* "View.MemoryView":425
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 425, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":426
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)             # <<<<<<<<<<<<<<
 *             except TypeError:
 *                 return None
 */
        __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 426, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);

        /* "View.MemoryView":425
 *         if not isinstance(obj, memoryview):
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,             # <<<<<<<<<<<<<<
 *                                  self.dtype_is_object)
 *             except TypeError:
 */
        __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 425, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_obj);
        __Pyx_GIVEREF(__pyx_v_obj);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
        __pyx_t_6 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 425, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "View.MemoryView":424
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      }
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L9_try_end;
      __pyx_L4_error:;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "View.MemoryView":427
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 *             except TypeError:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
      __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
      if (__pyx_t_9) {
        __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 427, __pyx_L6_except_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_6);

        /* "View.MemoryView":428
 *                                  self.dtype_is_object)
 *             except TypeError:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         return obj
 */
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(Py_None);
        __pyx_r = Py_None;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L7_except_return;
      }
      goto __pyx_L6_except_error;
      __pyx_L6_except_error:;

      /* "View.MemoryView":424
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):
 *             try:             # <<<<<<<<<<<<<<
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 *                                  self.dtype_is_object)
 */
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L1_error;
      __pyx_L7_except_return:;
      __Pyx_XGIVEREF(__pyx_t_3);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
      goto __pyx_L0;
      __pyx_L9_try_end:;
    }

    /* "View.MemoryView":423
 * 
 *     cdef is_slice(self, obj):
 *         if not isinstance(obj, memoryview):             # <<<<<<<<<<<<<<
 *             try:
 *                 obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
 */
  }

  /* "View.MemoryView":430
 *                 return None
 * 
 *         return obj             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assignment(self, dst, src):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_obj);
  __pyx_r = __pyx_v_obj;
  goto __pyx_L0;

  /* "View.MemoryView":422
 *             self.setitem_indexed(index, value)
 * 
 *     cdef is_slice(self, obj):             # <<<<<<<<<<<<<<
 *         if not isinstance(obj, memoryview):
 *             try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":432
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  __Pyx_memviewslice __pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_src_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);

  /* "View.MemoryView":436
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 436, __pyx_L1_error)

  /* "View.MemoryView":437
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],             # <<<<<<<<<<<<<<
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 */
  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 437, __pyx_L1_error)

  /* "View.MemoryView":438
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 438, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 438, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":436
 *         cdef __Pyx_memviewslice src_slice
 * 
 *         memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],             # <<<<<<<<<<<<<<
 *                                  get_slice_from_memview(dst, &dst_slice)[0],
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 */
  __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 436, __pyx_L1_error)

  /* "View.MemoryView":432
 *         return obj
 * 
 *     cdef setitem_slice_assignment(self, dst, src):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice dst_slice
 *         cdef __Pyx_memviewslice src_slice
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":440
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

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) {
  int __pyx_v_array[0x80];
  void *__pyx_v_tmp;
  void *__pyx_v_item;
  __Pyx_memviewslice *__pyx_v_dst_slice;
  __Pyx_memviewslice __pyx_v_tmp_slice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  char const *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);

  /* "View.MemoryView":442
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):
 *         cdef int array[128]
 *         cdef void *tmp = NULL             # <<<<<<<<<<<<<<
 *         cdef void *item
 * 
 */
  __pyx_v_tmp = NULL;

  /* "View.MemoryView":447
 *         cdef __Pyx_memviewslice *dst_slice
 *         cdef __Pyx_memviewslice tmp_slice
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)             # <<<<<<<<<<<<<<
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 */
  __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));

  /* "View.MemoryView":449
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
  __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":450
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)             # <<<<<<<<<<<<<<
 *             if tmp == NULL:
 *                 raise MemoryError
 */
    __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);

    /* "View.MemoryView":451
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":452
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 *                 raise MemoryError             # <<<<<<<<<<<<<<
 *             item = tmp
 *         else:
 */
      PyErr_NoMemory(); __PYX_ERR(2, 452, __pyx_L1_error)

      /* "View.MemoryView":451
 *         if <size_t>self.view.itemsize > sizeof(array):
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:             # <<<<<<<<<<<<<<
 *                 raise MemoryError
 *             item = tmp
 */
    }

    /* "View.MemoryView":453
 *             if tmp == NULL:
 *                 raise MemoryError
 *             item = tmp             # <<<<<<<<<<<<<<
 *         else:
 *             item = <void *> array
 */
    __pyx_v_item = __pyx_v_tmp;

    /* "View.MemoryView":449
 *         dst_slice = get_slice_from_memview(dst, &tmp_slice)
 * 
 *         if <size_t>self.view.itemsize > sizeof(array):             # <<<<<<<<<<<<<<
 *             tmp = PyMem_Malloc(self.view.itemsize)
 *             if tmp == NULL:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":455
 *             item = tmp
 *         else:
 *             item = <void *> array             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  /*else*/ {
    __pyx_v_item = ((void *)__pyx_v_array);
  }
  __pyx_L3:;

  /* "View.MemoryView":457
 *             item = <void *> array
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value
 */
  /*try:*/ {

    /* "View.MemoryView":458
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
    __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":459
 *         try:
 *             if self.dtype_is_object:
 *                 (<PyObject **> item)[0] = <PyObject *> value             # <<<<<<<<<<<<<<
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)
 */
      (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);

      /* "View.MemoryView":458
 * 
 *         try:
 *             if self.dtype_is_object:             # <<<<<<<<<<<<<<
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 */
      goto __pyx_L8;
    }

    /* "View.MemoryView":461
 *                 (<PyObject **> item)[0] = <PyObject *> value
 *             else:
 *                 self.assign_item_from_object(<char *> item, value)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      __pyx_t_2 = ((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_2)) __PYX_ERR(2, 461, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L8:;

    /* "View.MemoryView":465
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":466
 * 
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)             # <<<<<<<<<<<<<<
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 *                                 item, self.dtype_is_object)
 */
      __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 466, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "View.MemoryView":465
 * 
 * 
 *             if self.view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
 */
    }

    /* "View.MemoryView":467
 *             if self.view.suboffsets != NULL:
 *                 assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
 *             slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,             # <<<<<<<<<<<<<<
 *                                 item, self.dtype_is_object)
 *         finally:
 */
    __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);
  }

  /* "View.MemoryView":470
 *                                 item, self.dtype_is_object)
 *         finally:
 *             PyMem_Free(tmp)             # <<<<<<<<<<<<<<
 * 
 *     cdef setitem_indexed(self, index, value):
 */
  /*finally:*/ {
    /*normal exit:*/{
      PyMem_Free(__pyx_v_tmp);
      goto __pyx_L7;
    }
    __pyx_L6_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
      {
        PyMem_Free(__pyx_v_tmp);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_9);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
      __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
      __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
      goto __pyx_L1_error;
    }
    __pyx_L7:;
  }

  /* "View.MemoryView":440
 *                                  src.ndim, dst.ndim, self.dtype_is_object)
 * 
 *     cdef setitem_slice_assign_scalar(self, memoryview dst, value):             # <<<<<<<<<<<<<<
 *         cdef int array[128]
 *         cdef void *tmp = NULL
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":472
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  char *__pyx_v_itemp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("setitem_indexed", 0);

  /* "View.MemoryView":473
 * 
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)             # <<<<<<<<<<<<<<
 *         self.assign_item_from_object(itemp, value)
 * 
 */
  __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, 473, __pyx_L1_error)
  __pyx_v_itemp = __pyx_t_1;

  /* "View.MemoryView":474
 *     cdef setitem_indexed(self, index, value):
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __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, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":472
 *             PyMem_Free(tmp)
 * 
 *     cdef setitem_indexed(self, index, value):             # <<<<<<<<<<<<<<
 *         cdef char *itemp = self.get_item_pointer(index)
 *         self.assign_item_from_object(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":476
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_v_struct = NULL;
  PyObject *__pyx_v_bytesitem = 0;
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_t_11;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":479
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef bytes bytesitem
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":482
 *         cdef bytes bytesitem
 * 
 *         bytesitem = itemp[:self.view.itemsize]             # <<<<<<<<<<<<<<
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 */
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 482, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":483
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    /*try:*/ {

      /* "View.MemoryView":484
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)             # <<<<<<<<<<<<<<
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 484, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 484, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
          __pyx_t_8 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __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, 484, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
        __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, 484, __pyx_L3_error)
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 484, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_9);
        if (__pyx_t_7) {
          __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
        __Pyx_INCREF(__pyx_v_bytesitem);
        __Pyx_GIVEREF(__pyx_v_bytesitem);
        PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 484, __pyx_L3_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_result = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "View.MemoryView":483
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    }

    /* "View.MemoryView":488
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
    /*else:*/ {
      __pyx_t_10 = strlen(__pyx_v_self->view.format); 
      __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
      if (__pyx_t_11) {

        /* "View.MemoryView":489
 *         else:
 *             if len(self.view.format) == 1:
 *                 return result[0]             # <<<<<<<<<<<<<<
 *             return result
 * 
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 489, __pyx_L5_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_r = __pyx_t_1;
        __pyx_t_1 = 0;
        goto __pyx_L6_except_return;

        /* "View.MemoryView":488
 *             raise ValueError("Unable to convert item to object")
 *         else:
 *             if len(self.view.format) == 1:             # <<<<<<<<<<<<<<
 *                 return result[0]
 *             return result
 */
      }

      /* "View.MemoryView":490
 *             if len(self.view.format) == 1:
 *                 return result[0]
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_result);
      __pyx_r = __pyx_v_result;
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "View.MemoryView":485
 *         try:
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:             # <<<<<<<<<<<<<<
 *             raise ValueError("Unable to convert item to object")
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 485, __pyx_L5_except_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {
      __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9) < 0) __PYX_ERR(2, 485, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_9);

      /* "View.MemoryView":486
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
      __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__294, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 486, __pyx_L5_except_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_Raise(__pyx_t_6, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __PYX_ERR(2, 486, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;

    /* "View.MemoryView":483
 * 
 *         bytesitem = itemp[:self.view.itemsize]
 *         try:             # <<<<<<<<<<<<<<
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 */
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
    goto __pyx_L0;
  }

  /* "View.MemoryView":476
 *         self.assign_item_from_object(itemp, value)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesitem);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":492
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_struct = NULL;
  char __pyx_v_c;
  PyObject *__pyx_v_bytesvalue = 0;
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  char *__pyx_t_12;
  char *__pyx_t_13;
  char *__pyx_t_14;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":495
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 *         import struct             # <<<<<<<<<<<<<<
 *         cdef char c
 *         cdef bytes bytesvalue
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_struct = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "View.MemoryView":500
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
  __pyx_t_2 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "View.MemoryView":501
 * 
 *         if isinstance(value, tuple):
 *             bytesvalue = struct.pack(self.view.format, *value)             # <<<<<<<<<<<<<<
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 501, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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, 501, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "View.MemoryView":500
 *         cdef Py_ssize_t i
 * 
 *         if isinstance(value, tuple):             # <<<<<<<<<<<<<<
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":503
 *             bytesvalue = struct.pack(self.view.format, *value)
 *         else:
 *             bytesvalue = struct.pack(self.view.format, value)             # <<<<<<<<<<<<<<
 * 
 *         for i, c in enumerate(bytesvalue):
 */
  /*else*/ {
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 503, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = NULL;
    __pyx_t_7 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
        __pyx_t_7 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __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, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
      __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, 503, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 503, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    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, 503, __pyx_L1_error)
    __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":505
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
  __pyx_t_9 = 0;
  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
    __PYX_ERR(2, 505, __pyx_L1_error)
  }
  __Pyx_INCREF(__pyx_v_bytesvalue);
  __pyx_t_10 = __pyx_v_bytesvalue;
  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
    __pyx_t_11 = __pyx_t_14;
    __pyx_v_c = (__pyx_t_11[0]);

    /* "View.MemoryView":506
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    __pyx_v_i = __pyx_t_9;

    /* "View.MemoryView":505
 *             bytesvalue = struct.pack(self.view.format, value)
 * 
 *         for i, c in enumerate(bytesvalue):             # <<<<<<<<<<<<<<
 *             itemp[i] = c
 * 
 */
    __pyx_t_9 = (__pyx_t_9 + 1);

    /* "View.MemoryView":506
 * 
 *         for i, c in enumerate(bytesvalue):
 *             itemp[i] = c             # <<<<<<<<<<<<<<
 * 
 *     @cname('getbuffer')
 */
    (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  }
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

  /* "View.MemoryView":492
 *             return result
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         """Only used if instantiated manually by the user, or if Cython doesn't
 *         know how to convert the type"""
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_struct);
  __Pyx_XDECREF(__pyx_v_bytesvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":509
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_STRIDES:
 *             info.shape = self.view.shape
 */

/* Python wrapper */
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  __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));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  char *__pyx_t_3;
  void *__pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  __Pyx_RefNannySetupContext("__getbuffer__", 0);
  if (__pyx_v_info != NULL) {
    __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(__pyx_v_info->obj);
  }

  /* "View.MemoryView":510
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":511
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_STRIDES:
 *             info.shape = self.view.shape             # <<<<<<<<<<<<<<
 *         else:
 *             info.shape = NULL
 */
    __pyx_t_2 = __pyx_v_self->view.shape;
    __pyx_v_info->shape = __pyx_t_2;

    /* "View.MemoryView":510
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.shape = self.view.shape
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":513
 *             info.shape = self.view.shape
 *         else:
 *             info.shape = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_STRIDES:
 */
  /*else*/ {
    __pyx_v_info->shape = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":515
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":516
 * 
 *         if flags & PyBUF_STRIDES:
 *             info.strides = self.view.strides             # <<<<<<<<<<<<<<
 *         else:
 *             info.strides = NULL
 */
    __pyx_t_2 = __pyx_v_self->view.strides;
    __pyx_v_info->strides = __pyx_t_2;

    /* "View.MemoryView":515
 *             info.shape = NULL
 * 
 *         if flags & PyBUF_STRIDES:             # <<<<<<<<<<<<<<
 *             info.strides = self.view.strides
 *         else:
 */
    goto __pyx_L4;
  }

  /* "View.MemoryView":518
 *             info.strides = self.view.strides
 *         else:
 *             info.strides = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_INDIRECT:
 */
  /*else*/ {
    __pyx_v_info->strides = NULL;
  }
  __pyx_L4:;

  /* "View.MemoryView":520
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":521
 * 
 *         if flags & PyBUF_INDIRECT:
 *             info.suboffsets = self.view.suboffsets             # <<<<<<<<<<<<<<
 *         else:
 *             info.suboffsets = NULL
 */
    __pyx_t_2 = __pyx_v_self->view.suboffsets;
    __pyx_v_info->suboffsets = __pyx_t_2;

    /* "View.MemoryView":520
 *             info.strides = NULL
 * 
 *         if flags & PyBUF_INDIRECT:             # <<<<<<<<<<<<<<
 *             info.suboffsets = self.view.suboffsets
 *         else:
 */
    goto __pyx_L5;
  }

  /* "View.MemoryView":523
 *             info.suboffsets = self.view.suboffsets
 *         else:
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 * 
 *         if flags & PyBUF_FORMAT:
 */
  /*else*/ {
    __pyx_v_info->suboffsets = NULL;
  }
  __pyx_L5:;

  /* "View.MemoryView":525
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":526
 * 
 *         if flags & PyBUF_FORMAT:
 *             info.format = self.view.format             # <<<<<<<<<<<<<<
 *         else:
 *             info.format = NULL
 */
    __pyx_t_3 = __pyx_v_self->view.format;
    __pyx_v_info->format = __pyx_t_3;

    /* "View.MemoryView":525
 *             info.suboffsets = NULL
 * 
 *         if flags & PyBUF_FORMAT:             # <<<<<<<<<<<<<<
 *             info.format = self.view.format
 *         else:
 */
    goto __pyx_L6;
  }

  /* "View.MemoryView":528
 *             info.format = self.view.format
 *         else:
 *             info.format = NULL             # <<<<<<<<<<<<<<
 * 
 *         info.buf = self.view.buf
 */
  /*else*/ {
    __pyx_v_info->format = NULL;
  }
  __pyx_L6:;

  /* "View.MemoryView":530
 *             info.format = NULL
 * 
 *         info.buf = self.view.buf             # <<<<<<<<<<<<<<
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 */
  __pyx_t_4 = __pyx_v_self->view.buf;
  __pyx_v_info->buf = __pyx_t_4;

  /* "View.MemoryView":531
 * 
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim             # <<<<<<<<<<<<<<
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 */
  __pyx_t_5 = __pyx_v_self->view.ndim;
  __pyx_v_info->ndim = __pyx_t_5;

  /* "View.MemoryView":532
 *         info.buf = self.view.buf
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize             # <<<<<<<<<<<<<<
 *         info.len = self.view.len
 *         info.readonly = 0
 */
  __pyx_t_6 = __pyx_v_self->view.itemsize;
  __pyx_v_info->itemsize = __pyx_t_6;

  /* "View.MemoryView":533
 *         info.ndim = self.view.ndim
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len             # <<<<<<<<<<<<<<
 *         info.readonly = 0
 *         info.obj = self
 */
  __pyx_t_6 = __pyx_v_self->view.len;
  __pyx_v_info->len = __pyx_t_6;

  /* "View.MemoryView":534
 *         info.itemsize = self.view.itemsize
 *         info.len = self.view.len
 *         info.readonly = 0             # <<<<<<<<<<<<<<
 *         info.obj = self
 * 
 */
  __pyx_v_info->readonly = 0;

  /* "View.MemoryView":535
 *         info.len = self.view.len
 *         info.readonly = 0
 *         info.obj = self             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_GOTREF(__pyx_v_info->obj);
  __Pyx_DECREF(__pyx_v_info->obj);
  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);

  /* "View.MemoryView":509
 * 
 *     @cname('getbuffer')
 *     def __getbuffer__(self, Py_buffer *info, int flags):             # <<<<<<<<<<<<<<
 *         if flags & PyBUF_STRIDES:
 *             info.shape = self.view.shape
 */

  /* function exit code */
  __pyx_r = 0;
  if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
    __Pyx_GOTREF(Py_None);
    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
  }
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":541
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":542
 *     @property
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&result.from_slice)
 *         return result
 */
  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 542, __pyx_L1_error)
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":543
 *     def T(self):
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)             # <<<<<<<<<<<<<<
 *         return result
 * 
 */
  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 543, __pyx_L1_error)

  /* "View.MemoryView":544
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 *         return result             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":541
 * 
 *     @property
 *     def T(self):             # <<<<<<<<<<<<<<
 *         cdef _memoryviewslice result = memoryview_copy(self)
 *         transpose_memslice(&result.from_slice)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":547
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":548
 *     @property
 *     def base(self):
 *         return self.obj             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->obj);
  __pyx_r = __pyx_v_self->obj;
  goto __pyx_L0;

  /* "View.MemoryView":547
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.obj
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":551
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":552
 *     @property
 *     def shape(self):
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
    __pyx_t_2 = __pyx_t_4;
    __pyx_v_length = (__pyx_t_2[0]);
    __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 552, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 552, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 552, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":551
 * 
 *     @property
 *     def shape(self):             # <<<<<<<<<<<<<<
 *         return tuple([length for length in self.view.shape[:self.view.ndim]])
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":555
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_stride;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":556
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":558
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__295, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 558, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 558, __pyx_L1_error)

    /* "View.MemoryView":556
 *     @property
 *     def strides(self):
 *         if self.view.strides == NULL:             # <<<<<<<<<<<<<<
 * 
 *             raise ValueError("Buffer view does not expose strides")
 */
  }

  /* "View.MemoryView":560
 *             raise ValueError("Buffer view does not expose strides")
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
    __pyx_t_3 = __pyx_t_5;
    __pyx_v_stride = (__pyx_t_3[0]);
    __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 560, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 560, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":555
 * 
 *     @property
 *     def strides(self):             # <<<<<<<<<<<<<<
 *         if self.view.strides == NULL:
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":563
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":564
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":565
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__296, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":564
 *     @property
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:             # <<<<<<<<<<<<<<
 *             return (-1,) * self.view.ndim
 * 
 */
  }

  /* "View.MemoryView":567
 *             return (-1,) * self.view.ndim
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
    __pyx_t_4 = __pyx_t_6;
    __pyx_v_suboffset = (__pyx_t_4[0]);
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 567, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 567, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":563
 * 
 *     @property
 *     def suboffsets(self):             # <<<<<<<<<<<<<<
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":570
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":571
 *     @property
 *     def ndim(self):
 *         return self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 571, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":570
 * 
 *     @property
 *     def ndim(self):             # <<<<<<<<<<<<<<
 *         return self.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":574
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":575
 *     @property
 *     def itemsize(self):
 *         return self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 575, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":574
 * 
 *     @property
 *     def itemsize(self):             # <<<<<<<<<<<<<<
 *         return self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":578
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":579
 *     @property
 *     def nbytes(self):
 *         return self.size * self.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":578
 * 
 *     @property
 *     def nbytes(self):             # <<<<<<<<<<<<<<
 *         return self.size * self.view.itemsize
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":582
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_v_result = NULL;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  Py_ssize_t *__pyx_t_4;
  Py_ssize_t *__pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":583
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":584
 *     def size(self):
 *         if self._size is None:
 *             result = 1             # <<<<<<<<<<<<<<
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 */
    __Pyx_INCREF(__pyx_int_1);
    __pyx_v_result = __pyx_int_1;

    /* "View.MemoryView":586
 *             result = 1
 * 
 *             for length in self.view.shape[:self.view.ndim]:             # <<<<<<<<<<<<<<
 *                 result *= length
 * 
 */
    __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
    for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
      __pyx_t_3 = __pyx_t_5;
      __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "View.MemoryView":587
 * 
 *             for length in self.view.shape[:self.view.ndim]:
 *                 result *= length             # <<<<<<<<<<<<<<
 * 
 *             self._size = result
 */
      __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 587, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
      __pyx_t_6 = 0;
    }

    /* "View.MemoryView":589
 *                 result *= length
 * 
 *             self._size = result             # <<<<<<<<<<<<<<
 * 
 *         return self._size
 */
    __Pyx_INCREF(__pyx_v_result);
    __Pyx_GIVEREF(__pyx_v_result);
    __Pyx_GOTREF(__pyx_v_self->_size);
    __Pyx_DECREF(__pyx_v_self->_size);
    __pyx_v_self->_size = __pyx_v_result;

    /* "View.MemoryView":583
 *     @property
 *     def size(self):
 *         if self._size is None:             # <<<<<<<<<<<<<<
 *             result = 1
 * 
 */
  }

  /* "View.MemoryView":591
 *             self._size = result
 * 
 *         return self._size             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->_size);
  __pyx_r = __pyx_v_self->_size;
  goto __pyx_L0;

  /* "View.MemoryView":582
 * 
 *     @property
 *     def size(self):             # <<<<<<<<<<<<<<
 *         if self._size is None:
 *             result = 1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":593
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__len__", 0);

  /* "View.MemoryView":594
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":595
 *     def __len__(self):
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_r = (__pyx_v_self->view.shape[0]);
    goto __pyx_L0;

    /* "View.MemoryView":594
 * 
 *     def __len__(self):
 *         if self.view.ndim >= 1:             # <<<<<<<<<<<<<<
 *             return self.view.shape[0]
 * 
 */
  }

  /* "View.MemoryView":597
 *             return self.view.shape[0]
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":593
 *         return self._size
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         if self.view.ndim >= 1:
 *             return self.view.shape[0]
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":599
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "View.MemoryView":600
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":601
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "View.MemoryView":600
 * 
 *     def __repr__(self):
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,             # <<<<<<<<<<<<<<
 *                                                id(self))
 * 
 */
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":599
 *         return 0
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
 *                                                id(self))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":603
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "View.MemoryView":604
 * 
 *     def __str__(self):
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 604, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":603
 *                                                id(self))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":607
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_c_contig", 0);

  /* "View.MemoryView":610
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 */
  __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));

  /* "View.MemoryView":611
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def is_f_contig(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":607
 * 
 * 
 *     def is_c_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":613
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice *__pyx_v_mslice;
  __Pyx_memviewslice __pyx_v_tmp;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_f_contig", 0);

  /* "View.MemoryView":616
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)             # <<<<<<<<<<<<<<
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 */
  __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));

  /* "View.MemoryView":617
 *         cdef __Pyx_memviewslice tmp
 *         mslice = get_slice_from_memview(self, &tmp)
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":613
 *         return slice_is_contig(mslice[0], 'C', self.view.ndim)
 * 
 *     def is_f_contig(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice *mslice
 *         cdef __Pyx_memviewslice tmp
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":619
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_mslice;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "View.MemoryView":621
 *     def copy(self):
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &mslice)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));

  /* "View.MemoryView":623
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 * 
 *         slice_copy(self, &mslice)             # <<<<<<<<<<<<<<
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
 *                                    self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));

  /* "View.MemoryView":624
 * 
 *         slice_copy(self, &mslice)
 *         mslice = slice_copy_contig(&mslice, "c", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                    self.view.itemsize,
 *                                    flags|PyBUF_C_CONTIGUOUS,
 */
  __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, 624, __pyx_L1_error)
  __pyx_v_mslice = __pyx_t_1;

  /* "View.MemoryView":629
 *                                    self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &mslice)             # <<<<<<<<<<<<<<
 * 
 *     def copy_fortran(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":619
 *         return slice_is_contig(mslice[0], 'F', self.view.ndim)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice mslice
 *         cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":631
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  int __pyx_v_flags;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_memviewslice __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("copy_fortran", 0);

  /* "View.MemoryView":633
 *     def copy_fortran(self):
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS             # <<<<<<<<<<<<<<
 * 
 *         slice_copy(self, &src)
 */
  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));

  /* "View.MemoryView":635
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 * 
 *         slice_copy(self, &src)             # <<<<<<<<<<<<<<
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,
 *                                 self.view.itemsize,
 */
  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));

  /* "View.MemoryView":636
 * 
 *         slice_copy(self, &src)
 *         dst = slice_copy_contig(&src, "fortran", self.view.ndim,             # <<<<<<<<<<<<<<
 *                                 self.view.itemsize,
 *                                 flags|PyBUF_F_CONTIGUOUS,
 */
  __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, 636, __pyx_L1_error)
  __pyx_v_dst = __pyx_t_1;

  /* "View.MemoryView":641
 *                                 self.dtype_is_object)
 * 
 *         return memoryview_copy_from_slice(self, &dst)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":631
 *         return memoryview_copy_from_slice(self, &mslice)
 * 
 *     def copy_fortran(self):             # <<<<<<<<<<<<<<
 *         cdef __Pyx_memviewslice src, dst
 *         cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__297, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__298, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":645
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  struct __pyx_memoryview_obj *__pyx_v_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);

  /* "View.MemoryView":646
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)             # <<<<<<<<<<<<<<
 *     result.typeinfo = typeinfo
 *     return result
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_o);
  __Pyx_GIVEREF(__pyx_v_o);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":647
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo             # <<<<<<<<<<<<<<
 *     return result
 * 
 */
  __pyx_v_result->typeinfo = __pyx_v_typeinfo;

  /* "View.MemoryView":648
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_check')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":645
 * 
 * @cname('__pyx_memoryview_new')
 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):             # <<<<<<<<<<<<<<
 *     cdef memoryview result = memoryview(o, flags, dtype_is_object)
 *     result.typeinfo = typeinfo
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":651
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("memoryview_check", 0);

  /* "View.MemoryView":652
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):
 *     return isinstance(o, memoryview)             # <<<<<<<<<<<<<<
 * 
 * cdef tuple _unellipsify(object index, int ndim):
 */
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type); 
  __pyx_r = __pyx_t_1;
  goto __pyx_L0;

  /* "View.MemoryView":651
 * 
 * @cname('__pyx_memoryview_check')
 * cdef inline bint memoryview_check(object o):             # <<<<<<<<<<<<<<
 *     return isinstance(o, memoryview)
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":654
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  PyObject *__pyx_v_tup = NULL;
  PyObject *__pyx_v_result = NULL;
  int __pyx_v_have_slices;
  int __pyx_v_seen_ellipsis;
  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_item = NULL;
  Py_ssize_t __pyx_v_nslices;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("_unellipsify", 0);

  /* "View.MemoryView":659
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
  __pyx_t_1 = PyTuple_Check(__pyx_v_index); 
  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":660
 *     """
 *     if not isinstance(index, tuple):
 *         tup = (index,)             # <<<<<<<<<<<<<<
 *     else:
 *         tup = index
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_index);
    __Pyx_GIVEREF(__pyx_v_index);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
    __pyx_v_tup = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "View.MemoryView":659
 *     full slices.
 *     """
 *     if not isinstance(index, tuple):             # <<<<<<<<<<<<<<
 *         tup = (index,)
 *     else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":662
 *         tup = (index,)
 *     else:
 *         tup = index             # <<<<<<<<<<<<<<
 * 
 *     result = []
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_index);
    __pyx_v_tup = __pyx_v_index;
  }
  __pyx_L3:;

  /* "View.MemoryView":664
 *         tup = index
 * 
 *     result = []             # <<<<<<<<<<<<<<
 *     have_slices = False
 *     seen_ellipsis = False
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 664, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_result = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "View.MemoryView":665
 * 
 *     result = []
 *     have_slices = False             # <<<<<<<<<<<<<<
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 */
  __pyx_v_have_slices = 0;

  /* "View.MemoryView":666
 *     result = []
 *     have_slices = False
 *     seen_ellipsis = False             # <<<<<<<<<<<<<<
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 */
  __pyx_v_seen_ellipsis = 0;

  /* "View.MemoryView":667
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_3 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
    __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 667, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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, 667, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 667, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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, 667, __pyx_L1_error)
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 667, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 667, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
    __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 667, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "View.MemoryView":668
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
    __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":669
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
      __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
      if (__pyx_t_1) {

        /* "View.MemoryView":670
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
        __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 670, __pyx_L1_error)
        __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, 670, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        { Py_ssize_t __pyx_temp;
          for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
            __Pyx_INCREF(__pyx_slice__299);
            __Pyx_GIVEREF(__pyx_slice__299);
            PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__299);
          }
        }
        __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 670, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "View.MemoryView":671
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True             # <<<<<<<<<<<<<<
 *             else:
 *                 result.append(slice(None))
 */
        __pyx_v_seen_ellipsis = 1;

        /* "View.MemoryView":669
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:
 *             if not seen_ellipsis:             # <<<<<<<<<<<<<<
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 *                 seen_ellipsis = True
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":673
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
      /*else*/ {
        __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__300); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 673, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":674
 *             else:
 *                 result.append(slice(None))
 *             have_slices = True             # <<<<<<<<<<<<<<
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 */
      __pyx_v_have_slices = 1;

      /* "View.MemoryView":668
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):
 *         if item is Ellipsis:             # <<<<<<<<<<<<<<
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":676
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
    /*else*/ {
      __pyx_t_2 = PySlice_Check(__pyx_v_item); 
      __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
      if (__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
      __pyx_t_1 = __pyx_t_10;
      __pyx_L9_bool_binop_done:;
      if (__pyx_t_1) {

        /* "View.MemoryView":677
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):
 *                 raise TypeError("Cannot index with type '%s'" % type(item))             # <<<<<<<<<<<<<<
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 */
        __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 677, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_Raise(__pyx_t_7, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __PYX_ERR(2, 677, __pyx_L1_error)

        /* "View.MemoryView":676
 *             have_slices = True
 *         else:
 *             if not isinstance(item, slice) and not PyIndex_Check(item):             # <<<<<<<<<<<<<<
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 */
      }

      /* "View.MemoryView":679
 *                 raise TypeError("Cannot index with type '%s'" % type(item))
 * 
 *             have_slices = have_slices or isinstance(item, slice)             # <<<<<<<<<<<<<<
 *             result.append(item)
 * 
 */
      __pyx_t_10 = (__pyx_v_have_slices != 0);
      if (!__pyx_t_10) {
      } else {
        __pyx_t_1 = __pyx_t_10;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = PySlice_Check(__pyx_v_item); 
      __pyx_t_2 = (__pyx_t_10 != 0);
      __pyx_t_1 = __pyx_t_2;
      __pyx_L11_bool_binop_done:;
      __pyx_v_have_slices = __pyx_t_1;

      /* "View.MemoryView":680
 * 
 *             have_slices = have_slices or isinstance(item, slice)
 *             result.append(item)             # <<<<<<<<<<<<<<
 * 
 *     nslices = ndim - len(result)
 */
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 680, __pyx_L1_error)
    }
    __pyx_L6:;

    /* "View.MemoryView":667
 *     have_slices = False
 *     seen_ellipsis = False
 *     for idx, item in enumerate(tup):             # <<<<<<<<<<<<<<
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":682
 *             result.append(item)
 * 
 *     nslices = ndim - len(result)             # <<<<<<<<<<<<<<
 *     if nslices:
 *         result.extend([slice(None)] * nslices)
 */
  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);

  /* "View.MemoryView":683
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  __pyx_t_1 = (__pyx_v_nslices != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":684
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
    __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 684, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    { Py_ssize_t __pyx_temp;
      for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
        __Pyx_INCREF(__pyx_slice__301);
        __Pyx_GIVEREF(__pyx_slice__301);
        PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__301);
      }
    }
    __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "View.MemoryView":683
 * 
 *     nslices = ndim - len(result)
 *     if nslices:             # <<<<<<<<<<<<<<
 *         result.extend([slice(None)] * nslices)
 * 
 */
  }

  /* "View.MemoryView":686
 *         result.extend([slice(None)] * nslices)
 * 
 *     return have_slices or nslices, tuple(result)             # <<<<<<<<<<<<<<
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 */
  __Pyx_XDECREF(__pyx_r);
  if (!__pyx_v_have_slices) {
  } else {
    __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 686, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_L14_bool_binop_done:;
  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_4);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_r = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":654
 *     return isinstance(o, memoryview)
 * 
 * cdef tuple _unellipsify(object index, int ndim):             # <<<<<<<<<<<<<<
 *     """
 *     Replace all ellipses with full slices and fill incomplete indices with
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_tup);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_item);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":688
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  Py_ssize_t *__pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);

  /* "View.MemoryView":689
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")
 */
  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
    __pyx_t_1 = __pyx_t_3;
    __pyx_v_suboffset = (__pyx_t_1[0]);

    /* "View.MemoryView":690
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_4) {

      /* "View.MemoryView":691
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__302, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 691, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(2, 691, __pyx_L1_error)

      /* "View.MemoryView":690
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             raise ValueError("Indirect dimensions not supported")
 * 
 */
    }
  }

  /* "View.MemoryView":688
 *     return have_slices or nslices, tuple(result)
 * 
 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):             # <<<<<<<<<<<<<<
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":698
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  int __pyx_v_new_ndim;
  int __pyx_v_suboffset_dim;
  int __pyx_v_dim;
  __Pyx_memviewslice __pyx_v_src;
  __Pyx_memviewslice __pyx_v_dst;
  __Pyx_memviewslice *__pyx_v_p_src;
  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  __Pyx_memviewslice *__pyx_v_p_dst;
  int *__pyx_v_p_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;
  PyObject *__pyx_v_index = NULL;
  struct __pyx_memoryview_obj *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  struct __pyx_memoryview_obj *__pyx_t_4;
  char *__pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  __Pyx_RefNannySetupContext("memview_slice", 0);

  /* "View.MemoryView":699
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim             # <<<<<<<<<<<<<<
 *     cdef bint negative_step
 *     cdef __Pyx_memviewslice src, dst
 */
  __pyx_v_new_ndim = 0;
  __pyx_v_suboffset_dim = -1;

  /* "View.MemoryView":706
 * 
 * 
 *     memset(&dst, 0, sizeof(dst))             # <<<<<<<<<<<<<<
 * 
 *     cdef _memoryviewslice memviewsliceobj
 */
  memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)));

  /* "View.MemoryView":710
 *     cdef _memoryviewslice memviewsliceobj
 * 
 *     assert memview.view.ndim > 0             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(!Py_OptimizeFlag)) {
    if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
      PyErr_SetNone(PyExc_AssertionError);
      __PYX_ERR(2, 710, __pyx_L1_error)
    }
  }
  #endif

  /* "View.MemoryView":712
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":713
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview             # <<<<<<<<<<<<<<
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 713, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":714
 *     if isinstance(memview, _memoryviewslice):
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, &src)
 */
    __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);

    /* "View.MemoryView":712
 *     assert memview.view.ndim > 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         memviewsliceobj = memview
 *         p_src = &memviewsliceobj.from_slice
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":716
 *         p_src = &memviewsliceobj.from_slice
 *     else:
 *         slice_copy(memview, &src)             # <<<<<<<<<<<<<<
 *         p_src = &src
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));

    /* "View.MemoryView":717
 *     else:
 *         slice_copy(memview, &src)
 *         p_src = &src             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_p_src = (&__pyx_v_src);
  }
  __pyx_L3:;

  /* "View.MemoryView":723
 * 
 * 
 *     dst.memview = p_src.memview             # <<<<<<<<<<<<<<
 *     dst.data = p_src.data
 * 
 */
  __pyx_t_4 = __pyx_v_p_src->memview;
  __pyx_v_dst.memview = __pyx_t_4;

  /* "View.MemoryView":724
 * 
 *     dst.memview = p_src.memview
 *     dst.data = p_src.data             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_5 = __pyx_v_p_src->data;
  __pyx_v_dst.data = __pyx_t_5;

  /* "View.MemoryView":729
 * 
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst             # <<<<<<<<<<<<<<
 *     cdef int *p_suboffset_dim = &suboffset_dim
 *     cdef Py_ssize_t start, stop, step
 */
  __pyx_v_p_dst = (&__pyx_v_dst);

  /* "View.MemoryView":730
 * 
 *     cdef __Pyx_memviewslice *p_dst = &dst
 *     cdef int *p_suboffset_dim = &suboffset_dim             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t start, stop, step
 *     cdef bint have_start, have_stop, have_step
 */
  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);

  /* "View.MemoryView":734
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  __pyx_t_6 = 0;
  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
    __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 734, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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, 734, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 734, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      } else {
        if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __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, 734, __pyx_L1_error)
        #else
        __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 734, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        #endif
      }
    } else {
      __pyx_t_9 = __pyx_t_8(__pyx_t_3);
      if (unlikely(!__pyx_t_9)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(2, 734, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_v_dim = __pyx_t_6;
    __pyx_t_6 = (__pyx_t_6 + 1);

    /* "View.MemoryView":735
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
    __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":739
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 *                 index, 0, 0, # start, stop, step             # <<<<<<<<<<<<<<
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 */
      __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 739, __pyx_L1_error)

      /* "View.MemoryView":736
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __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, 736, __pyx_L1_error)

      /* "View.MemoryView":735
 * 
 *     for dim, index in enumerate(indices):
 *         if PyIndex_Check(index):             # <<<<<<<<<<<<<<
 *             slice_memviewslice(
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":742
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
    __pyx_t_2 = (__pyx_v_index == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":743
 *                 False)
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1             # <<<<<<<<<<<<<<
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 */
      (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;

      /* "View.MemoryView":744
 *         elif index is None:
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0             # <<<<<<<<<<<<<<
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1
 */
      (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;

      /* "View.MemoryView":745
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1             # <<<<<<<<<<<<<<
 *             new_ndim += 1
 *         else:
 */
      (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;

      /* "View.MemoryView":746
 *             p_dst.strides[new_ndim] = 0
 *             p_dst.suboffsets[new_ndim] = -1
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 *         else:
 *             start = index.start or 0
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);

      /* "View.MemoryView":742
 *                 0, 0, 0, # have_{start,stop,step}
 *                 False)
 *         elif index is None:             # <<<<<<<<<<<<<<
 *             p_dst.shape[new_ndim] = 1
 *             p_dst.strides[new_ndim] = 0
 */
      goto __pyx_L6;
    }

    /* "View.MemoryView":748
 *             new_ndim += 1
 *         else:
 *             start = index.start or 0             # <<<<<<<<<<<<<<
 *             stop = index.stop or 0
 *             step = index.step or 0
 */
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 748, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L7_bool_binop_done:;
      __pyx_v_start = __pyx_t_10;

      /* "View.MemoryView":749
 *         else:
 *             start = index.start or 0
 *             stop = index.stop or 0             # <<<<<<<<<<<<<<
 *             step = index.step or 0
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 749, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 749, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 749, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L9_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L9_bool_binop_done:;
      __pyx_v_stop = __pyx_t_10;

      /* "View.MemoryView":750
 *             start = index.start or 0
 *             stop = index.stop or 0
 *             step = index.step or 0             # <<<<<<<<<<<<<<
 * 
 *             have_start = index.start is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 750, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 750, __pyx_L1_error)
      if (!__pyx_t_1) {
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 750, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_12;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        goto __pyx_L11_bool_binop_done;
      }
      __pyx_t_10 = 0;
      __pyx_L11_bool_binop_done:;
      __pyx_v_step = __pyx_t_10;

      /* "View.MemoryView":752
 *             step = index.step or 0
 * 
 *             have_start = index.start is not None             # <<<<<<<<<<<<<<
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 752, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_start = __pyx_t_1;

      /* "View.MemoryView":753
 * 
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None             # <<<<<<<<<<<<<<
 *             have_step = index.step is not None
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 753, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_stop = __pyx_t_1;

      /* "View.MemoryView":754
 *             have_start = index.start is not None
 *             have_stop = index.stop is not None
 *             have_step = index.step is not None             # <<<<<<<<<<<<<<
 * 
 *             slice_memviewslice(
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_1 = (__pyx_t_9 != Py_None);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_v_have_step = __pyx_t_1;

      /* "View.MemoryView":756
 *             have_step = index.step is not None
 * 
 *             slice_memviewslice(             # <<<<<<<<<<<<<<
 *                 p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
 *                 dim, new_ndim, p_suboffset_dim,
 */
      __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, 756, __pyx_L1_error)

      /* "View.MemoryView":762
 *                 have_start, have_stop, have_step,
 *                 True)
 *             new_ndim += 1             # <<<<<<<<<<<<<<
 * 
 *     if isinstance(memview, _memoryviewslice):
 */
      __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
    }
    __pyx_L6:;

    /* "View.MemoryView":734
 *     cdef bint have_start, have_stop, have_step
 * 
 *     for dim, index in enumerate(indices):             # <<<<<<<<<<<<<<
 *         if PyIndex_Check(index):
 *             slice_memviewslice(
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "View.MemoryView":764
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":765
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":766
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_dtype_func,
 *                                     memview.dtype_is_object)
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 766, __pyx_L1_error) }

    /* "View.MemoryView":767
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 *     else:
 */
    if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 767, __pyx_L1_error) }

    /* "View.MemoryView":765
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         return memoryview_fromslice(dst, new_ndim,             # <<<<<<<<<<<<<<
 *                                     memviewsliceobj.to_object_func,
 *                                     memviewsliceobj.to_dtype_func,
 */
    __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, 765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 765, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":764
 *             new_ndim += 1
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         return memoryview_fromslice(dst, new_ndim,
 *                                     memviewsliceobj.to_object_func,
 */
  }

  /* "View.MemoryView":770
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
  /*else*/ {
    __Pyx_XDECREF(((PyObject *)__pyx_r));

    /* "View.MemoryView":771
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,
 *                                     memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __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, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);

    /* "View.MemoryView":770
 *                                     memview.dtype_is_object)
 *     else:
 *         return memoryview_fromslice(dst, new_ndim, NULL, NULL,             # <<<<<<<<<<<<<<
 *                                     memview.dtype_is_object)
 * 
 */
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 770, __pyx_L1_error)
    __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":698
 * 
 * @cname('__pyx_memview_slice')
 * cdef memoryview memview_slice(memoryview memview, object indices):             # <<<<<<<<<<<<<<
 *     cdef int new_ndim = 0, suboffset_dim = -1, dim
 *     cdef bint negative_step
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  __Pyx_XDECREF(__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":795
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

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) {
  Py_ssize_t __pyx_v_new_shape;
  int __pyx_v_negative_step;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":815
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":817
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    __pyx_t_1 = ((__pyx_v_start < 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":818
 * 
 *         if start < 0:
 *             start += shape             # <<<<<<<<<<<<<<
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 */
      __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

      /* "View.MemoryView":817
 *     if not is_slice:
 * 
 *         if start < 0:             # <<<<<<<<<<<<<<
 *             start += shape
 *         if not 0 <= start < shape:
 */
    }

    /* "View.MemoryView":819
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    __pyx_t_1 = (0 <= __pyx_v_start);
    if (__pyx_t_1) {
      __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
    }
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":820
 *             start += shape
 *         if not 0 <= start < shape:
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)             # <<<<<<<<<<<<<<
 *     else:
 * 
 */
      __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, 820, __pyx_L1_error)

      /* "View.MemoryView":819
 *         if start < 0:
 *             start += shape
 *         if not 0 <= start < shape:             # <<<<<<<<<<<<<<
 *             _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
 *     else:
 */
    }

    /* "View.MemoryView":815
 *     cdef bint negative_step
 * 
 *     if not is_slice:             # <<<<<<<<<<<<<<
 * 
 *         if start < 0:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":823
 *     else:
 * 
 *         negative_step = have_step != 0 and step < 0             # <<<<<<<<<<<<<<
 * 
 *         if have_step and step == 0:
 */
  /*else*/ {
    __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step < 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L6_bool_binop_done:;
    __pyx_v_negative_step = __pyx_t_2;

    /* "View.MemoryView":825
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    __pyx_t_1 = (__pyx_v_have_step != 0);
    if (__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_1 = ((__pyx_v_step == 0) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L9_bool_binop_done:;
    if (__pyx_t_2) {

      /* "View.MemoryView":826
 * 
 *         if have_step and step == 0:
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __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, 826, __pyx_L1_error)

      /* "View.MemoryView":825
 *         negative_step = have_step != 0 and step < 0
 * 
 *         if have_step and step == 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
 * 
 */
    }

    /* "View.MemoryView":829
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
    __pyx_t_2 = (__pyx_v_have_start != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":830
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
      __pyx_t_2 = ((__pyx_v_start < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":831
 *         if have_start:
 *             if start < 0:
 *                 start += shape             # <<<<<<<<<<<<<<
 *                 if start < 0:
 *                     start = 0
 */
        __pyx_v_start = (__pyx_v_start + __pyx_v_shape);

        /* "View.MemoryView":832
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        __pyx_t_2 = ((__pyx_v_start < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":833
 *                 start += shape
 *                 if start < 0:
 *                     start = 0             # <<<<<<<<<<<<<<
 *             elif start >= shape:
 *                 if negative_step:
 */
          __pyx_v_start = 0;

          /* "View.MemoryView":832
 *             if start < 0:
 *                 start += shape
 *                 if start < 0:             # <<<<<<<<<<<<<<
 *                     start = 0
 *             elif start >= shape:
 */
        }

        /* "View.MemoryView":830
 * 
 *         if have_start:
 *             if start < 0:             # <<<<<<<<<<<<<<
 *                 start += shape
 *                 if start < 0:
 */
        goto __pyx_L12;
      }

      /* "View.MemoryView":834
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":835
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
        __pyx_t_2 = (__pyx_v_negative_step != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":836
 *             elif start >= shape:
 *                 if negative_step:
 *                     start = shape - 1             # <<<<<<<<<<<<<<
 *                 else:
 *                     start = shape
 */
          __pyx_v_start = (__pyx_v_shape - 1);

          /* "View.MemoryView":835
 *                     start = 0
 *             elif start >= shape:
 *                 if negative_step:             # <<<<<<<<<<<<<<
 *                     start = shape - 1
 *                 else:
 */
          goto __pyx_L14;
        }

        /* "View.MemoryView":838
 *                     start = shape - 1
 *                 else:
 *                     start = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        /*else*/ {
          __pyx_v_start = __pyx_v_shape;
        }
        __pyx_L14:;

        /* "View.MemoryView":834
 *                 if start < 0:
 *                     start = 0
 *             elif start >= shape:             # <<<<<<<<<<<<<<
 *                 if negative_step:
 *                     start = shape - 1
 */
      }
      __pyx_L12:;

      /* "View.MemoryView":829
 * 
 * 
 *         if have_start:             # <<<<<<<<<<<<<<
 *             if start < 0:
 *                 start += shape
 */
      goto __pyx_L11;
    }

    /* "View.MemoryView":840
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":841
 *         else:
 *             if negative_step:
 *                 start = shape - 1             # <<<<<<<<<<<<<<
 *             else:
 *                 start = 0
 */
        __pyx_v_start = (__pyx_v_shape - 1);

        /* "View.MemoryView":840
 *                     start = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 start = shape - 1
 *             else:
 */
        goto __pyx_L15;
      }

      /* "View.MemoryView":843
 *                 start = shape - 1
 *             else:
 *                 start = 0             # <<<<<<<<<<<<<<
 * 
 *         if have_stop:
 */
      /*else*/ {
        __pyx_v_start = 0;
      }
      __pyx_L15:;
    }
    __pyx_L11:;

    /* "View.MemoryView":845
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
    __pyx_t_2 = (__pyx_v_have_stop != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":846
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
      __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":847
 *         if have_stop:
 *             if stop < 0:
 *                 stop += shape             # <<<<<<<<<<<<<<
 *                 if stop < 0:
 *                     stop = 0
 */
        __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);

        /* "View.MemoryView":848
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
        if (__pyx_t_2) {

          /* "View.MemoryView":849
 *                 stop += shape
 *                 if stop < 0:
 *                     stop = 0             # <<<<<<<<<<<<<<
 *             elif stop > shape:
 *                 stop = shape
 */
          __pyx_v_stop = 0;

          /* "View.MemoryView":848
 *             if stop < 0:
 *                 stop += shape
 *                 if stop < 0:             # <<<<<<<<<<<<<<
 *                     stop = 0
 *             elif stop > shape:
 */
        }

        /* "View.MemoryView":846
 * 
 *         if have_stop:
 *             if stop < 0:             # <<<<<<<<<<<<<<
 *                 stop += shape
 *                 if stop < 0:
 */
        goto __pyx_L17;
      }

      /* "View.MemoryView":850
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":851
 *                     stop = 0
 *             elif stop > shape:
 *                 stop = shape             # <<<<<<<<<<<<<<
 *         else:
 *             if negative_step:
 */
        __pyx_v_stop = __pyx_v_shape;

        /* "View.MemoryView":850
 *                 if stop < 0:
 *                     stop = 0
 *             elif stop > shape:             # <<<<<<<<<<<<<<
 *                 stop = shape
 *         else:
 */
      }
      __pyx_L17:;

      /* "View.MemoryView":845
 *                 start = 0
 * 
 *         if have_stop:             # <<<<<<<<<<<<<<
 *             if stop < 0:
 *                 stop += shape
 */
      goto __pyx_L16;
    }

    /* "View.MemoryView":853
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
    /*else*/ {
      __pyx_t_2 = (__pyx_v_negative_step != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":854
 *         else:
 *             if negative_step:
 *                 stop = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 stop = shape
 */
        __pyx_v_stop = -1L;

        /* "View.MemoryView":853
 *                 stop = shape
 *         else:
 *             if negative_step:             # <<<<<<<<<<<<<<
 *                 stop = -1
 *             else:
 */
        goto __pyx_L19;
      }

      /* "View.MemoryView":856
 *                 stop = -1
 *             else:
 *                 stop = shape             # <<<<<<<<<<<<<<
 * 
 *         if not have_step:
 */
      /*else*/ {
        __pyx_v_stop = __pyx_v_shape;
      }
      __pyx_L19:;
    }
    __pyx_L16:;

    /* "View.MemoryView":858
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":859
 * 
 *         if not have_step:
 *             step = 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_step = 1;

      /* "View.MemoryView":858
 *                 stop = shape
 * 
 *         if not have_step:             # <<<<<<<<<<<<<<
 *             step = 1
 * 
 */
    }

    /* "View.MemoryView":863
 * 
 *         with cython.cdivision(True):
 *             new_shape = (stop - start) // step             # <<<<<<<<<<<<<<
 * 
 *             if (stop - start) - step * new_shape:
 */
    __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);

    /* "View.MemoryView":865
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":866
 * 
 *             if (stop - start) - step * new_shape:
 *                 new_shape += 1             # <<<<<<<<<<<<<<
 * 
 *         if new_shape < 0:
 */
      __pyx_v_new_shape = (__pyx_v_new_shape + 1);

      /* "View.MemoryView":865
 *             new_shape = (stop - start) // step
 * 
 *             if (stop - start) - step * new_shape:             # <<<<<<<<<<<<<<
 *                 new_shape += 1
 * 
 */
    }

    /* "View.MemoryView":868
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":869
 * 
 *         if new_shape < 0:
 *             new_shape = 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_new_shape = 0;

      /* "View.MemoryView":868
 *                 new_shape += 1
 * 
 *         if new_shape < 0:             # <<<<<<<<<<<<<<
 *             new_shape = 0
 * 
 */
    }

    /* "View.MemoryView":872
 * 
 * 
 *         dst.strides[new_ndim] = stride * step             # <<<<<<<<<<<<<<
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset
 */
    (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);

    /* "View.MemoryView":873
 * 
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape             # <<<<<<<<<<<<<<
 *         dst.suboffsets[new_ndim] = suboffset
 * 
 */
    (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;

    /* "View.MemoryView":874
 *         dst.strides[new_ndim] = stride * step
 *         dst.shape[new_ndim] = new_shape
 *         dst.suboffsets[new_ndim] = suboffset             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  }
  __pyx_L3:;

  /* "View.MemoryView":877
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":878
 * 
 *     if suboffset_dim[0] < 0:
 *         dst.data += start * stride             # <<<<<<<<<<<<<<
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 */
    __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));

    /* "View.MemoryView":877
 * 
 * 
 *     if suboffset_dim[0] < 0:             # <<<<<<<<<<<<<<
 *         dst.data += start * stride
 *     else:
 */
    goto __pyx_L23;
  }

  /* "View.MemoryView":880
 *         dst.data += start * stride
 *     else:
 *         dst.suboffsets[suboffset_dim[0]] += start * stride             # <<<<<<<<<<<<<<
 * 
 *     if suboffset >= 0:
 */
  /*else*/ {
    __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
    (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  }
  __pyx_L23:;

  /* "View.MemoryView":882
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":883
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
    __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":884
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
      __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":885
 *         if not is_slice:
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 */
        __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);

        /* "View.MemoryView":884
 *     if suboffset >= 0:
 *         if not is_slice:
 *             if new_ndim == 0:             # <<<<<<<<<<<<<<
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 */
        goto __pyx_L26;
      }

      /* "View.MemoryView":887
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "             # <<<<<<<<<<<<<<
 *                                      "must be indexed and not sliced", dim)
 *         else:
 */
      /*else*/ {

        /* "View.MemoryView":888
 *             else:
 *                 _err_dim(IndexError, "All dimensions preceding dimension %d "
 *                                      "must be indexed and not sliced", dim)             # <<<<<<<<<<<<<<
 *         else:
 *             suboffset_dim[0] = new_ndim
 */
        __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, 887, __pyx_L1_error)
      }
      __pyx_L26:;

      /* "View.MemoryView":883
 * 
 *     if suboffset >= 0:
 *         if not is_slice:             # <<<<<<<<<<<<<<
 *             if new_ndim == 0:
 *                 dst.data = (<char **> dst.data)[0] + suboffset
 */
      goto __pyx_L25;
    }

    /* "View.MemoryView":890
 *                                      "must be indexed and not sliced", dim)
 *         else:
 *             suboffset_dim[0] = new_ndim             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
    /*else*/ {
      (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
    }
    __pyx_L25:;

    /* "View.MemoryView":882
 *         dst.suboffsets[suboffset_dim[0]] += start * stride
 * 
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         if not is_slice:
 *             if new_ndim == 0:
 */
  }

  /* "View.MemoryView":892
 *             suboffset_dim[0] = new_ndim
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":795
 * 
 * @cname('__pyx_memoryview_slice_memviewslice')
 * cdef int slice_memviewslice(             # <<<<<<<<<<<<<<
 *         __Pyx_memviewslice *dst,
 *         Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":898
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

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) {
  Py_ssize_t __pyx_v_shape;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_suboffset;
  Py_ssize_t __pyx_v_itemsize;
  char *__pyx_v_resultp;
  char *__pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("pybuffer_index", 0);

  /* "View.MemoryView":900
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t itemsize = view.itemsize
 *     cdef char *resultp
 */
  __pyx_v_suboffset = -1L;

  /* "View.MemoryView":901
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 *     cdef Py_ssize_t itemsize = view.itemsize             # <<<<<<<<<<<<<<
 *     cdef char *resultp
 * 
 */
  __pyx_t_1 = __pyx_v_view->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":904
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":905
 * 
 *     if view.ndim == 0:
 *         shape = view.len / itemsize             # <<<<<<<<<<<<<<
 *         stride = itemsize
 *     else:
 */
    if (unlikely(__pyx_v_itemsize == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(2, 905, __pyx_L1_error)
    }
    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))) {
      PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
      __PYX_ERR(2, 905, __pyx_L1_error)
    }
    __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);

    /* "View.MemoryView":906
 *     if view.ndim == 0:
 *         shape = view.len / itemsize
 *         stride = itemsize             # <<<<<<<<<<<<<<
 *     else:
 *         shape = view.shape[dim]
 */
    __pyx_v_stride = __pyx_v_itemsize;

    /* "View.MemoryView":904
 *     cdef char *resultp
 * 
 *     if view.ndim == 0:             # <<<<<<<<<<<<<<
 *         shape = view.len / itemsize
 *         stride = itemsize
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":908
 *         stride = itemsize
 *     else:
 *         shape = view.shape[dim]             # <<<<<<<<<<<<<<
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 */
  /*else*/ {
    __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);

    /* "View.MemoryView":909
 *     else:
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]             # <<<<<<<<<<<<<<
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]
 */
    __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);

    /* "View.MemoryView":910
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":911
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:
 *             suboffset = view.suboffsets[dim]             # <<<<<<<<<<<<<<
 * 
 *     if index < 0:
 */
      __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);

      /* "View.MemoryView":910
 *         shape = view.shape[dim]
 *         stride = view.strides[dim]
 *         if view.suboffsets != NULL:             # <<<<<<<<<<<<<<
 *             suboffset = view.suboffsets[dim]
 * 
 */
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":913
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":914
 * 
 *     if index < 0:
 *         index += view.shape[dim]             # <<<<<<<<<<<<<<
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 */
    __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));

    /* "View.MemoryView":915
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    __pyx_t_2 = ((__pyx_v_index < 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":916
 *         index += view.shape[dim]
 *         if index < 0:
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     if index >= shape:
 */
      __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __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, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 916, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(2, 916, __pyx_L1_error)

      /* "View.MemoryView":915
 *     if index < 0:
 *         index += view.shape[dim]
 *         if index < 0:             # <<<<<<<<<<<<<<
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
    }

    /* "View.MemoryView":913
 *             suboffset = view.suboffsets[dim]
 * 
 *     if index < 0:             # <<<<<<<<<<<<<<
 *         index += view.shape[dim]
 *         if index < 0:
 */
  }

  /* "View.MemoryView":918
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":919
 * 
 *     if index >= shape:
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)             # <<<<<<<<<<<<<<
 * 
 *     resultp = bufp + index * stride
 */
    __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 919, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 919, __pyx_L1_error)

    /* "View.MemoryView":918
 *             raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     if index >= shape:             # <<<<<<<<<<<<<<
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 */
  }

  /* "View.MemoryView":921
 *         raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
 * 
 *     resultp = bufp + index * stride             # <<<<<<<<<<<<<<
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset
 */
  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));

  /* "View.MemoryView":922
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":923
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:
 *         resultp = (<char **> resultp)[0] + suboffset             # <<<<<<<<<<<<<<
 * 
 *     return resultp
 */
    __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);

    /* "View.MemoryView":922
 * 
 *     resultp = bufp + index * stride
 *     if suboffset >= 0:             # <<<<<<<<<<<<<<
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 */
  }

  /* "View.MemoryView":925
 *         resultp = (<char **> resultp)[0] + suboffset
 * 
 *     return resultp             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_resultp;
  goto __pyx_L0;

  /* "View.MemoryView":898
 * 
 * @cname('__pyx_pybuffer_index')
 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,             # <<<<<<<<<<<<<<
 *                           Py_ssize_t dim) except NULL:
 *     cdef Py_ssize_t shape, stride, suboffset = -1
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":931
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  int __pyx_v_ndim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_r;
  int __pyx_t_1;
  Py_ssize_t *__pyx_t_2;
  long __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;

  /* "View.MemoryView":932
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
 *     cdef int ndim = memslice.memview.view.ndim             # <<<<<<<<<<<<<<
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 */
  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  __pyx_v_ndim = __pyx_t_1;

  /* "View.MemoryView":934
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 *     cdef Py_ssize_t *shape = memslice.shape             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t *strides = memslice.strides
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->shape;
  __pyx_v_shape = __pyx_t_2;

  /* "View.MemoryView":935
 * 
 *     cdef Py_ssize_t *shape = memslice.shape
 *     cdef Py_ssize_t *strides = memslice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __pyx_v_memslice->strides;
  __pyx_v_strides = __pyx_t_2;

  /* "View.MemoryView":939
 * 
 *     cdef int i, j
 *     for i in range(ndim / 2):             # <<<<<<<<<<<<<<
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 */
  __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_3; __pyx_t_1+=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":940
 *     cdef int i, j
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i             # <<<<<<<<<<<<<<
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]
 */
    __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);

    /* "View.MemoryView":941
 *     for i in range(ndim / 2):
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]             # <<<<<<<<<<<<<<
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 */
    __pyx_t_4 = (__pyx_v_strides[__pyx_v_j]);
    __pyx_t_5 = (__pyx_v_strides[__pyx_v_i]);
    (__pyx_v_strides[__pyx_v_i]) = __pyx_t_4;
    (__pyx_v_strides[__pyx_v_j]) = __pyx_t_5;

    /* "View.MemoryView":942
 *         j = ndim - 1 - i
 *         strides[i], strides[j] = strides[j], strides[i]
 *         shape[i], shape[j] = shape[j], shape[i]             # <<<<<<<<<<<<<<
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 */
    __pyx_t_5 = (__pyx_v_shape[__pyx_v_j]);
    __pyx_t_4 = (__pyx_v_shape[__pyx_v_i]);
    (__pyx_v_shape[__pyx_v_i]) = __pyx_t_5;
    (__pyx_v_shape[__pyx_v_j]) = __pyx_t_4;

    /* "View.MemoryView":944
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
    if (!__pyx_t_7) {
    } else {
      __pyx_t_6 = __pyx_t_7;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_7 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
    __pyx_t_6 = __pyx_t_7;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_6) {

      /* "View.MemoryView":945
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")             # <<<<<<<<<<<<<<
 * 
 *     return 1
 */
      __pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(2, 945, __pyx_L1_error)

      /* "View.MemoryView":944
 *         shape[i], shape[j] = shape[j], shape[i]
 * 
 *         if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:             # <<<<<<<<<<<<<<
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 */
    }
  }

  /* "View.MemoryView":947
 *             _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
 * 
 *     return 1             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 1;
  goto __pyx_L0;

  /* "View.MemoryView":931
 * 
 * @cname('__pyx_memslice_transpose')
 * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:             # <<<<<<<<<<<<<<
 *     cdef int ndim = memslice.memview.view.ndim
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":964
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "View.MemoryView":965
 * 
 *     def __dealloc__(self):
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)             # <<<<<<<<<<<<<<
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 */
  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);

  /* "View.MemoryView":964
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":967
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("convert_item_to_object", 0);

  /* "View.MemoryView":968
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":969
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)             # <<<<<<<<<<<<<<
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 969, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "View.MemoryView":968
 * 
 *     cdef convert_item_to_object(self, char *itemp):
 *         if self.to_object_func != NULL:             # <<<<<<<<<<<<<<
 *             return self.to_object_func(itemp)
 *         else:
 */
  }

  /* "View.MemoryView":971
 *             return self.to_object_func(itemp)
 *         else:
 *             return memoryview.convert_item_to_object(self, itemp)             # <<<<<<<<<<<<<<
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __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, 971, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }

  /* "View.MemoryView":967
 *         __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
 * 
 *     cdef convert_item_to_object(self, char *itemp):             # <<<<<<<<<<<<<<
 *         if self.to_object_func != NULL:
 *             return self.to_object_func(itemp)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":973
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("assign_item_from_object", 0);

  /* "View.MemoryView":974
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":975
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)             # <<<<<<<<<<<<<<
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)
 */
    __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, 975, __pyx_L1_error)

    /* "View.MemoryView":974
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):
 *         if self.to_dtype_func != NULL:             # <<<<<<<<<<<<<<
 *             self.to_dtype_func(itemp, value)
 *         else:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":977
 *             self.to_dtype_func(itemp, value)
 *         else:
 *             memoryview.assign_item_from_object(self, itemp, value)             # <<<<<<<<<<<<<<
 * 
 *     @property
 */
  /*else*/ {
    __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, 977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "View.MemoryView":973
 *             return memoryview.convert_item_to_object(self, itemp)
 * 
 *     cdef assign_item_from_object(self, char *itemp, object value):             # <<<<<<<<<<<<<<
 *         if self.to_dtype_func != NULL:
 *             self.to_dtype_func(itemp, value)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":980
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);

  /* "View.MemoryView":981
 *     @property
 *     def base(self):
 *         return self.from_object             # <<<<<<<<<<<<<<
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->from_object);
  __pyx_r = __pyx_v_self->from_object;
  goto __pyx_L0;

  /* "View.MemoryView":980
 * 
 *     @property
 *     def base(self):             # <<<<<<<<<<<<<<
 *         return self.from_object
 * 
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__303, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__304, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":987
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

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) {
  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  Py_ssize_t __pyx_v_suboffset;
  PyObject *__pyx_v_length = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_TypeInfo *__pyx_t_4;
  Py_buffer __pyx_t_5;
  Py_ssize_t *__pyx_t_6;
  Py_ssize_t *__pyx_t_7;
  Py_ssize_t *__pyx_t_8;
  Py_ssize_t __pyx_t_9;
  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);

  /* "View.MemoryView":995
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":996
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "View.MemoryView":995
 *     cdef _memoryviewslice result
 * 
 *     if <PyObject *> memviewslice.memview == Py_None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "View.MemoryView":1001
 * 
 * 
 *     result = _memoryviewslice(None, 0, dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 *     result.from_slice = memviewslice
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1001, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "View.MemoryView":1003
 *     result = _memoryviewslice(None, 0, dtype_is_object)
 * 
 *     result.from_slice = memviewslice             # <<<<<<<<<<<<<<
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 */
  __pyx_v_result->from_slice = __pyx_v_memviewslice;

  /* "View.MemoryView":1004
 * 
 *     result.from_slice = memviewslice
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)             # <<<<<<<<<<<<<<
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 */
  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);

  /* "View.MemoryView":1006
 *     __PYX_INC_MEMVIEW(&memviewslice, 1)
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base             # <<<<<<<<<<<<<<
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1006, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_result->from_object);
  __Pyx_DECREF(__pyx_v_result->from_object);
  __pyx_v_result->from_object = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "View.MemoryView":1007
 * 
 *     result.from_object = (<memoryview> memviewslice.memview).base
 *     result.typeinfo = memviewslice.memview.typeinfo             # <<<<<<<<<<<<<<
 * 
 *     result.view = memviewslice.memview.view
 */
  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;

  /* "View.MemoryView":1009
 *     result.typeinfo = memviewslice.memview.typeinfo
 * 
 *     result.view = memviewslice.memview.view             # <<<<<<<<<<<<<<
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 */
  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  __pyx_v_result->__pyx_base.view = __pyx_t_5;

  /* "View.MemoryView":1010
 * 
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data             # <<<<<<<<<<<<<<
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 */
  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);

  /* "View.MemoryView":1011
 *     result.view = memviewslice.memview.view
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim             # <<<<<<<<<<<<<<
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)
 */
  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;

  /* "View.MemoryView":1012
 *     result.view.buf = <void *> memviewslice.data
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None             # <<<<<<<<<<<<<<
 *     Py_INCREF(Py_None)
 * 
 */
  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;

  /* "View.MemoryView":1013
 *     result.view.ndim = ndim
 *     (<__pyx_buffer *> &result.view).obj = Py_None
 *     Py_INCREF(Py_None)             # <<<<<<<<<<<<<<
 * 
 *     result.flags = PyBUF_RECORDS
 */
  Py_INCREF(Py_None);

  /* "View.MemoryView":1015
 *     Py_INCREF(Py_None)
 * 
 *     result.flags = PyBUF_RECORDS             # <<<<<<<<<<<<<<
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 */
  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;

  /* "View.MemoryView":1017
 *     result.flags = PyBUF_RECORDS
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape             # <<<<<<<<<<<<<<
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides
 * 
 */
  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);

  /* "View.MemoryView":1018
 * 
 *     result.view.shape = <Py_ssize_t *> result.from_slice.shape
 *     result.view.strides = <Py_ssize_t *> result.from_slice.strides             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);

  /* "View.MemoryView":1021
 * 
 * 
 *     result.view.suboffsets = NULL             # <<<<<<<<<<<<<<
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 */
  __pyx_v_result->__pyx_base.view.suboffsets = NULL;

  /* "View.MemoryView":1022
 * 
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:             # <<<<<<<<<<<<<<
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 */
  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_v_suboffset = (__pyx_t_6[0]);

    /* "View.MemoryView":1023
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
    if (__pyx_t_1) {

      /* "View.MemoryView":1024
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);

      /* "View.MemoryView":1025
 *         if suboffset >= 0:
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break             # <<<<<<<<<<<<<<
 * 
 *     result.view.len = result.view.itemsize
 */
      goto __pyx_L5_break;

      /* "View.MemoryView":1023
 *     result.view.suboffsets = NULL
 *     for suboffset in result.from_slice.suboffsets[:ndim]:
 *         if suboffset >= 0:             # <<<<<<<<<<<<<<
 *             result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
 *             break
 */
    }
  }
  __pyx_L5_break:;

  /* "View.MemoryView":1027
 *             break
 * 
 *     result.view.len = result.view.itemsize             # <<<<<<<<<<<<<<
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length
 */
  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;

  /* "View.MemoryView":1028
 * 
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:             # <<<<<<<<<<<<<<
 *         result.view.len *= length
 * 
 */
  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
    __pyx_t_6 = __pyx_t_8;
    __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1028, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "View.MemoryView":1029
 *     result.view.len = result.view.itemsize
 *     for length in result.view.shape[:ndim]:
 *         result.view.len *= length             # <<<<<<<<<<<<<<
 * 
 *     result.to_object_func = to_object_func
 */
    __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1029, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  }

  /* "View.MemoryView":1031
 *         result.view.len *= length
 * 
 *     result.to_object_func = to_object_func             # <<<<<<<<<<<<<<
 *     result.to_dtype_func = to_dtype_func
 * 
 */
  __pyx_v_result->to_object_func = __pyx_v_to_object_func;

  /* "View.MemoryView":1032
 * 
 *     result.to_object_func = to_object_func
 *     result.to_dtype_func = to_dtype_func             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;

  /* "View.MemoryView":1034
 *     result.to_dtype_func = to_dtype_func
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_result));
  __pyx_r = ((PyObject *)__pyx_v_result);
  goto __pyx_L0;

  /* "View.MemoryView":987
 * 
 * @cname('__pyx_memoryview_fromslice')
 * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice,             # <<<<<<<<<<<<<<
 *                           int ndim,
 *                           object (*to_object_func)(char *),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_length);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1037
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 */

static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  __Pyx_memviewslice *__pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);

  /* "View.MemoryView":1040
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1041
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview             # <<<<<<<<<<<<<<
 *         return &obj.from_slice
 *     else:
 */
    if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1041, __pyx_L1_error)
    __pyx_t_3 = ((PyObject *)__pyx_v_memview);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "View.MemoryView":1042
 *     if isinstance(memview, _memoryviewslice):
 *         obj = memview
 *         return &obj.from_slice             # <<<<<<<<<<<<<<
 *     else:
 *         slice_copy(memview, mslice)
 */
    __pyx_r = (&__pyx_v_obj->from_slice);
    goto __pyx_L0;

    /* "View.MemoryView":1040
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         obj = memview
 *         return &obj.from_slice
 */
  }

  /* "View.MemoryView":1044
 *         return &obj.from_slice
 *     else:
 *         slice_copy(memview, mslice)             # <<<<<<<<<<<<<<
 *         return mslice
 * 
 */
  /*else*/ {
    __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);

    /* "View.MemoryView":1045
 *     else:
 *         slice_copy(memview, mslice)
 *         return mslice             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_slice_copy')
 */
    __pyx_r = __pyx_v_mslice;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1037
 * 
 * @cname('__pyx_memoryview_get_slice_from_memoryview')
 * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview,             # <<<<<<<<<<<<<<
 *                                                    __Pyx_memviewslice *mslice):
 *     cdef _memoryviewslice obj
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1048
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  int __pyx_v_dim;
  Py_ssize_t *__pyx_v_shape;
  Py_ssize_t *__pyx_v_strides;
  Py_ssize_t *__pyx_v_suboffsets;
  __Pyx_RefNannyDeclarations
  Py_ssize_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  __Pyx_RefNannySetupContext("slice_copy", 0);

  /* "View.MemoryView":1052
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 * 
 *     shape = memview.view.shape             # <<<<<<<<<<<<<<
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets
 */
  __pyx_t_1 = __pyx_v_memview->view.shape;
  __pyx_v_shape = __pyx_t_1;

  /* "View.MemoryView":1053
 * 
 *     shape = memview.view.shape
 *     strides = memview.view.strides             # <<<<<<<<<<<<<<
 *     suboffsets = memview.view.suboffsets
 * 
 */
  __pyx_t_1 = __pyx_v_memview->view.strides;
  __pyx_v_strides = __pyx_t_1;

  /* "View.MemoryView":1054
 *     shape = memview.view.shape
 *     strides = memview.view.strides
 *     suboffsets = memview.view.suboffsets             # <<<<<<<<<<<<<<
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 */
  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  __pyx_v_suboffsets = __pyx_t_1;

  /* "View.MemoryView":1056
 *     suboffsets = memview.view.suboffsets
 * 
 *     dst.memview = <__pyx_memoryview *> memview             # <<<<<<<<<<<<<<
 *     dst.data = <char *> memview.view.buf
 * 
 */
  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);

  /* "View.MemoryView":1057
 * 
 *     dst.memview = <__pyx_memoryview *> memview
 *     dst.data = <char *> memview.view.buf             # <<<<<<<<<<<<<<
 * 
 *     for dim in range(memview.view.ndim):
 */
  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);

  /* "View.MemoryView":1059
 *     dst.data = <char *> memview.view.buf
 * 
 *     for dim in range(memview.view.ndim):             # <<<<<<<<<<<<<<
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 */
  __pyx_t_2 = __pyx_v_memview->view.ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_dim = __pyx_t_3;

    /* "View.MemoryView":1060
 * 
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]             # <<<<<<<<<<<<<<
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 */
    (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);

    /* "View.MemoryView":1061
 *     for dim in range(memview.view.ndim):
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]             # <<<<<<<<<<<<<<
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
 * 
 */
    (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);

    /* "View.MemoryView":1062
 *         dst.shape[dim] = shape[dim]
 *         dst.strides[dim] = strides[dim]
 *         dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object')
 */
    if ((__pyx_v_suboffsets != 0)) {
      __pyx_t_4 = (__pyx_v_suboffsets[__pyx_v_dim]);
    } else {
      __pyx_t_4 = -1L;
    }
    (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_4;
  }

  /* "View.MemoryView":1048
 * 
 * @cname('__pyx_memoryview_slice_copy')
 * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst):             # <<<<<<<<<<<<<<
 *     cdef int dim
 *     cdef (Py_ssize_t*) shape, strides, suboffsets
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1065
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  __Pyx_memviewslice __pyx_v_memviewslice;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("memoryview_copy", 0);

  /* "View.MemoryView":1068
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)             # <<<<<<<<<<<<<<
 *     return memoryview_copy_from_slice(memview, &memviewslice)
 * 
 */
  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));

  /* "View.MemoryView":1069
 *     cdef __Pyx_memviewslice memviewslice
 *     slice_copy(memview, &memviewslice)
 *     return memoryview_copy_from_slice(memview, &memviewslice)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1069, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1065
 * 
 * @cname('__pyx_memoryview_copy_object')
 * cdef memoryview_copy(memoryview memview):             # <<<<<<<<<<<<<<
 *     "Create a new memoryview object"
 *     cdef __Pyx_memviewslice memviewslice
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1072
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  PyObject *(*__pyx_v_to_object_func)(char *);
  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *(*__pyx_t_3)(char *);
  int (*__pyx_t_4)(char *, PyObject *);
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);

  /* "View.MemoryView":1079
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1080
 * 
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func             # <<<<<<<<<<<<<<
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 */
    __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
    __pyx_v_to_object_func = __pyx_t_3;

    /* "View.MemoryView":1081
 *     if isinstance(memview, _memoryviewslice):
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func             # <<<<<<<<<<<<<<
 *     else:
 *         to_object_func = NULL
 */
    __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
    __pyx_v_to_dtype_func = __pyx_t_4;

    /* "View.MemoryView":1079
 *     cdef int (*to_dtype_func)(char *, object) except 0
 * 
 *     if isinstance(memview, _memoryviewslice):             # <<<<<<<<<<<<<<
 *         to_object_func = (<_memoryviewslice> memview).to_object_func
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1083
 *         to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
 *     else:
 *         to_object_func = NULL             # <<<<<<<<<<<<<<
 *         to_dtype_func = NULL
 * 
 */
  /*else*/ {
    __pyx_v_to_object_func = NULL;

    /* "View.MemoryView":1084
 *     else:
 *         to_object_func = NULL
 *         to_dtype_func = NULL             # <<<<<<<<<<<<<<
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 */
    __pyx_v_to_dtype_func = NULL;
  }
  __pyx_L3:;

  /* "View.MemoryView":1086
 *         to_dtype_func = NULL
 * 
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,             # <<<<<<<<<<<<<<
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)
 */
  __Pyx_XDECREF(__pyx_r);

  /* "View.MemoryView":1088
 *     return memoryview_fromslice(memviewslice[0], memview.view.ndim,
 *                                 to_object_func, to_dtype_func,
 *                                 memview.dtype_is_object)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __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, 1086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1072
 * 
 * @cname('__pyx_memoryview_copy_object_from_slice')
 * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice):             # <<<<<<<<<<<<<<
 *     """
 *     Create a new memoryview object from a given memoryview object and slice.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "View.MemoryView":1094
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  Py_ssize_t __pyx_r;
  int __pyx_t_1;

  /* "View.MemoryView":1095
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1096
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:
 *         return -arg             # <<<<<<<<<<<<<<
 *     else:
 *         return arg
 */
    __pyx_r = (-__pyx_v_arg);
    goto __pyx_L0;

    /* "View.MemoryView":1095
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
 *     if arg < 0:             # <<<<<<<<<<<<<<
 *         return -arg
 *     else:
 */
  }

  /* "View.MemoryView":1098
 *         return -arg
 *     else:
 *         return arg             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_get_best_slice_order')
 */
  /*else*/ {
    __pyx_r = __pyx_v_arg;
    goto __pyx_L0;
  }

  /* "View.MemoryView":1094
 * 
 * 
 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:             # <<<<<<<<<<<<<<
 *     if arg < 0:
 *         return -arg
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1101
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_c_stride;
  Py_ssize_t __pyx_v_f_stride;
  char __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1106
 *     """
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t f_stride = 0
 * 
 */
  __pyx_v_c_stride = 0;

  /* "View.MemoryView":1107
 *     cdef int i
 *     cdef Py_ssize_t c_stride = 0
 *     cdef Py_ssize_t f_stride = 0             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_f_stride = 0;

  /* "View.MemoryView":1109
 *     cdef Py_ssize_t f_stride = 0
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1L; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1110
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1111
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1112
 *         if mslice.shape[i] > 1:
 *             c_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
      goto __pyx_L4_break;

      /* "View.MemoryView":1110
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             c_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L4_break:;

  /* "View.MemoryView":1114
 *             break
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 */
  __pyx_t_1 = __pyx_v_ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1115
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1116
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]             # <<<<<<<<<<<<<<
 *             break
 * 
 */
      __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);

      /* "View.MemoryView":1117
 *         if mslice.shape[i] > 1:
 *             f_stride = mslice.strides[i]
 *             break             # <<<<<<<<<<<<<<
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 */
      goto __pyx_L7_break;

      /* "View.MemoryView":1115
 * 
 *     for i in range(ndim):
 *         if mslice.shape[i] > 1:             # <<<<<<<<<<<<<<
 *             f_stride = mslice.strides[i]
 *             break
 */
    }
  }
  __pyx_L7_break:;

  /* "View.MemoryView":1119
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1120
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
 *         return 'C'             # <<<<<<<<<<<<<<
 *     else:
 *         return 'F'
 */
    __pyx_r = 'C';
    goto __pyx_L0;

    /* "View.MemoryView":1119
 *             break
 * 
 *     if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):             # <<<<<<<<<<<<<<
 *         return 'C'
 *     else:
 */
  }

  /* "View.MemoryView":1122
 *         return 'C'
 *     else:
 *         return 'F'             # <<<<<<<<<<<<<<
 * 
 * @cython.cdivision(True)
 */
  /*else*/ {
    __pyx_r = 'F';
    goto __pyx_L0;
  }

  /* "View.MemoryView":1101
 * 
 * @cname('__pyx_get_best_slice_order')
 * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     """
 *     Figure out the best memory access order for a given slice.
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1125
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

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) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  Py_ssize_t __pyx_v_dst_extent;
  Py_ssize_t __pyx_v_src_stride;
  Py_ssize_t __pyx_v_dst_stride;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  Py_ssize_t __pyx_t_5;

  /* "View.MemoryView":1132
 * 
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 */
  __pyx_v_src_extent = (__pyx_v_src_shape[0]);

  /* "View.MemoryView":1133
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 */
  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);

  /* "View.MemoryView":1134
 *     cdef Py_ssize_t src_extent = src_shape[0]
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 */
  __pyx_v_src_stride = (__pyx_v_src_strides[0]);

  /* "View.MemoryView":1135
 *     cdef Py_ssize_t dst_extent = dst_shape[0]
 *     cdef Py_ssize_t src_stride = src_strides[0]
 *     cdef Py_ssize_t dst_stride = dst_strides[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);

  /* "View.MemoryView":1137
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1138
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L5_bool_binop_done;
    }

    /* "View.MemoryView":1139
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):             # <<<<<<<<<<<<<<
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 */
    __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
    if (__pyx_t_2) {
      __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
    }
    __pyx_t_3 = (__pyx_t_2 != 0);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;

    /* "View.MemoryView":1138
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
    if (__pyx_t_1) {

      /* "View.MemoryView":1140
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)             # <<<<<<<<<<<<<<
 *        else:
 *            for i in range(dst_extent):
 */
      memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent));

      /* "View.MemoryView":1138
 * 
 *     if ndim == 1:
 *        if (src_stride > 0 and dst_stride > 0 and             # <<<<<<<<<<<<<<
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 */
      goto __pyx_L4;
    }

    /* "View.MemoryView":1142
 *            memcpy(dst_data, src_data, itemsize * dst_extent)
 *        else:
 *            for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 */
    /*else*/ {
      __pyx_t_4 = __pyx_v_dst_extent;
      for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
        __pyx_v_i = __pyx_t_5;

        /* "View.MemoryView":1143
 *        else:
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)             # <<<<<<<<<<<<<<
 *                src_data += src_stride
 *                dst_data += dst_stride
 */
        memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize);

        /* "View.MemoryView":1144
 *            for i in range(dst_extent):
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride             # <<<<<<<<<<<<<<
 *                dst_data += dst_stride
 *     else:
 */
        __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

        /* "View.MemoryView":1145
 *                memcpy(dst_data, src_data, itemsize)
 *                src_data += src_stride
 *                dst_data += dst_stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(dst_extent):
 */
        __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
      }
    }
    __pyx_L4:;

    /* "View.MemoryView":1137
 *     cdef Py_ssize_t dst_stride = dst_strides[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *        if (src_stride > 0 and dst_stride > 0 and
 *            <size_t> src_stride == itemsize == <size_t> dst_stride):
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1147
 *                dst_data += dst_stride
 *     else:
 *         for i in range(dst_extent):             # <<<<<<<<<<<<<<
 *             _copy_strided_to_strided(src_data, src_strides + 1,
 *                                      dst_data, dst_strides + 1,
 */
  /*else*/ {
    __pyx_t_4 = __pyx_v_dst_extent;
    for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
      __pyx_v_i = __pyx_t_5;

      /* "View.MemoryView":1148
 *     else:
 *         for i in range(dst_extent):
 *             _copy_strided_to_strided(src_data, src_strides + 1,             # <<<<<<<<<<<<<<
 *                                      dst_data, dst_strides + 1,
 *                                      src_shape + 1, dst_shape + 1,
 */
      _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);

      /* "View.MemoryView":1152
 *                                      src_shape + 1, dst_shape + 1,
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride             # <<<<<<<<<<<<<<
 *             dst_data += dst_stride
 * 
 */
      __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);

      /* "View.MemoryView":1153
 *                                      ndim - 1, itemsize)
 *             src_data += src_stride
 *             dst_data += dst_stride             # <<<<<<<<<<<<<<
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
 */
      __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1125
 * 
 * @cython.cdivision(True)
 * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides,             # <<<<<<<<<<<<<<
 *                                    char *dst_data, Py_ssize_t *dst_strides,
 *                                    Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
 */

  /* function exit code */
}

/* "View.MemoryView":1155
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

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) {

  /* "View.MemoryView":1158
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 *     _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,             # <<<<<<<<<<<<<<
 *                              src.shape, dst.shape, ndim, itemsize)
 * 
 */
  _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);

  /* "View.MemoryView":1155
 *             dst_data += dst_stride
 * 
 * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice *dst,
 *                                   int ndim, size_t itemsize) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1162
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 */

static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  int __pyx_v_i;
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1165
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 *     cdef Py_ssize_t size = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_size = __pyx_t_1;

  /* "View.MemoryView":1167
 *     cdef Py_ssize_t size = src.memview.view.itemsize
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         size *= src.shape[i]
 * 
 */
  __pyx_t_2 = __pyx_v_ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1168
 * 
 *     for i in range(ndim):
 *         size *= src.shape[i]             # <<<<<<<<<<<<<<
 * 
 *     return size
 */
    __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
  }

  /* "View.MemoryView":1170
 *         size *= src.shape[i]
 * 
 *     return size             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_fill_contig_strides_array')
 */
  __pyx_r = __pyx_v_size;
  goto __pyx_L0;

  /* "View.MemoryView":1162
 * 
 * @cname('__pyx_memoryview_slice_get_size')
 * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:             # <<<<<<<<<<<<<<
 *     "Return the size of the memory occupied by the slice in number of bytes"
 *     cdef int i
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1173
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

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) {
  int __pyx_v_idx;
  Py_ssize_t __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;

  /* "View.MemoryView":1182
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1183
 * 
 *     if order == 'F':
 *         for idx in range(ndim):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride = stride * shape[idx]
 */
    __pyx_t_2 = __pyx_v_ndim;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_idx = __pyx_t_3;

      /* "View.MemoryView":1184
 *     if order == 'F':
 *         for idx in range(ndim):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride = stride * shape[idx]
 *     else:
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1185
 *         for idx in range(ndim):
 *             strides[idx] = stride
 *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }

    /* "View.MemoryView":1182
 *     cdef int idx
 * 
 *     if order == 'F':             # <<<<<<<<<<<<<<
 *         for idx in range(ndim):
 *             strides[idx] = stride
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1187
 *             stride = stride * shape[idx]
 *     else:
 *         for idx in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *             strides[idx] = stride
 *             stride = stride * shape[idx]
 */
  /*else*/ {
    for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1L; __pyx_t_2-=1) {
      __pyx_v_idx = __pyx_t_2;

      /* "View.MemoryView":1188
 *     else:
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride             # <<<<<<<<<<<<<<
 *             stride = stride * shape[idx]
 * 
 */
      (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;

      /* "View.MemoryView":1189
 *         for idx in range(ndim - 1, -1, -1):
 *             strides[idx] = stride
 *             stride = stride * shape[idx]             # <<<<<<<<<<<<<<
 * 
 *     return stride
 */
      __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1191
 *             stride = stride * shape[idx]
 * 
 *     return stride             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 */
  __pyx_r = __pyx_v_stride;
  goto __pyx_L0;

  /* "View.MemoryView":1173
 * 
 * @cname('__pyx_fill_contig_strides_array')
 * cdef Py_ssize_t fill_contig_strides_array(             # <<<<<<<<<<<<<<
 *                 Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
 *                 int ndim, char order) nogil:
 */

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1194
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

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) {
  int __pyx_v_i;
  void *__pyx_v_result;
  size_t __pyx_v_itemsize;
  size_t __pyx_v_size;
  void *__pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  struct __pyx_memoryview_obj *__pyx_t_4;
  int __pyx_t_5;

  /* "View.MemoryView":1205
 *     cdef void *result
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 */
  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1206
 * 
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef size_t size = slice_get_size(src, ndim)             # <<<<<<<<<<<<<<
 * 
 *     result = malloc(size)
 */
  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);

  /* "View.MemoryView":1208
 *     cdef size_t size = slice_get_size(src, ndim)
 * 
 *     result = malloc(size)             # <<<<<<<<<<<<<<
 *     if not result:
 *         _err(MemoryError, NULL)
 */
  __pyx_v_result = malloc(__pyx_v_size);

  /* "View.MemoryView":1209
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1210
 *     result = malloc(size)
 *     if not result:
 *         _err(MemoryError, NULL)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1210, __pyx_L1_error)

    /* "View.MemoryView":1209
 * 
 *     result = malloc(size)
 *     if not result:             # <<<<<<<<<<<<<<
 *         _err(MemoryError, NULL)
 * 
 */
  }

  /* "View.MemoryView":1213
 * 
 * 
 *     tmpslice.data = <char *> result             # <<<<<<<<<<<<<<
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 */
  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);

  /* "View.MemoryView":1214
 * 
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview             # <<<<<<<<<<<<<<
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 */
  __pyx_t_4 = __pyx_v_src->memview;
  __pyx_v_tmpslice->memview = __pyx_t_4;

  /* "View.MemoryView":1215
 *     tmpslice.data = <char *> result
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1
 */
  __pyx_t_3 = __pyx_v_ndim;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "View.MemoryView":1216
 *     tmpslice.memview = src.memview
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]             # <<<<<<<<<<<<<<
 *         tmpslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);

    /* "View.MemoryView":1217
 *     for i in range(ndim):
 *         tmpslice.shape[i] = src.shape[i]
 *         tmpslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
 */
    (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1219
 *         tmpslice.suboffsets[i] = -1
 * 
 *     fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,             # <<<<<<<<<<<<<<
 *                               ndim, order)
 * 
 */
  __pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order);

  /* "View.MemoryView":1223
 * 
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0
 */
  __pyx_t_3 = __pyx_v_ndim;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) {
    __pyx_v_i = __pyx_t_5;

    /* "View.MemoryView":1224
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1225
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:
 *             tmpslice.strides[i] = 0             # <<<<<<<<<<<<<<
 * 
 *     if slice_is_contig(src[0], order, ndim):
 */
      (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;

      /* "View.MemoryView":1224
 * 
 *     for i in range(ndim):
 *         if tmpslice.shape[i] == 1:             # <<<<<<<<<<<<<<
 *             tmpslice.strides[i] = 0
 * 
 */
    }
  }

  /* "View.MemoryView":1227
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1228
 * 
 *     if slice_is_contig(src[0], order, ndim):
 *         memcpy(result, src.data, size)             # <<<<<<<<<<<<<<
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 */
    memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size);

    /* "View.MemoryView":1227
 *             tmpslice.strides[i] = 0
 * 
 *     if slice_is_contig(src[0], order, ndim):             # <<<<<<<<<<<<<<
 *         memcpy(result, src.data, size)
 *     else:
 */
    goto __pyx_L9;
  }

  /* "View.MemoryView":1230
 *         memcpy(result, src.data, size)
 *     else:
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)             # <<<<<<<<<<<<<<
 * 
 *     return result
 */
  /*else*/ {
    copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  }
  __pyx_L9:;

  /* "View.MemoryView":1232
 *         copy_strided_to_strided(src, tmpslice, ndim, itemsize)
 * 
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_v_result;
  goto __pyx_L0;

  /* "View.MemoryView":1194
 * 
 * @cname('__pyx_memoryview_copy_data_to_temp')
 * cdef void *copy_data_to_temp(__Pyx_memviewslice *src,             # <<<<<<<<<<<<<<
 *                              __Pyx_memviewslice *tmpslice,
 *                              char order,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = NULL;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1237
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_extents", 0);

  /* "View.MemoryView":1240
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 *                                                         (i, extent1, extent2))             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err_dim')
 */
  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1240, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;

  /* "View.MemoryView":1239
 * cdef int _err_extents(int i, Py_ssize_t extent1,
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %             # <<<<<<<<<<<<<<
 *                                                         (i, extent1, extent2))
 * 
 */
  __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, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __PYX_ERR(2, 1239, __pyx_L1_error)

  /* "View.MemoryView":1237
 * 
 * @cname('__pyx_memoryview_err_extents')
 * cdef int _err_extents(int i, Py_ssize_t extent1,             # <<<<<<<<<<<<<<
 *                              Py_ssize_t extent2) except -1 with gil:
 *     raise ValueError("got differing extents in dimension %d (got %d and %d)" %
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1243
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err_dim", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1244
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
 *     raise error(msg.decode('ascii') % dim)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_err')
 */
  __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, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_v_error);
  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1244, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1244, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1244, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1244, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(2, 1244, __pyx_L1_error)

  /* "View.MemoryView":1243
 * 
 * @cname('__pyx_memoryview_err_dim')
 * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:             # <<<<<<<<<<<<<<
 *     raise error(msg.decode('ascii') % dim)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1247
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("_err", 0);
  __Pyx_INCREF(__pyx_v_error);

  /* "View.MemoryView":1248
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1249
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))             # <<<<<<<<<<<<<<
 *     else:
 *         raise error
 */
    __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, 1249, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_error);
    __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1249, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1249, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
        __pyx_t_3 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1249, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(2, 1249, __pyx_L1_error)

    /* "View.MemoryView":1248
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:
 *     if msg != NULL:             # <<<<<<<<<<<<<<
 *         raise error(msg.decode('ascii'))
 *     else:
 */
  }

  /* "View.MemoryView":1251
 *         raise error(msg.decode('ascii'))
 *     else:
 *         raise error             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_copy_contents')
 */
  /*else*/ {
    __Pyx_Raise(__pyx_v_error, 0, 0, 0);
    __PYX_ERR(2, 1251, __pyx_L1_error)
  }

  /* "View.MemoryView":1247
 * 
 * @cname('__pyx_memoryview_err')
 * cdef int _err(object error, char *msg) except -1 with gil:             # <<<<<<<<<<<<<<
 *     if msg != NULL:
 *         raise error(msg.decode('ascii'))
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_XDECREF(__pyx_v_error);
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
  return __pyx_r;
}

/* "View.MemoryView":1254
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

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) {
  void *__pyx_v_tmpdata;
  size_t __pyx_v_itemsize;
  int __pyx_v_i;
  char __pyx_v_order;
  int __pyx_v_broadcasting;
  int __pyx_v_direct_copy;
  __Pyx_memviewslice __pyx_v_tmp;
  int __pyx_v_ndim;
  int __pyx_r;
  Py_ssize_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  void *__pyx_t_6;
  int __pyx_t_7;

  /* "View.MemoryView":1262
 *     Check for overlapping memory and verify the shapes.
 *     """
 *     cdef void *tmpdata = NULL             # <<<<<<<<<<<<<<
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 */
  __pyx_v_tmpdata = NULL;

  /* "View.MemoryView":1263
 *     """
 *     cdef void *tmpdata = NULL
 *     cdef size_t itemsize = src.memview.view.itemsize             # <<<<<<<<<<<<<<
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 */
  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "View.MemoryView":1265
 *     cdef size_t itemsize = src.memview.view.itemsize
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)             # <<<<<<<<<<<<<<
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False
 */
  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);

  /* "View.MemoryView":1266
 *     cdef int i
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False             # <<<<<<<<<<<<<<
 *     cdef bint direct_copy = False
 *     cdef __Pyx_memviewslice tmp
 */
  __pyx_v_broadcasting = 0;

  /* "View.MemoryView":1267
 *     cdef char order = get_best_order(&src, src_ndim)
 *     cdef bint broadcasting = False
 *     cdef bint direct_copy = False             # <<<<<<<<<<<<<<
 *     cdef __Pyx_memviewslice tmp
 * 
 */
  __pyx_v_direct_copy = 0;

  /* "View.MemoryView":1270
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1271
 * 
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);

    /* "View.MemoryView":1270
 *     cdef __Pyx_memviewslice tmp
 * 
 *     if src_ndim < dst_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1272
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1273
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:
 *         broadcast_leading(&dst, dst_ndim, src_ndim)             # <<<<<<<<<<<<<<
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)
 */
    __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);

    /* "View.MemoryView":1272
 *     if src_ndim < dst_ndim:
 *         broadcast_leading(&src, src_ndim, dst_ndim)
 *     elif dst_ndim < src_ndim:             # <<<<<<<<<<<<<<
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 */
  }
  __pyx_L3:;

  /* "View.MemoryView":1275
 *         broadcast_leading(&dst, dst_ndim, src_ndim)
 * 
 *     cdef int ndim = max(src_ndim, dst_ndim)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim):
 */
  __pyx_t_3 = __pyx_v_dst_ndim;
  __pyx_t_4 = __pyx_v_src_ndim;
  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
    __pyx_t_5 = __pyx_t_3;
  } else {
    __pyx_t_5 = __pyx_t_4;
  }
  __pyx_v_ndim = __pyx_t_5;

  /* "View.MemoryView":1277
 *     cdef int ndim = max(src_ndim, dst_ndim)
 * 
 *     for i in range(ndim):             # <<<<<<<<<<<<<<
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 */
  __pyx_t_5 = __pyx_v_ndim;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_5; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "View.MemoryView":1278
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1279
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
      __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
      if (__pyx_t_2) {

        /* "View.MemoryView":1280
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:
 *                 broadcasting = True             # <<<<<<<<<<<<<<
 *                 src.strides[i] = 0
 *             else:
 */
        __pyx_v_broadcasting = 1;

        /* "View.MemoryView":1281
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 *                 src.strides[i] = 0             # <<<<<<<<<<<<<<
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 */
        (__pyx_v_src.strides[__pyx_v_i]) = 0;

        /* "View.MemoryView":1279
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:
 *             if src.shape[i] == 1:             # <<<<<<<<<<<<<<
 *                 broadcasting = True
 *                 src.strides[i] = 0
 */
        goto __pyx_L7;
      }

      /* "View.MemoryView":1283
 *                 src.strides[i] = 0
 *             else:
 *                 _err_extents(i, dst.shape[i], src.shape[i])             # <<<<<<<<<<<<<<
 * 
 *         if src.suboffsets[i] >= 0:
 */
      /*else*/ {
        __pyx_t_4 = __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_4 == ((int)-1))) __PYX_ERR(2, 1283, __pyx_L1_error)
      }
      __pyx_L7:;

      /* "View.MemoryView":1278
 * 
 *     for i in range(ndim):
 *         if src.shape[i] != dst.shape[i]:             # <<<<<<<<<<<<<<
 *             if src.shape[i] == 1:
 *                 broadcasting = True
 */
    }

    /* "View.MemoryView":1285
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1286
 * 
 *         if src.suboffsets[i] >= 0:
 *             _err_dim(ValueError, "Dimension %d is not direct", i)             # <<<<<<<<<<<<<<
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 */
      __pyx_t_4 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 1286, __pyx_L1_error)

      /* "View.MemoryView":1285
 *                 _err_extents(i, dst.shape[i], src.shape[i])
 * 
 *         if src.suboffsets[i] >= 0:             # <<<<<<<<<<<<<<
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 */
    }
  }

  /* "View.MemoryView":1288
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1290
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1291
 * 
 *         if not slice_is_contig(src, order, ndim):
 *             order = get_best_order(&dst, ndim)             # <<<<<<<<<<<<<<
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 */
      __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);

      /* "View.MemoryView":1290
 *     if slices_overlap(&src, &dst, ndim, itemsize):
 * 
 *         if not slice_is_contig(src, order, ndim):             # <<<<<<<<<<<<<<
 *             order = get_best_order(&dst, ndim)
 * 
 */
    }

    /* "View.MemoryView":1293
 *             order = get_best_order(&dst, ndim)
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)             # <<<<<<<<<<<<<<
 *         src = tmp
 * 
 */
    __pyx_t_6 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_6 == ((void *)NULL))) __PYX_ERR(2, 1293, __pyx_L1_error)
    __pyx_v_tmpdata = __pyx_t_6;

    /* "View.MemoryView":1294
 * 
 *         tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
 *         src = tmp             # <<<<<<<<<<<<<<
 * 
 *     if not broadcasting:
 */
    __pyx_v_src = __pyx_v_tmp;

    /* "View.MemoryView":1288
 *             _err_dim(ValueError, "Dimension %d is not direct", i)
 * 
 *     if slices_overlap(&src, &dst, ndim, itemsize):             # <<<<<<<<<<<<<<
 * 
 *         if not slice_is_contig(src, order, ndim):
 */
  }

  /* "View.MemoryView":1296
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  if (__pyx_t_2) {

    /* "View.MemoryView":1299
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1300
 * 
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)             # <<<<<<<<<<<<<<
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);

      /* "View.MemoryView":1299
 * 
 * 
 *         if slice_is_contig(src, 'C', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 */
      goto __pyx_L12;
    }

    /* "View.MemoryView":1301
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1302
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):
 *             direct_copy = slice_is_contig(dst, 'F', ndim)             # <<<<<<<<<<<<<<
 * 
 *         if direct_copy:
 */
      __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);

      /* "View.MemoryView":1301
 *         if slice_is_contig(src, 'C', ndim):
 *             direct_copy = slice_is_contig(dst, 'C', ndim)
 *         elif slice_is_contig(src, 'F', ndim):             # <<<<<<<<<<<<<<
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 */
    }
    __pyx_L12:;

    /* "View.MemoryView":1304
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_2 = (__pyx_v_direct_copy != 0);
    if (__pyx_t_2) {

      /* "View.MemoryView":1306
 *         if direct_copy:
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

      /* "View.MemoryView":1307
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))             # <<<<<<<<<<<<<<
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 */
      memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim));

      /* "View.MemoryView":1308
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 *             free(tmpdata)
 *             return 0
 */
      __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

      /* "View.MemoryView":1309
 *             memcpy(dst.data, src.data, slice_get_size(&src, ndim))
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
      free(__pyx_v_tmpdata);

      /* "View.MemoryView":1310
 *             refcount_copying(&dst, dtype_is_object, ndim, True)
 *             free(tmpdata)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):
 */
      __pyx_r = 0;
      goto __pyx_L0;

      /* "View.MemoryView":1304
 *             direct_copy = slice_is_contig(dst, 'F', ndim)
 * 
 *         if direct_copy:             # <<<<<<<<<<<<<<
 * 
 *             refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    }

    /* "View.MemoryView":1296
 *         src = tmp
 * 
 *     if not broadcasting:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1312
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = (__pyx_v_order == 'F');
  if (__pyx_t_2) {
    __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  }
  __pyx_t_7 = (__pyx_t_2 != 0);
  if (__pyx_t_7) {

    /* "View.MemoryView":1315
 * 
 * 
 *         transpose_memslice(&src)             # <<<<<<<<<<<<<<
 *         transpose_memslice(&dst)
 * 
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1315, __pyx_L1_error)

    /* "View.MemoryView":1316
 * 
 *         transpose_memslice(&src)
 *         transpose_memslice(&dst)             # <<<<<<<<<<<<<<
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 */
    __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1316, __pyx_L1_error)

    /* "View.MemoryView":1312
 *             return 0
 * 
 *     if order == 'F' == get_best_order(&dst, ndim):             # <<<<<<<<<<<<<<
 * 
 * 
 */
  }

  /* "View.MemoryView":1318
 *         transpose_memslice(&dst)
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1319
 * 
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)             # <<<<<<<<<<<<<<
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 */
  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);

  /* "View.MemoryView":1320
 *     refcount_copying(&dst, dtype_is_object, ndim, False)
 *     copy_strided_to_strided(&src, &dst, ndim, itemsize)
 *     refcount_copying(&dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 *     free(tmpdata)
 */
  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1322
 *     refcount_copying(&dst, dtype_is_object, ndim, True)
 * 
 *     free(tmpdata)             # <<<<<<<<<<<<<<
 *     return 0
 * 
 */
  free(__pyx_v_tmpdata);

  /* "View.MemoryView":1323
 * 
 *     free(tmpdata)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "View.MemoryView":1254
 * 
 * @cname('__pyx_memoryview_copy_contents')
 * cdef int memoryview_copy_contents(__Pyx_memviewslice src,             # <<<<<<<<<<<<<<
 *                                   __Pyx_memviewslice dst,
 *                                   int src_ndim, int dst_ndim,
 */

  /* function exit code */
  __pyx_L1_error:;
  {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
    #endif
    __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
    #ifdef WITH_THREAD
    __Pyx_PyGILState_Release(__pyx_gilstate_save);
    #endif
  }
  __pyx_r = -1;
  __pyx_L0:;
  return __pyx_r;
}

/* "View.MemoryView":1326
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  int __pyx_v_i;
  int __pyx_v_offset;
  int __pyx_t_1;
  int __pyx_t_2;

  /* "View.MemoryView":1330
 *                             int ndim_other) nogil:
 *     cdef int i
 *     cdef int offset = ndim_other - ndim             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ndim - 1, -1, -1):
 */
  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);

  /* "View.MemoryView":1332
 *     cdef int offset = ndim_other - ndim
 * 
 *     for i in range(ndim - 1, -1, -1):             # <<<<<<<<<<<<<<
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 */
  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1L; __pyx_t_1-=1) {
    __pyx_v_i = __pyx_t_1;

    /* "View.MemoryView":1333
 * 
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]             # <<<<<<<<<<<<<<
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 */
    (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);

    /* "View.MemoryView":1334
 *     for i in range(ndim - 1, -1, -1):
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 */
    (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);

    /* "View.MemoryView":1335
 *         mslice.shape[i + offset] = mslice.shape[i]
 *         mslice.strides[i + offset] = mslice.strides[i]
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]             # <<<<<<<<<<<<<<
 * 
 *     for i in range(offset):
 */
    (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  }

  /* "View.MemoryView":1337
 *         mslice.suboffsets[i + offset] = mslice.suboffsets[i]
 * 
 *     for i in range(offset):             # <<<<<<<<<<<<<<
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 */
  __pyx_t_1 = __pyx_v_offset;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "View.MemoryView":1338
 * 
 *     for i in range(offset):
 *         mslice.shape[i] = 1             # <<<<<<<<<<<<<<
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1
 */
    (__pyx_v_mslice->shape[__pyx_v_i]) = 1;

    /* "View.MemoryView":1339
 *     for i in range(offset):
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]             # <<<<<<<<<<<<<<
 *         mslice.suboffsets[i] = -1
 * 
 */
    (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);

    /* "View.MemoryView":1340
 *         mslice.shape[i] = 1
 *         mslice.strides[i] = mslice.strides[0]
 *         mslice.suboffsets[i] = -1             # <<<<<<<<<<<<<<
 * 
 * 
 */
    (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  }

  /* "View.MemoryView":1326
 * 
 * @cname('__pyx_memoryview_broadcast_leading')
 * cdef void broadcast_leading(__Pyx_memviewslice *mslice,             # <<<<<<<<<<<<<<
 *                             int ndim,
 *                             int ndim_other) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1348
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

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) {
  int __pyx_t_1;

  /* "View.MemoryView":1352
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1353
 * 
 *     if dtype_is_object:
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,             # <<<<<<<<<<<<<<
 *                                            dst.strides, ndim, inc)
 * 
 */
    __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);

    /* "View.MemoryView":1352
 * 
 * 
 *     if dtype_is_object:             # <<<<<<<<<<<<<<
 *         refcount_objects_in_slice_with_gil(dst.data, dst.shape,
 *                                            dst.strides, ndim, inc)
 */
  }

  /* "View.MemoryView":1348
 * 
 * @cname('__pyx_memoryview_refcount_copying')
 * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object,             # <<<<<<<<<<<<<<
 *                            int ndim, bint inc) nogil:
 * 
 */

  /* function exit code */
}

/* "View.MemoryView":1357
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

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) {
  __Pyx_RefNannyDeclarations
  #ifdef WITH_THREAD
  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  #endif
  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);

  /* "View.MemoryView":1360
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 *     refcount_objects_in_slice(data, shape, strides, ndim, inc)             # <<<<<<<<<<<<<<
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 */
  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);

  /* "View.MemoryView":1357
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
 * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                              Py_ssize_t *strides, int ndim,
 *                                              bint inc) with gil:
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  #ifdef WITH_THREAD
  __Pyx_PyGILState_Release(__pyx_gilstate_save);
  #endif
}

/* "View.MemoryView":1363
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

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) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);

  /* "View.MemoryView":1367
 *     cdef Py_ssize_t i
 * 
 *     for i in range(shape[0]):             # <<<<<<<<<<<<<<
 *         if ndim == 1:
 *             if inc:
 */
  __pyx_t_1 = (__pyx_v_shape[0]);
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "View.MemoryView":1368
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
    __pyx_t_3 = ((__pyx_v_ndim == 1) != 0);
    if (__pyx_t_3) {

      /* "View.MemoryView":1369
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
      __pyx_t_3 = (__pyx_v_inc != 0);
      if (__pyx_t_3) {

        /* "View.MemoryView":1370
 *         if ndim == 1:
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])
 */
        Py_INCREF((((PyObject **)__pyx_v_data)[0]));

        /* "View.MemoryView":1369
 *     for i in range(shape[0]):
 *         if ndim == 1:
 *             if inc:             # <<<<<<<<<<<<<<
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 */
        goto __pyx_L6;
      }

      /* "View.MemoryView":1372
 *                 Py_INCREF((<PyObject **> data)[0])
 *             else:
 *                 Py_DECREF((<PyObject **> data)[0])             # <<<<<<<<<<<<<<
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 */
      /*else*/ {
        Py_DECREF((((PyObject **)__pyx_v_data)[0]));
      }
      __pyx_L6:;

      /* "View.MemoryView":1368
 * 
 *     for i in range(shape[0]):
 *         if ndim == 1:             # <<<<<<<<<<<<<<
 *             if inc:
 *                 Py_INCREF((<PyObject **> data)[0])
 */
      goto __pyx_L5;
    }

    /* "View.MemoryView":1374
 *                 Py_DECREF((<PyObject **> data)[0])
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                       ndim - 1, inc)
 * 
 */
    /*else*/ {

      /* "View.MemoryView":1375
 *         else:
 *             refcount_objects_in_slice(data, shape + 1, strides + 1,
 *                                       ndim - 1, inc)             # <<<<<<<<<<<<<<
 * 
 *         data += strides[0]
 */
      __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
    }
    __pyx_L5:;

    /* "View.MemoryView":1377
 *                                       ndim - 1, inc)
 * 
 *         data += strides[0]             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  }

  /* "View.MemoryView":1363
 * 
 * @cname('__pyx_memoryview_refcount_objects_in_slice')
 * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                                     Py_ssize_t *strides, int ndim, bint inc):
 *     cdef Py_ssize_t i
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "View.MemoryView":1383
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

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) {

  /* "View.MemoryView":1386
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)             # <<<<<<<<<<<<<<
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);

  /* "View.MemoryView":1387
 *                               bint dtype_is_object) nogil:
 *     refcount_copying(dst, dtype_is_object, ndim, False)
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,             # <<<<<<<<<<<<<<
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)
 */
  __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);

  /* "View.MemoryView":1389
 *     _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
 *                          itemsize, item)
 *     refcount_copying(dst, dtype_is_object, ndim, True)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);

  /* "View.MemoryView":1383
 * 
 * @cname('__pyx_memoryview_slice_assign_scalar')
 * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim,             # <<<<<<<<<<<<<<
 *                               size_t itemsize, void *item,
 *                               bint dtype_is_object) nogil:
 */

  /* function exit code */
}

/* "View.MemoryView":1393
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

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) {
  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_stride;
  Py_ssize_t __pyx_v_extent;
  int __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;

  /* "View.MemoryView":1397
 *                               size_t itemsize, void *item) nogil:
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t extent = shape[0]
 * 
 */
  __pyx_v_stride = (__pyx_v_strides[0]);

  /* "View.MemoryView":1398
 *     cdef Py_ssize_t i
 *     cdef Py_ssize_t stride = strides[0]
 *     cdef Py_ssize_t extent = shape[0]             # <<<<<<<<<<<<<<
 * 
 *     if ndim == 1:
 */
  __pyx_v_extent = (__pyx_v_shape[0]);

  /* "View.MemoryView":1400
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  if (__pyx_t_1) {

    /* "View.MemoryView":1401
 * 
 *     if ndim == 1:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             memcpy(data, item, itemsize)
 *             data += stride
 */
    __pyx_t_2 = __pyx_v_extent;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "View.MemoryView":1402
 *     if ndim == 1:
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)             # <<<<<<<<<<<<<<
 *             data += stride
 *     else:
 */
      memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize);

      /* "View.MemoryView":1403
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 *             data += stride             # <<<<<<<<<<<<<<
 *     else:
 *         for i in range(extent):
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }

    /* "View.MemoryView":1400
 *     cdef Py_ssize_t extent = shape[0]
 * 
 *     if ndim == 1:             # <<<<<<<<<<<<<<
 *         for i in range(extent):
 *             memcpy(data, item, itemsize)
 */
    goto __pyx_L3;
  }

  /* "View.MemoryView":1405
 *             data += stride
 *     else:
 *         for i in range(extent):             # <<<<<<<<<<<<<<
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 */
  /*else*/ {
    __pyx_t_2 = __pyx_v_extent;
    for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
      __pyx_v_i = __pyx_t_3;

      /* "View.MemoryView":1406
 *     else:
 *         for i in range(extent):
 *             _slice_assign_scalar(data, shape + 1, strides + 1,             # <<<<<<<<<<<<<<
 *                                 ndim - 1, itemsize, item)
 *             data += stride
 */
      __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);

      /* "View.MemoryView":1408
 *             _slice_assign_scalar(data, shape + 1, strides + 1,
 *                                 ndim - 1, itemsize, item)
 *             data += stride             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
    }
  }
  __pyx_L3:;

  /* "View.MemoryView":1393
 * 
 * @cname('__pyx_memoryview__slice_assign_scalar')
 * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape,             # <<<<<<<<<<<<<<
 *                               Py_ssize_t *strides, int ndim,
 *                               size_t itemsize, void *item) nogil:
 */

  /* function exit code */
}

/* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 */

/* Python wrapper */
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v___pyx_type = 0;
  long __pyx_v___pyx_checksum;
  PyObject *__pyx_v___pyx_state = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v___pyx_type = values[0];
    __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)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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) {
  PyObject *__pyx_v___pyx_PickleError = NULL;
  PyObject *__pyx_v___pyx_result = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);

  /* "(tree fragment)":2
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":3
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_PickleError);
    __Pyx_GIVEREF(__pyx_n_s_PickleError);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
    __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_v___pyx_PickleError = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":4
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 */
    __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_v___pyx_PickleError);
    __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
        PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4);
        __pyx_t_4 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(2, 4, __pyx_L1_error)

    /* "(tree fragment)":2
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xb068931:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":5
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_v___pyx_type);
      __Pyx_GIVEREF(__pyx_v___pyx_type);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  __pyx_t_7 = (__pyx_t_1 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":7
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 */
    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, 7, __pyx_L1_error)
    __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
 *     __pyx_result = Enum.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":8
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":9
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);

  /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 10, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->name);
  __Pyx_DECREF(__pyx_v___pyx_result->name);
  __pyx_v___pyx_result->name = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":11
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 11, __pyx_L1_error)
  }
  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 11, __pyx_L1_error)
  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 11, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 != 0);
  __pyx_t_2 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":12
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(2, 12, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
        PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else
      #endif
      {
        __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL;
        __Pyx_GIVEREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":11
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
 */
  }

  /* "(tree fragment)":9
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_array __pyx_vtable_array;

static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_array_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_array_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_array;
  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_array(PyObject *o) {
  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  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))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_array___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->mode);
  Py_CLEAR(p->_format);
  (*Py_TYPE(o)->tp_free)(o);
}
static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_array___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  PyObject *v = PyObject_GenericGetAttr(o, n);
  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
    PyErr_Clear();
    v = __pyx_array___getattr__(o, n);
  }
  return v;
}

static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
}

static PyMethodDef __pyx_methods_array[] = {
  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_array[] = {
  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_array = {
  __pyx_array___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_array, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_array = {
  __pyx_array___len__, /*mp_length*/
  __pyx_array___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_array = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_array_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_array = {
  PyVarObject_HEAD_INIT(0, 0)
  "tofu.geom._GG03.array", /*tp_name*/
  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_array, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  __pyx_tp_getattro_array, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_array, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_array, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_array, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_MemviewEnum_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_MemviewEnum_obj *)o);
  p->name = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_Enum(PyObject *o) {
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->name);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_Enum(PyObject *o) {
  PyObject* tmp;
  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  tmp = ((PyObject*)p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_Enum[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  PyVarObject_HEAD_INIT(0, 0)
  "tofu.geom._GG03.Enum", /*tp_name*/
  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_MemviewEnum___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_Enum, /*tp_traverse*/
  __pyx_tp_clear_Enum, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_Enum, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_MemviewEnum___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_Enum, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;

static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryview_obj *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryview_obj *)o);
  p->__pyx_vtab = __pyx_vtabptr_memoryview;
  p->obj = Py_None; Py_INCREF(Py_None);
  p->_size = Py_None; Py_INCREF(Py_None);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  p->view.obj = NULL;
  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_memoryview___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->obj);
  Py_CLEAR(p->_size);
  Py_CLEAR(p->_array_interface);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  if (p->obj) {
    e = (*v)(p->obj, a); if (e) return e;
  }
  if (p->_size) {
    e = (*v)(p->_size, a); if (e) return e;
  }
  if (p->_array_interface) {
    e = (*v)(p->_array_interface, a); if (e) return e;
  }
  if (p->view.obj) {
    e = (*v)(p->view.obj, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_memoryview(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  tmp = ((PyObject*)p->obj);
  p->obj = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_size);
  p->_size = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->_array_interface);
  p->_array_interface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  Py_CLEAR(p->view.obj);
  return 0;
}
static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_memoryview___setitem__(o, i, v);
  }
  else {
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
    return -1;
  }
}

static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
}

static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
}

static PyMethodDef __pyx_methods_memoryview[] = {
  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  __pyx_memoryview___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_memoryview, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  __pyx_memoryview___len__, /*mp_length*/
  __pyx_memoryview___getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  0, /*bf_releasebuffer*/
};

static PyTypeObject __pyx_type___pyx_memoryview = {
  PyVarObject_HEAD_INIT(0, 0)
  "tofu.geom._GG03.memoryview", /*tp_name*/
  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  __pyx_memoryview___repr__, /*tp_repr*/
  0, /*tp_as_number*/
  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_memoryview___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_memoryview, /*tp_traverse*/
  __pyx_tp_clear_memoryview, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_memoryview, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_memoryview, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_memoryview, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;

static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_memoryviewslice_obj *p;
  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_memoryviewslice_obj *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  p->from_object = Py_None; Py_INCREF(Py_None);
  p->from_slice.memview = NULL;
  return o;
}

static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_memoryviewslice___dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->from_object);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_memoryview(o);
}

static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  if (p->from_object) {
    e = (*v)(p->from_object, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  PyObject* tmp;
  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  __pyx_tp_clear_memoryview(o);
  tmp = ((PyObject*)p->from_object);
  p->from_object = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  return 0;
}

static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
}

static PyMethodDef __pyx_methods__memoryviewslice[] = {
  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  PyVarObject_HEAD_INIT(0, 0)
  "tofu.geom._GG03._memoryviewslice", /*tp_name*/
  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #endif
  #if PY_MAJOR_VERSION >= 3
  0, /*tp_as_async*/
  #endif
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___repr__, /*tp_repr*/
  #else
  0, /*tp_repr*/
  #endif
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  #if CYTHON_COMPILING_IN_PYPY
  __pyx_memoryview___str__, /*tp_str*/
  #else
  0, /*tp_str*/
  #endif
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Internal class for passing memoryview slices to Python", /*tp_doc*/
  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods__memoryviewslice, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets__memoryviewslice, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new__memoryviewslice, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec__GG03(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec__GG03},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "_GG03",
    0, /* m_doc */
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    0, /* m_size */
  #else
    -1, /* m_size */
  #endif
    __pyx_methods /* m_methods */,
  #if CYTHON_PEP489_MULTI_PHASE_INIT
    __pyx_moduledef_slots, /* m_slots */
  #else
    NULL, /* m_reload */
  #endif
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  {&__pyx_n_s_Ani, __pyx_k_Ani, sizeof(__pyx_k_Ani), 0, 0, 1, 1},
  {&__pyx_kp_s_Arg_Clock_must_be_a_bool, __pyx_k_Arg_Clock_must_be_a_bool, sizeof(__pyx_k_Arg_Clock_must_be_a_bool), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_CrossRef_must_be_a_float, __pyx_k_Arg_CrossRef_must_be_a_float, sizeof(__pyx_k_Arg_CrossRef_must_be_a_float), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_DLs_dim_0, __pyx_k_Arg_DLs_dim_0, sizeof(__pyx_k_Arg_DLs_dim_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_Forbid_must_be_a_bool, __pyx_k_Arg_Forbid_must_be_a_bool, sizeof(__pyx_k_Arg_Forbid_must_be_a_bool), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_In_and_Out_coordinate_format, __pyx_k_Arg_In_and_Out_coordinate_format, sizeof(__pyx_k_Arg_In_and_Out_coordinate_format), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_Lim_must_be_a_len_2_iterable, __pyx_k_Arg_Lim_must_be_a_len_2_iterable, sizeof(__pyx_k_Arg_Lim_must_be_a_len_2_iterable), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_Poly_must_contain_the_2D_or, __pyx_k_Arg_Poly_must_contain_the_2D_or, sizeof(__pyx_k_Arg_Poly_must_contain_the_2D_or), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_Poly_should_be_a_2_N_np_ndar, __pyx_k_Arg_Poly_should_be_a_2_N_np_ndar, sizeof(__pyx_k_Arg_Poly_should_be_a_2_N_np_ndar), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_Pts_must_be_a_1D_or_2D_np_nd, __pyx_k_Arg_Pts_must_be_a_1D_or_2D_np_nd, sizeof(__pyx_k_Arg_Pts_must_be_a_1D_or_2D_np_nd), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_RMin_must_be_None_or_a_float, __pyx_k_Arg_RMin_must_be_None_or_a_float, sizeof(__pyx_k_Arg_RMin_must_be_None_or_a_float), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_RZ_should_be_a_2_np_ndarray, __pyx_k_Arg_RZ_should_be_a_2_np_ndarray, sizeof(__pyx_k_Arg_RZ_should_be_a_2_np_ndarray), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_VPoly_must_be_a_2_N_np_ndarr, __pyx_k_Arg_VPoly_must_be_a_2_N_np_ndarr, sizeof(__pyx_k_Arg_VPoly_must_be_a_2_N_np_ndarr), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_VType_must_be_a_str_in_Tor_L, __pyx_k_Arg_VType_must_be_a_str_in_Tor_L, sizeof(__pyx_k_Arg_VType_must_be_a_str_in_Tor_L), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_close_must_be_a_bool, __pyx_k_Arg_close_must_be_a_bool, sizeof(__pyx_k_Arg_close_must_be_a_bool), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_dLMode_in_abs_rel, __pyx_k_Arg_dLMode_in_abs_rel, sizeof(__pyx_k_Arg_dLMode_in_abs_rel), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_dL_must_be_0, __pyx_k_Arg_dL_must_be_0, sizeof(__pyx_k_Arg_dL_must_be_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_layout_in_must_be_in_cc_n_n, __pyx_k_Arg_layout_in_must_be_in_cc_n_n, sizeof(__pyx_k_Arg_layout_in_must_be_in_cc_n_n), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_layout_must_be_in_cc_n_n_cc, __pyx_k_Arg_layout_must_be_in_cc_n_n_cc, sizeof(__pyx_k_Arg_layout_must_be_in_cc_n_n_cc), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_method, __pyx_k_Arg_method, sizeof(__pyx_k_Arg_method), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_order_must_be_in_c_f, __pyx_k_Arg_order_must_be_in_c_f, sizeof(__pyx_k_Arg_order_must_be_in_c_f), 0, 0, 1, 0},
  {&__pyx_kp_s_Arg_t_must_be_None_a_scalar_or_a, __pyx_k_Arg_t_must_be_None_a_scalar_or_a, sizeof(__pyx_k_Arg_t_must_be_None_a_scalar_or_a), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_Ds_and_dus_must_be_of_the_s, __pyx_k_Args_Ds_and_dus_must_be_of_the_s, sizeof(__pyx_k_Args_Ds_and_dus_must_be_of_the_s), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_Ds_us_DLs_1, __pyx_k_Args_Ds_us_DLs_1, sizeof(__pyx_k_Args_Ds_us_DLs_1), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_Ds_us_dim_0, __pyx_k_Args_Ds_us_dim_0, sizeof(__pyx_k_Args_Ds_us_dim_0), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_EpsUz_EpsVz_EpsA_EpsB_must, __pyx_k_Args_EpsUz_EpsVz_EpsA_EpsB_must, sizeof(__pyx_k_Args_EpsUz_EpsVz_EpsA_EpsB_must), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_LSPoly_LSLim_LSVIn_must_be, __pyx_k_Args_LSPoly_LSLim_LSVIn_must_be, sizeof(__pyx_k_Args_LSPoly_LSLim_LSVIn_must_be), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_VPoly_and_VIn_must_be_of_th, __pyx_k_Args_VPoly_and_VIn_must_be_of_th, sizeof(__pyx_k_Args_VPoly_and_VIn_must_be_of_th), 0, 0, 1, 0},
  {&__pyx_kp_s_Args_pP_pN_and_theta_must_have_s, __pyx_k_Args_pP_pN_and_theta_must_have_s, sizeof(__pyx_k_Args_pP_pN_and_theta_must_have_s), 0, 0, 1, 0},
  {&__pyx_n_s_BC, __pyx_k_BC, sizeof(__pyx_k_BC), 0, 0, 1, 1},
  {&__pyx_n_s_BV0, __pyx_k_BV0, sizeof(__pyx_k_BV0), 0, 0, 1, 1},
  {&__pyx_n_s_BV1, __pyx_k_BV1, sizeof(__pyx_k_BV1), 0, 0, 1, 1},
  {&__pyx_n_s_Bounds, __pyx_k_Bounds, sizeof(__pyx_k_Bounds), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
  {&__pyx_n_s_C0, __pyx_k_C0, sizeof(__pyx_k_C0), 0, 0, 1, 1},
  {&__pyx_n_s_C1, __pyx_k_C1, sizeof(__pyx_k_C1), 0, 0, 1, 1},
  {&__pyx_n_s_C2, __pyx_k_C2, sizeof(__pyx_k_C2), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_Clock, __pyx_k_Clock, sizeof(__pyx_k_Clock), 0, 0, 1, 1},
  {&__pyx_n_s_ConvertImpact_Theta2Xi, __pyx_k_ConvertImpact_Theta2Xi, sizeof(__pyx_k_ConvertImpact_Theta2Xi), 0, 0, 1, 1},
  {&__pyx_n_s_CoordShift, __pyx_k_CoordShift, sizeof(__pyx_k_CoordShift), 0, 0, 1, 1},
  {&__pyx_kp_s_Could_not_resolve_the_input_layo, __pyx_k_Could_not_resolve_the_input_layo, sizeof(__pyx_k_Could_not_resolve_the_input_layo), 0, 0, 1, 0},
  {&__pyx_n_s_CrossRef, __pyx_k_CrossRef, sizeof(__pyx_k_CrossRef), 0, 0, 1, 1},
  {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1},
  {&__pyx_n_s_D0, __pyx_k_D0, sizeof(__pyx_k_D0), 0, 0, 1, 1},
  {&__pyx_n_s_D1, __pyx_k_D1, sizeof(__pyx_k_D1), 0, 0, 1, 1},
  {&__pyx_n_s_D2, __pyx_k_D2, sizeof(__pyx_k_D2), 0, 0, 1, 1},
  {&__pyx_n_s_DDPhi, __pyx_k_DDPhi, sizeof(__pyx_k_DDPhi), 0, 0, 1, 1},
  {&__pyx_n_s_DIn, __pyx_k_DIn, sizeof(__pyx_k_DIn), 0, 0, 1, 1},
  {&__pyx_n_s_DL, __pyx_k_DL, sizeof(__pyx_k_DL), 0, 0, 1, 1},
  {&__pyx_n_s_DLc, __pyx_k_DLc, sizeof(__pyx_k_DLc), 0, 0, 1, 1},
  {&__pyx_n_s_DLs, __pyx_k_DLs, sizeof(__pyx_k_DLs), 0, 0, 1, 1},
  {&__pyx_n_s_DPhi, __pyx_k_DPhi, sizeof(__pyx_k_DPhi), 0, 0, 1, 1},
  {&__pyx_n_s_DPhi0, __pyx_k_DPhi0, sizeof(__pyx_k_DPhi0), 0, 0, 1, 1},
  {&__pyx_n_s_DPhi1, __pyx_k_DPhi1, sizeof(__pyx_k_DPhi1), 0, 0, 1, 1},
  {&__pyx_n_s_DPhiMinMax, __pyx_k_DPhiMinMax, sizeof(__pyx_k_DPhiMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_DR, __pyx_k_DR, sizeof(__pyx_k_DR), 0, 0, 1, 1},
  {&__pyx_n_s_DX, __pyx_k_DX, sizeof(__pyx_k_DX), 0, 0, 1, 1},
  {&__pyx_n_s_DY, __pyx_k_DY, sizeof(__pyx_k_DY), 0, 0, 1, 1},
  {&__pyx_n_s_DZ, __pyx_k_DZ, sizeof(__pyx_k_DZ), 0, 0, 1, 1},
  {&__pyx_n_s_Dphi, __pyx_k_Dphi, sizeof(__pyx_k_Dphi), 0, 0, 1, 1},
  {&__pyx_n_s_Ds, __pyx_k_Ds, sizeof(__pyx_k_Ds), 0, 0, 1, 1},
  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_EnvTheta, __pyx_k_EnvTheta, sizeof(__pyx_k_EnvTheta), 0, 0, 1, 1},
  {&__pyx_n_s_EpsA, __pyx_k_EpsA, sizeof(__pyx_k_EpsA), 0, 0, 1, 1},
  {&__pyx_n_s_EpsB, __pyx_k_EpsB, sizeof(__pyx_k_EpsB), 0, 0, 1, 1},
  {&__pyx_n_s_EpsPlane, __pyx_k_EpsPlane, sizeof(__pyx_k_EpsPlane), 0, 0, 1, 1},
  {&__pyx_n_s_EpsUz, __pyx_k_EpsUz, sizeof(__pyx_k_EpsUz), 0, 0, 1, 1},
  {&__pyx_n_s_EpsVz, __pyx_k_EpsVz, sizeof(__pyx_k_EpsVz), 0, 0, 1, 1},
  {&__pyx_n_s_Faces, __pyx_k_Faces, sizeof(__pyx_k_Faces), 0, 0, 1, 1},
  {&__pyx_n_s_Forbid, __pyx_k_Forbid, sizeof(__pyx_k_Forbid), 0, 0, 1, 1},
  {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  {&__pyx_n_s_Full, __pyx_k_Full, sizeof(__pyx_k_Full), 0, 0, 1, 1},
  {&__pyx_n_s_IIn, __pyx_k_IIn, sizeof(__pyx_k_IIn), 0, 0, 1, 1},
  {&__pyx_n_s_IOut, __pyx_k_IOut, sizeof(__pyx_k_IOut), 0, 0, 1, 1},
  {&__pyx_kp_s_If_Ani_True_ff_must_handle_multi, __pyx_k_If_Ani_True_ff_must_handle_multi, sizeof(__pyx_k_If_Ani_True_ff_must_handle_multi), 0, 0, 1, 0},
  {&__pyx_kp_s_If_Ani_True_ff_must_return_a_nt, __pyx_k_If_Ani_True_ff_must_return_a_nt, sizeof(__pyx_k_If_Ani_True_ff_must_return_a_nt), 0, 0, 1, 0},
  {&__pyx_kp_s_If_Ani_True_ff_must_take_a_keywo, __pyx_k_If_Ani_True_ff_must_take_a_keywo, sizeof(__pyx_k_If_Ani_True_ff_must_take_a_keywo), 0, 0, 1, 0},
  {&__pyx_n_s_ImpTheta, __pyx_k_ImpTheta, sizeof(__pyx_k_ImpTheta), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_In, __pyx_k_In, sizeof(__pyx_k_In), 0, 0, 1, 1},
  {&__pyx_n_s_InT, __pyx_k_InT, sizeof(__pyx_k_InT), 0, 0, 1, 1},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
  {&__pyx_n_s_Ind, __pyx_k_Ind, sizeof(__pyx_k_Ind), 0, 0, 1, 1},
  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  {&__pyx_n_s_Indin, __pyx_k_Indin, sizeof(__pyx_k_Indin), 0, 0, 1, 1},
  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  {&__pyx_kp_s_Input_emissivity_function_ff, __pyx_k_Input_emissivity_function_ff, sizeof(__pyx_k_Input_emissivity_function_ff), 0, 0, 1, 0},
  {&__pyx_n_s_Ins, __pyx_k_Ins, sizeof(__pyx_k_Ins), 0, 0, 1, 1},
  {&__pyx_n_s_Inter, __pyx_k_Inter, sizeof(__pyx_k_Inter), 0, 0, 1, 1},
  {&__pyx_n_s_InterX, __pyx_k_InterX, sizeof(__pyx_k_InterX), 0, 0, 1, 1},
  {&__pyx_n_s_InterY, __pyx_k_InterY, sizeof(__pyx_k_InterY), 0, 0, 1, 1},
  {&__pyx_n_s_InterZ, __pyx_k_InterZ, sizeof(__pyx_k_InterZ), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_L, __pyx_k_L, sizeof(__pyx_k_L), 0, 0, 1, 1},
  {&__pyx_n_s_LMinMax, __pyx_k_LMinMax, sizeof(__pyx_k_LMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_LOS, __pyx_k_LOS, sizeof(__pyx_k_LOS), 0, 0, 1, 1},
  {&__pyx_n_s_LOS_Calc_PInOut_VesStruct, __pyx_k_LOS_Calc_PInOut_VesStruct, sizeof(__pyx_k_LOS_Calc_PInOut_VesStruct), 0, 0, 1, 1},
  {&__pyx_n_s_LOS_calc_signal, __pyx_k_LOS_calc_signal, sizeof(__pyx_k_LOS_calc_signal), 0, 0, 1, 1},
  {&__pyx_n_s_LOS_get_sample, __pyx_k_LOS_get_sample, sizeof(__pyx_k_LOS_get_sample), 0, 0, 1, 1},
  {&__pyx_n_s_LOS_sino, __pyx_k_LOS_sino, sizeof(__pyx_k_LOS_sino), 0, 0, 1, 1},
  {&__pyx_n_s_LPts, __pyx_k_LPts, sizeof(__pyx_k_LPts), 0, 0, 1, 1},
  {&__pyx_n_s_LPtsCross, __pyx_k_LPtsCross, sizeof(__pyx_k_LPtsCross), 0, 0, 1, 1},
  {&__pyx_n_s_LRref, __pyx_k_LRref, sizeof(__pyx_k_LRref), 0, 0, 1, 1},
  {&__pyx_n_s_LSLim, __pyx_k_LSLim, sizeof(__pyx_k_LSLim), 0, 0, 1, 1},
  {&__pyx_n_s_LSPoly, __pyx_k_LSPoly, sizeof(__pyx_k_LSPoly), 0, 0, 1, 1},
  {&__pyx_n_s_LSVIn, __pyx_k_LSVIn, sizeof(__pyx_k_LSVIn), 0, 0, 1, 1},
  {&__pyx_n_s_LdLr, __pyx_k_LdLr, sizeof(__pyx_k_LdLr), 0, 0, 1, 1},
  {&__pyx_n_s_LdS, __pyx_k_LdS, sizeof(__pyx_k_LdS), 0, 0, 1, 1},
  {&__pyx_n_s_Lim, __pyx_k_Lim, sizeof(__pyx_k_Lim), 0, 0, 1, 1},
  {&__pyx_n_s_Lind, __pyx_k_Lind, sizeof(__pyx_k_Lind), 0, 0, 1, 1},
  {&__pyx_n_s_Ln, __pyx_k_Ln, sizeof(__pyx_k_Ln), 0, 0, 1, 1},
  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  {&__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},
  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  {&__pyx_n_s_MinMax1, __pyx_k_MinMax1, sizeof(__pyx_k_MinMax1), 0, 0, 1, 1},
  {&__pyx_n_s_MinMax2, __pyx_k_MinMax2, sizeof(__pyx_k_MinMax2), 0, 0, 1, 1},
  {&__pyx_n_s_Mode, __pyx_k_Mode, sizeof(__pyx_k_Mode), 0, 0, 1, 1},
  {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
  {&__pyx_n_s_N1, __pyx_k_N1, sizeof(__pyx_k_N1), 0, 0, 1, 1},
  {&__pyx_n_s_N2, __pyx_k_N2, sizeof(__pyx_k_N2), 0, 0, 1, 1},
  {&__pyx_n_s_ND, __pyx_k_ND, sizeof(__pyx_k_ND), 0, 0, 1, 1},
  {&__pyx_n_s_NL, __pyx_k_NL, sizeof(__pyx_k_NL), 0, 0, 1, 1},
  {&__pyx_n_s_NP, __pyx_k_NP, sizeof(__pyx_k_NP), 0, 0, 1, 1},
  {&__pyx_n_s_NPhimax, __pyx_k_NPhimax, sizeof(__pyx_k_NPhimax), 0, 0, 1, 1},
  {&__pyx_n_s_NPoly, __pyx_k_NPoly, sizeof(__pyx_k_NPoly), 0, 0, 1, 1},
  {&__pyx_n_s_NR, __pyx_k_NR, sizeof(__pyx_k_NR), 0, 0, 1, 1},
  {&__pyx_n_s_NR0, __pyx_k_NR0, sizeof(__pyx_k_NR0), 0, 0, 1, 1},
  {&__pyx_n_s_NRPhi, __pyx_k_NRPhi, sizeof(__pyx_k_NRPhi), 0, 0, 1, 1},
  {&__pyx_n_s_NRPhi0, __pyx_k_NRPhi0, sizeof(__pyx_k_NRPhi0), 0, 0, 1, 1},
  {&__pyx_n_s_NRPhi_int, __pyx_k_NRPhi_int, sizeof(__pyx_k_NRPhi_int), 0, 0, 1, 1},
  {&__pyx_n_s_NX, __pyx_k_NX, sizeof(__pyx_k_NX), 0, 0, 1, 1},
  {&__pyx_n_s_NY, __pyx_k_NY, sizeof(__pyx_k_NY), 0, 0, 1, 1},
  {&__pyx_n_s_NY0, __pyx_k_NY0, sizeof(__pyx_k_NY0), 0, 0, 1, 1},
  {&__pyx_n_s_NZ, __pyx_k_NZ, sizeof(__pyx_k_NZ), 0, 0, 1, 1},
  {&__pyx_n_s_NZ0, __pyx_k_NZ0, sizeof(__pyx_k_NZ0), 0, 0, 1, 1},
  {&__pyx_n_s_Nind, __pyx_k_Nind, sizeof(__pyx_k_Nind), 0, 0, 1, 1},
  {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  {&__pyx_kp_s_Non_valid_In, __pyx_k_Non_valid_In, sizeof(__pyx_k_Non_valid_In), 0, 0, 1, 0},
  {&__pyx_kp_s_Non_valid_Out, __pyx_k_Non_valid_Out, sizeof(__pyx_k_Non_valid_Out), 0, 0, 1, 0},
  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  {&__pyx_n_s_Out, __pyx_k_Out, sizeof(__pyx_k_Out), 0, 0, 1, 1},
  {&__pyx_n_s_OutT, __pyx_k_OutT, sizeof(__pyx_k_OutT), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_Outs, __pyx_k_Outs, sizeof(__pyx_k_Outs), 0, 0, 1, 1},
  {&__pyx_n_s_PIn, __pyx_k_PIn, sizeof(__pyx_k_PIn), 0, 0, 1, 1},
  {&__pyx_n_s_PMin, __pyx_k_PMin, sizeof(__pyx_k_PMin), 0, 0, 1, 1},
  {&__pyx_n_s_POSITIONAL_OR_KEYWORD, __pyx_k_POSITIONAL_OR_KEYWORD, sizeof(__pyx_k_POSITIONAL_OR_KEYWORD), 0, 0, 1, 1},
  {&__pyx_n_s_POut, __pyx_k_POut, sizeof(__pyx_k_POut), 0, 0, 1, 1},
  {&__pyx_n_s_Path, __pyx_k_Path, sizeof(__pyx_k_Path), 0, 0, 1, 1},
  {&__pyx_n_s_Phi, __pyx_k_Phi, sizeof(__pyx_k_Phi), 0, 0, 1, 1},
  {&__pyx_n_s_Phi0, __pyx_k_Phi0, sizeof(__pyx_k_Phi0), 0, 0, 1, 1},
  {&__pyx_n_s_Phi1, __pyx_k_Phi1, sizeof(__pyx_k_Phi1), 0, 0, 1, 1},
  {&__pyx_n_s_PhiMinMax, __pyx_k_PhiMinMax, sizeof(__pyx_k_PhiMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_Phin, __pyx_k_Phin, sizeof(__pyx_k_Phin), 0, 0, 1, 1},
  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  {&__pyx_kp_s_Points_must_be_a_1D_or_2D_np_nda, __pyx_k_Points_must_be_a_1D_or_2D_np_nda, sizeof(__pyx_k_Points_must_be_a_1D_or_2D_np_nda), 0, 0, 1, 0},
  {&__pyx_n_s_Poly, __pyx_k_Poly, sizeof(__pyx_k_Poly), 0, 0, 1, 1},
  {&__pyx_n_s_Poly_Order, __pyx_k_Poly_Order, sizeof(__pyx_k_Poly_Order), 0, 0, 1, 1},
  {&__pyx_n_s_Poly_VolAngTor, __pyx_k_Poly_VolAngTor, sizeof(__pyx_k_Poly_VolAngTor), 0, 0, 1, 1},
  {&__pyx_n_s_Poly_isClockwise, __pyx_k_Poly_isClockwise, sizeof(__pyx_k_Poly_isClockwise), 0, 0, 1, 1},
  {&__pyx_n_s_Pts, __pyx_k_Pts, sizeof(__pyx_k_Pts), 0, 0, 1, 1},
  {&__pyx_n_s_PtsCross, __pyx_k_PtsCross, sizeof(__pyx_k_PtsCross), 0, 0, 1, 1},
  {&__pyx_n_s_PtsM, __pyx_k_PtsM, sizeof(__pyx_k_PtsM), 0, 0, 1, 1},
  {&__pyx_kp_s_Pts_is_3_N_Vect_is_provided_and, __pyx_k_Pts_is_3_N_Vect_is_provided_and, sizeof(__pyx_k_Pts_is_3_N_Vect_is_provided_and), 0, 0, 1, 0},
  {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1},
  {&__pyx_n_s_R0, __pyx_k_R0, sizeof(__pyx_k_R0), 0, 0, 1, 1},
  {&__pyx_n_s_R0n, __pyx_k_R0n, sizeof(__pyx_k_R0n), 0, 0, 1, 1},
  {&__pyx_n_s_RMin, __pyx_k_RMin, sizeof(__pyx_k_RMin), 0, 0, 1, 1},
  {&__pyx_n_s_RMinMax, __pyx_k_RMinMax, sizeof(__pyx_k_RMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_RZ, __pyx_k_RZ, sizeof(__pyx_k_RZ), 0, 0, 1, 1},
  {&__pyx_n_s_RZPoly, __pyx_k_RZPoly, sizeof(__pyx_k_RZPoly), 0, 0, 1, 1},
  {&__pyx_kp_s_R_Z, __pyx_k_R_Z, sizeof(__pyx_k_R_Z), 0, 0, 1, 0},
  {&__pyx_kp_s_R_Z_Phi, __pyx_k_R_Z_Phi, sizeof(__pyx_k_R_Z_Phi), 0, 0, 1, 0},
  {&__pyx_n_s_Ri0, __pyx_k_Ri0, sizeof(__pyx_k_Ri0), 0, 0, 1, 1},
  {&__pyx_n_s_Ri1, __pyx_k_Ri1, sizeof(__pyx_k_Ri1), 0, 0, 1, 1},
  {&__pyx_n_s_Rn, __pyx_k_Rn, sizeof(__pyx_k_Rn), 0, 0, 1, 1},
  {&__pyx_n_s_Rratio, __pyx_k_Rratio, sizeof(__pyx_k_Rratio), 0, 0, 1, 1},
  {&__pyx_n_s_Rref, __pyx_k_Rref, sizeof(__pyx_k_Rref), 0, 0, 1, 1},
  {&__pyx_n_s_RrefRef, __pyx_k_RrefRef, sizeof(__pyx_k_RrefRef), 0, 0, 1, 1},
  {&__pyx_n_s_Ru, __pyx_k_Ru, sizeof(__pyx_k_Ru), 0, 0, 1, 1},
  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s_Sca, __pyx_k_Sca, sizeof(__pyx_k_Sca), 0, 0, 1, 1},
  {&__pyx_n_s_Sino_ImpactEnv, __pyx_k_Sino_ImpactEnv, sizeof(__pyx_k_Sino_ImpactEnv), 0, 0, 1, 1},
  {&__pyx_n_s_Str, __pyx_k_Str, sizeof(__pyx_k_Str), 0, 0, 1, 1},
  {&__pyx_n_s_Sum, __pyx_k_Sum, sizeof(__pyx_k_Sum), 0, 0, 1, 1},
  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
  {&__pyx_n_s_Test, __pyx_k_Test, sizeof(__pyx_k_Test), 0, 0, 1, 1},
  {&__pyx_kp_s_There_is_no_phi_value_available, __pyx_k_There_is_no_phi_value_available, sizeof(__pyx_k_There_is_no_phi_value_available), 0, 0, 1, 0},
  {&__pyx_kp_s_There_is_no_x_value_available, __pyx_k_There_is_no_x_value_available, sizeof(__pyx_k_There_is_no_x_value_available), 0, 0, 1, 0},
  {&__pyx_n_s_Theta, __pyx_k_Theta, sizeof(__pyx_k_Theta), 0, 0, 1, 1},
  {&__pyx_n_s_Tor, __pyx_k_Tor, sizeof(__pyx_k_Tor), 0, 0, 1, 1},
  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 0, 1, 1},
  {&__pyx_n_s_VIn, __pyx_k_VIn, sizeof(__pyx_k_VIn), 0, 0, 1, 1},
  {&__pyx_n_s_VPbis, __pyx_k_VPbis, sizeof(__pyx_k_VPbis), 0, 0, 1, 1},
  {&__pyx_n_s_VPoly, __pyx_k_VPoly, sizeof(__pyx_k_VPoly), 0, 0, 1, 1},
  {&__pyx_n_s_VPolybis, __pyx_k_VPolybis, sizeof(__pyx_k_VPolybis), 0, 0, 1, 1},
  {&__pyx_n_s_VType, __pyx_k_VType, sizeof(__pyx_k_VType), 0, 0, 1, 1},
  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  {&__pyx_n_s_Vect, __pyx_k_Vect, sizeof(__pyx_k_Vect), 0, 0, 1, 1},
  {&__pyx_n_s_Vectbis, __pyx_k_Vectbis, sizeof(__pyx_k_Vectbis), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_Cross, __pyx_k_Ves_Smesh_Cross, sizeof(__pyx_k_Ves_Smesh_Cross), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_Lin_SubFromD_cython, __pyx_k_Ves_Smesh_Lin_SubFromD_cython, sizeof(__pyx_k_Ves_Smesh_Lin_SubFromD_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython, __pyx_k_Ves_Smesh_Lin_SubFromInd_cython, sizeof(__pyx_k_Ves_Smesh_Lin_SubFromInd_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy, __pyx_k_Ves_Smesh_TorStruct_SubFromD_cy, sizeof(__pyx_k_Ves_Smesh_TorStruct_SubFromD_cy), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_TorStruct_SubFromInd, __pyx_k_Ves_Smesh_TorStruct_SubFromInd, sizeof(__pyx_k_Ves_Smesh_TorStruct_SubFromInd), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_Tor_SubFromD_cython, __pyx_k_Ves_Smesh_Tor_SubFromD_cython, sizeof(__pyx_k_Ves_Smesh_Tor_SubFromD_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython, __pyx_k_Ves_Smesh_Tor_SubFromInd_cython, sizeof(__pyx_k_Ves_Smesh_Tor_SubFromInd_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython, __pyx_k_Ves_Vmesh_Lin_SubFromD_cython, sizeof(__pyx_k_Ves_Vmesh_Lin_SubFromD_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython, __pyx_k_Ves_Vmesh_Lin_SubFromInd_cython, sizeof(__pyx_k_Ves_Vmesh_Lin_SubFromInd_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython, __pyx_k_Ves_Vmesh_Tor_SubFromD_cython, sizeof(__pyx_k_Ves_Vmesh_Tor_SubFromD_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython, __pyx_k_Ves_Vmesh_Tor_SubFromInd_cython, sizeof(__pyx_k_Ves_Vmesh_Tor_SubFromInd_cython), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_isInside, __pyx_k_Ves_isInside, sizeof(__pyx_k_Ves_isInside), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_meshCross_FromD, __pyx_k_Ves_meshCross_FromD, sizeof(__pyx_k_Ves_meshCross_FromD), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_meshCross_FromInd, __pyx_k_Ves_meshCross_FromInd, sizeof(__pyx_k_Ves_meshCross_FromInd), 0, 0, 1, 1},
  {&__pyx_n_s_Ves_mesh_dlfromL_cython, __pyx_k_Ves_mesh_dlfromL_cython, sizeof(__pyx_k_Ves_mesh_dlfromL_cython), 0, 0, 1, 1},
  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  {&__pyx_n_s_VperpIn, __pyx_k_VperpIn, sizeof(__pyx_k_VperpIn), 0, 0, 1, 1},
  {&__pyx_n_s_VperpOut, __pyx_k_VperpOut, sizeof(__pyx_k_VperpOut), 0, 0, 1, 1},
  {&__pyx_n_s_Vuniq, __pyx_k_Vuniq, sizeof(__pyx_k_Vuniq), 0, 0, 1, 1},
  {&__pyx_kp_s_When_fed_a_3_N_np_array_only_or, __pyx_k_When_fed_a_3_N_np_array_only_or, sizeof(__pyx_k_When_fed_a_3_N_np_array_only_or), 0, 0, 1, 0},
  {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1},
  {&__pyx_n_s_X1, __pyx_k_X1, sizeof(__pyx_k_X1), 0, 0, 1, 1},
  {&__pyx_n_s_X2, __pyx_k_X2, sizeof(__pyx_k_X2), 0, 0, 1, 1},
  {&__pyx_n_s_XMinMax, __pyx_k_XMinMax, sizeof(__pyx_k_XMinMax), 0, 0, 1, 1},
  {&__pyx_kp_s_X_Y_Z, __pyx_k_X_Y_Z, sizeof(__pyx_k_X_Y_Z), 0, 0, 1, 0},
  {&__pyx_n_s_Xn, __pyx_k_Xn, sizeof(__pyx_k_Xn), 0, 0, 1, 1},
  {&__pyx_n_s_Y, __pyx_k_Y, sizeof(__pyx_k_Y), 0, 0, 1, 1},
  {&__pyx_n_s_Y0, __pyx_k_Y0, sizeof(__pyx_k_Y0), 0, 0, 1, 1},
  {&__pyx_n_s_Y0n, __pyx_k_Y0n, sizeof(__pyx_k_Y0n), 0, 0, 1, 1},
  {&__pyx_n_s_YMinMax, __pyx_k_YMinMax, sizeof(__pyx_k_YMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_Yn, __pyx_k_Yn, sizeof(__pyx_k_Yn), 0, 0, 1, 1},
  {&__pyx_n_s_Z, __pyx_k_Z, sizeof(__pyx_k_Z), 0, 0, 1, 1},
  {&__pyx_n_s_Z0, __pyx_k_Z0, sizeof(__pyx_k_Z0), 0, 0, 1, 1},
  {&__pyx_n_s_Z0n, __pyx_k_Z0n, sizeof(__pyx_k_Z0n), 0, 0, 1, 1},
  {&__pyx_n_s_ZMinMax, __pyx_k_ZMinMax, sizeof(__pyx_k_ZMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_Zi0, __pyx_k_Zi0, sizeof(__pyx_k_Zi0), 0, 0, 1, 1},
  {&__pyx_n_s_Zi1, __pyx_k_Zi1, sizeof(__pyx_k_Zi1), 0, 0, 1, 1},
  {&__pyx_n_s_Zn, __pyx_k_Zn, sizeof(__pyx_k_Zn), 0, 0, 1, 1},
  {&__pyx_kp_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 0},
  {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0},
  {&__pyx_n_s__305, __pyx_k__305, sizeof(__pyx_k__305), 0, 0, 1, 1},
  {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
  {&__pyx_kp_s_a_unique_common_vector_Vect_as_a, __pyx_k_a_unique_common_vector_Vect_as_a, sizeof(__pyx_k_a_unique_common_vector_Vect_as_a), 0, 0, 1, 0},
  {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
  {&__pyx_n_s_abs0, __pyx_k_abs0, sizeof(__pyx_k_abs0), 0, 0, 1, 1},
  {&__pyx_n_s_abs1, __pyx_k_abs1, sizeof(__pyx_k_abs1), 0, 0, 1, 1},
  {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
  {&__pyx_n_s_all_2, __pyx_k_all_2, sizeof(__pyx_k_all_2), 0, 0, 1, 1},
  {&__pyx_n_s_allclose, __pyx_k_allclose, sizeof(__pyx_k_allclose), 0, 0, 1, 1},
  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  {&__pyx_n_s_ani, __pyx_k_ani, sizeof(__pyx_k_ani), 0, 0, 1, 1},
  {&__pyx_n_s_any, __pyx_k_any, sizeof(__pyx_k_any), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_arctan2, __pyx_k_arctan2, sizeof(__pyx_k_arctan2), 0, 0, 1, 1},
  {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
  {&__pyx_n_s_argsort, __pyx_k_argsort, sizeof(__pyx_k_argsort), 0, 0, 1, 1},
  {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
  {&__pyx_n_s_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 0, 0, 1, 1},
  {&__pyx_n_s_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 0, 0, 1, 1},
  {&__pyx_n_s_asfortranarray, __pyx_k_asfortranarray, sizeof(__pyx_k_asfortranarray), 0, 0, 1, 1},
  {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
  {&__pyx_n_s_atol, __pyx_k_atol, sizeof(__pyx_k_atol), 0, 0, 1, 1},
  {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1},
  {&__pyx_n_s_axm, __pyx_k_axm, sizeof(__pyx_k_axm), 0, 0, 1, 1},
  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  {&__pyx_n_s_bla, __pyx_k_bla, sizeof(__pyx_k_bla), 0, 0, 1, 1},
  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  {&__pyx_n_s_call, __pyx_k_call, sizeof(__pyx_k_call), 0, 0, 1, 1},
  {&__pyx_n_s_cart, __pyx_k_cart, sizeof(__pyx_k_cart), 0, 0, 1, 1},
  {&__pyx_kp_s_cc_N, __pyx_k_cc_N, sizeof(__pyx_k_cc_N), 0, 0, 1, 0},
  {&__pyx_kp_s_cc_n, __pyx_k_cc_n, sizeof(__pyx_k_cc_n), 0, 0, 1, 0},
  {&__pyx_n_s_check_ff, __pyx_k_check_ff, sizeof(__pyx_k_check_ff), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_n_s_concatenate, __pyx_k_concatenate, sizeof(__pyx_k_concatenate), 0, 0, 1, 1},
  {&__pyx_n_s_contains_point, __pyx_k_contains_point, sizeof(__pyx_k_contains_point), 0, 0, 1, 1},
  {&__pyx_n_s_contains_points, __pyx_k_contains_points, sizeof(__pyx_k_contains_points), 0, 0, 1, 1},
  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  {&__pyx_n_s_copy, __pyx_k_copy, sizeof(__pyx_k_copy), 0, 0, 1, 1},
  {&__pyx_n_s_cos, __pyx_k_cos, sizeof(__pyx_k_cos), 0, 0, 1, 1},
  {&__pyx_n_s_cyl, __pyx_k_cyl, sizeof(__pyx_k_cyl), 0, 0, 1, 1},
  {&__pyx_n_s_d1, __pyx_k_d1, sizeof(__pyx_k_d1), 0, 0, 1, 1},
  {&__pyx_n_s_d1r, __pyx_k_d1r, sizeof(__pyx_k_d1r), 0, 0, 1, 1},
  {&__pyx_n_s_d2, __pyx_k_d2, sizeof(__pyx_k_d2), 0, 0, 1, 1},
  {&__pyx_n_s_d2r, __pyx_k_d2r, sizeof(__pyx_k_d2r), 0, 0, 1, 1},
  {&__pyx_n_s_dL, __pyx_k_dL, sizeof(__pyx_k_dL), 0, 0, 1, 1},
  {&__pyx_n_s_dLMode, __pyx_k_dLMode, sizeof(__pyx_k_dLMode), 0, 0, 1, 1},
  {&__pyx_n_s_dLr, __pyx_k_dLr, sizeof(__pyx_k_dLr), 0, 0, 1, 1},
  {&__pyx_n_s_dLrRef, __pyx_k_dLrRef, sizeof(__pyx_k_dLrRef), 0, 0, 1, 1},
  {&__pyx_n_s_dPhir, __pyx_k_dPhir, sizeof(__pyx_k_dPhir), 0, 0, 1, 1},
  {&__pyx_n_s_dR, __pyx_k_dR, sizeof(__pyx_k_dR), 0, 0, 1, 1},
  {&__pyx_n_s_dR0r, __pyx_k_dR0r, sizeof(__pyx_k_dR0r), 0, 0, 1, 1},
  {&__pyx_n_s_dRPhi, __pyx_k_dRPhi, sizeof(__pyx_k_dRPhi), 0, 0, 1, 1},
  {&__pyx_n_s_dRPhir, __pyx_k_dRPhir, sizeof(__pyx_k_dRPhir), 0, 0, 1, 1},
  {&__pyx_n_s_dRPhirRef, __pyx_k_dRPhirRef, sizeof(__pyx_k_dRPhirRef), 0, 0, 1, 1},
  {&__pyx_n_s_dRr, __pyx_k_dRr, sizeof(__pyx_k_dRr), 0, 0, 1, 1},
  {&__pyx_n_s_dRr0, __pyx_k_dRr0, sizeof(__pyx_k_dRr0), 0, 0, 1, 1},
  {&__pyx_n_s_dS, __pyx_k_dS, sizeof(__pyx_k_dS), 0, 0, 1, 1},
  {&__pyx_n_s_dSM, __pyx_k_dSM, sizeof(__pyx_k_dSM), 0, 0, 1, 1},
  {&__pyx_n_s_dSMode, __pyx_k_dSMode, sizeof(__pyx_k_dSMode), 0, 0, 1, 1},
  {&__pyx_n_s_dV, __pyx_k_dV, sizeof(__pyx_k_dV), 0, 0, 1, 1},
  {&__pyx_n_s_dX, __pyx_k_dX, sizeof(__pyx_k_dX), 0, 0, 1, 1},
  {&__pyx_n_s_dX1, __pyx_k_dX1, sizeof(__pyx_k_dX1), 0, 0, 1, 1},
  {&__pyx_n_s_dX2, __pyx_k_dX2, sizeof(__pyx_k_dX2), 0, 0, 1, 1},
  {&__pyx_n_s_dXr, __pyx_k_dXr, sizeof(__pyx_k_dXr), 0, 0, 1, 1},
  {&__pyx_n_s_dY, __pyx_k_dY, sizeof(__pyx_k_dY), 0, 0, 1, 1},
  {&__pyx_n_s_dY0r, __pyx_k_dY0r, sizeof(__pyx_k_dY0r), 0, 0, 1, 1},
  {&__pyx_n_s_dYr, __pyx_k_dYr, sizeof(__pyx_k_dYr), 0, 0, 1, 1},
  {&__pyx_n_s_dZ, __pyx_k_dZ, sizeof(__pyx_k_dZ), 0, 0, 1, 1},
  {&__pyx_n_s_dZ0r, __pyx_k_dZ0r, sizeof(__pyx_k_dZ0r), 0, 0, 1, 1},
  {&__pyx_n_s_dZr, __pyx_k_dZr, sizeof(__pyx_k_dZr), 0, 0, 1, 1},
  {&__pyx_n_s_default, __pyx_k_default, sizeof(__pyx_k_default), 0, 0, 1, 1},
  {&__pyx_n_s_defaults, __pyx_k_defaults, sizeof(__pyx_k_defaults), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_dl, __pyx_k_dl, sizeof(__pyx_k_dl), 0, 0, 1, 1},
  {&__pyx_n_s_dl0, __pyx_k_dl0, sizeof(__pyx_k_dl0), 0, 0, 1, 1},
  {&__pyx_n_s_dlr, __pyx_k_dlr, sizeof(__pyx_k_dlr), 0, 0, 1, 1},
  {&__pyx_n_s_dsF, __pyx_k_dsF, sizeof(__pyx_k_dsF), 0, 0, 1, 1},
  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  {&__pyx_n_s_dus, __pyx_k_dus, sizeof(__pyx_k_dus), 0, 0, 1, 1},
  {&__pyx_n_s_dx, __pyx_k_dx, sizeof(__pyx_k_dx), 0, 0, 1, 1},
  {&__pyx_n_s_ee, __pyx_k_ee, sizeof(__pyx_k_ee), 0, 0, 1, 1},
  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_endpoint, __pyx_k_endpoint, sizeof(__pyx_k_endpoint), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_equal_nan, __pyx_k_equal_nan, sizeof(__pyx_k_equal_nan), 0, 0, 1, 1},
  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1},
  {&__pyx_n_s_ff, __pyx_k_ff, sizeof(__pyx_k_ff), 0, 0, 1, 1},
  {&__pyx_kp_s_ff_Pts_t_t_where_Pts_is_a_3_N_np, __pyx_k_ff_Pts_t_t_where_Pts_is_a_3_N_np, sizeof(__pyx_k_ff_Pts_t_t_where_Pts_is_a_3_N_np), 0, 0, 1, 0},
  {&__pyx_kp_s_ff_must_return_a_N_np_ndarray, __pyx_k_ff_must_return_a_N_np_ndarray, sizeof(__pyx_k_ff_must_return_a_N_np_ndarray), 0, 0, 1, 0},
  {&__pyx_n_s_fkwdargs, __pyx_k_fkwdargs, sizeof(__pyx_k_fkwdargs), 0, 0, 1, 1},
  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  {&__pyx_n_s_flatten, __pyx_k_flatten, sizeof(__pyx_k_flatten), 0, 0, 1, 1},
  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  {&__pyx_n_s_getBoundsInter2AngSeg, __pyx_k_getBoundsInter2AngSeg, sizeof(__pyx_k_getBoundsInter2AngSeg), 0, 0, 1, 1},
  {&__pyx_n_s_getargspec, __pyx_k_getargspec, sizeof(__pyx_k_getargspec), 0, 0, 1, 1},
  {&__pyx_n_s_getitem, __pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_hypot, __pyx_k_hypot, sizeof(__pyx_k_hypot), 0, 0, 1, 1},
  {&__pyx_n_s_i1, __pyx_k_i1, sizeof(__pyx_k_i1), 0, 0, 1, 1},
  {&__pyx_n_s_i2, __pyx_k_i2, sizeof(__pyx_k_i2), 0, 0, 1, 1},
  {&__pyx_n_s_iIn, __pyx_k_iIn, sizeof(__pyx_k_iIn), 0, 0, 1, 1},
  {&__pyx_n_s_iOut, __pyx_k_iOut, sizeof(__pyx_k_iOut), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_ii, __pyx_k_ii, sizeof(__pyx_k_ii), 0, 0, 1, 1},
  {&__pyx_n_s_iiL, __pyx_k_iiL, sizeof(__pyx_k_iiL), 0, 0, 1, 1},
  {&__pyx_n_s_iiR, __pyx_k_iiR, sizeof(__pyx_k_iiR), 0, 0, 1, 1},
  {&__pyx_n_s_iiZ, __pyx_k_iiZ, sizeof(__pyx_k_iiZ), 0, 0, 1, 1},
  {&__pyx_n_s_iii, __pyx_k_iii, sizeof(__pyx_k_iii), 0, 0, 1, 1},
  {&__pyx_n_s_iin, __pyx_k_iin, sizeof(__pyx_k_iin), 0, 0, 1, 1},
  {&__pyx_n_s_iind, __pyx_k_iind, sizeof(__pyx_k_iind), 0, 0, 1, 1},
  {&__pyx_n_s_iindF, __pyx_k_iindF, sizeof(__pyx_k_iindF), 0, 0, 1, 1},
  {&__pyx_n_s_iiphi, __pyx_k_iiphi, sizeof(__pyx_k_iiphi), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_ind, __pyx_k_ind, sizeof(__pyx_k_ind), 0, 0, 1, 1},
  {&__pyx_n_s_ind0, __pyx_k_ind0, sizeof(__pyx_k_ind0), 0, 0, 1, 1},
  {&__pyx_n_s_ind1, __pyx_k_ind1, sizeof(__pyx_k_ind1), 0, 0, 1, 1},
  {&__pyx_n_s_ind2, __pyx_k_ind2, sizeof(__pyx_k_ind2), 0, 0, 1, 1},
  {&__pyx_n_s_indBounds, __pyx_k_indBounds, sizeof(__pyx_k_indBounds), 0, 0, 1, 1},
  {&__pyx_n_s_indI, __pyx_k_indI, sizeof(__pyx_k_indI), 0, 0, 1, 1},
  {&__pyx_n_s_indL, __pyx_k_indL, sizeof(__pyx_k_indL), 0, 0, 1, 1},
  {&__pyx_n_s_indM, __pyx_k_indM, sizeof(__pyx_k_indM), 0, 0, 1, 1},
  {&__pyx_n_s_indNoNan, __pyx_k_indNoNan, sizeof(__pyx_k_indNoNan), 0, 0, 1, 1},
  {&__pyx_n_s_indR, __pyx_k_indR, sizeof(__pyx_k_indR), 0, 0, 1, 1},
  {&__pyx_n_s_indR0, __pyx_k_indR0, sizeof(__pyx_k_indR0), 0, 0, 1, 1},
  {&__pyx_n_s_indR0ii, __pyx_k_indR0ii, sizeof(__pyx_k_indR0ii), 0, 0, 1, 1},
  {&__pyx_n_s_indX, __pyx_k_indX, sizeof(__pyx_k_indX), 0, 0, 1, 1},
  {&__pyx_n_s_indY, __pyx_k_indY, sizeof(__pyx_k_indY), 0, 0, 1, 1},
  {&__pyx_n_s_indY0, __pyx_k_indY0, sizeof(__pyx_k_indY0), 0, 0, 1, 1},
  {&__pyx_n_s_indZ, __pyx_k_indZ, sizeof(__pyx_k_indZ), 0, 0, 1, 1},
  {&__pyx_n_s_indZ0, __pyx_k_indZ0, sizeof(__pyx_k_indZ0), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_indiijj, __pyx_k_indiijj, sizeof(__pyx_k_indiijj), 0, 0, 1, 1},
  {&__pyx_n_s_indin, __pyx_k_indin, sizeof(__pyx_k_indin), 0, 0, 1, 1},
  {&__pyx_n_s_indok, __pyx_k_indok, sizeof(__pyx_k_indok), 0, 0, 1, 1},
  {&__pyx_n_s_indout, __pyx_k_indout, sizeof(__pyx_k_indout), 0, 0, 1, 1},
  {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
  {&__pyx_n_s_insp, __pyx_k_insp, sizeof(__pyx_k_insp), 0, 0, 1, 1},
  {&__pyx_n_s_inspect, __pyx_k_inspect, sizeof(__pyx_k_inspect), 0, 0, 1, 1},
  {&__pyx_n_s_int64, __pyx_k_int64, sizeof(__pyx_k_int64), 0, 0, 1, 1},
  {&__pyx_n_s_isnan, __pyx_k_isnan, sizeof(__pyx_k_isnan), 0, 0, 1, 1},
  {&__pyx_n_s_isreal, __pyx_k_isreal, sizeof(__pyx_k_isreal), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1},
  {&__pyx_n_s_jj, __pyx_k_jj, sizeof(__pyx_k_jj), 0, 0, 1, 1},
  {&__pyx_n_s_jj0, __pyx_k_jj0, sizeof(__pyx_k_jj0), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_kOut, __pyx_k_kOut, sizeof(__pyx_k_kOut), 0, 0, 1, 1},
  {&__pyx_n_s_kPIn, __pyx_k_kPIn, sizeof(__pyx_k_kPIn), 0, 0, 1, 1},
  {&__pyx_n_s_kPMin, __pyx_k_kPMin, sizeof(__pyx_k_kPMin), 0, 0, 1, 1},
  {&__pyx_n_s_kPOut, __pyx_k_kPOut, sizeof(__pyx_k_kPOut), 0, 0, 1, 1},
  {&__pyx_n_s_kind, __pyx_k_kind, sizeof(__pyx_k_kind), 0, 0, 1, 1},
  {&__pyx_n_s_kk, __pyx_k_kk, sizeof(__pyx_k_kk), 0, 0, 1, 1},
  {&__pyx_n_s_kkb, __pyx_k_kkb, sizeof(__pyx_k_kkb), 0, 0, 1, 1},
  {&__pyx_n_s_kkk, __pyx_k_kkk, sizeof(__pyx_k_kkk), 0, 0, 1, 1},
  {&__pyx_n_s_kpin, __pyx_k_kpin, sizeof(__pyx_k_kpin), 0, 0, 1, 1},
  {&__pyx_n_s_kw, __pyx_k_kw, sizeof(__pyx_k_kw), 0, 0, 1, 1},
  {&__pyx_n_s_layout, __pyx_k_layout, sizeof(__pyx_k_layout), 0, 0, 1, 1},
  {&__pyx_n_s_layout_in, __pyx_k_layout_in, sizeof(__pyx_k_layout_in), 0, 0, 1, 1},
  {&__pyx_n_s_lim, __pyx_k_lim, sizeof(__pyx_k_lim), 0, 0, 1, 1},
  {&__pyx_n_s_lin, __pyx_k_lin, sizeof(__pyx_k_lin), 0, 0, 1, 1},
  {&__pyx_n_s_linspace, __pyx_k_linspace, sizeof(__pyx_k_linspace), 0, 0, 1, 1},
  {&__pyx_n_s_ll, __pyx_k_ll, sizeof(__pyx_k_ll), 0, 0, 1, 1},
  {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1},
  {&__pyx_n_s_lslim, __pyx_k_lslim, sizeof(__pyx_k_lslim), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_margin, __pyx_k_margin, sizeof(__pyx_k_margin), 0, 0, 1, 1},
  {&__pyx_n_s_matplotlib_path, __pyx_k_matplotlib_path, sizeof(__pyx_k_matplotlib_path), 0, 0, 1, 1},
  {&__pyx_n_s_max, __pyx_k_max, sizeof(__pyx_k_max), 0, 0, 1, 1},
  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
  {&__pyx_n_s_min, __pyx_k_min, sizeof(__pyx_k_min), 0, 0, 1, 1},
  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  {&__pyx_kp_s_multiple_vectors_Vect_as_a_3_N_n, __pyx_k_multiple_vectors_Vect_as_a_3_N_n, sizeof(__pyx_k_multiple_vectors_Vect_as_a_3_N_n), 0, 0, 1, 0},
  {&__pyx_kp_s_must_be_a_callable_function, __pyx_k_must_be_a_callable_function, sizeof(__pyx_k_must_be_a_callable_function), 0, 0, 1, 0},
  {&__pyx_kp_s_must_have_kwarg_t_None_for_time, __pyx_k_must_have_kwarg_t_None_for_time, sizeof(__pyx_k_must_have_kwarg_t_None_for_time), 0, 0, 1, 0},
  {&__pyx_kp_s_must_take_one_positional_arg_a, __pyx_k_must_take_one_positional_arg_a, sizeof(__pyx_k_must_take_one_positional_arg_a), 0, 0, 1, 0},
  {&__pyx_kp_s_must_take_only_one_positional_a, __pyx_k_must_take_only_one_positional_a, sizeof(__pyx_k_must_take_only_one_positional_a), 0, 0, 1, 0},
  {&__pyx_n_s_n1, __pyx_k_n1, sizeof(__pyx_k_n1), 0, 0, 1, 1},
  {&__pyx_n_s_n2, __pyx_k_n2, sizeof(__pyx_k_n2), 0, 0, 1, 1},
  {&__pyx_n_s_nBounds, __pyx_k_nBounds, sizeof(__pyx_k_nBounds), 0, 0, 1, 1},
  {&__pyx_n_s_nL, __pyx_k_nL, sizeof(__pyx_k_nL), 0, 0, 1, 1},
  {&__pyx_n_s_nL0, __pyx_k_nL0, sizeof(__pyx_k_nL0), 0, 0, 1, 1},
  {&__pyx_n_s_nL1, __pyx_k_nL1, sizeof(__pyx_k_nL1), 0, 0, 1, 1},
  {&__pyx_n_s_nPhi0, __pyx_k_nPhi0, sizeof(__pyx_k_nPhi0), 0, 0, 1, 1},
  {&__pyx_n_s_nPhi1, __pyx_k_nPhi1, sizeof(__pyx_k_nPhi1), 0, 0, 1, 1},
  {&__pyx_n_s_nRPhi0, __pyx_k_nRPhi0, sizeof(__pyx_k_nRPhi0), 0, 0, 1, 1},
  {&__pyx_kp_s_n_cc, __pyx_k_n_cc, sizeof(__pyx_k_n_cc), 0, 0, 1, 0},
  {&__pyx_n_s_na, __pyx_k_na, sizeof(__pyx_k_na), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1},
  {&__pyx_n_s_ndarray, __pyx_k_ndarray, sizeof(__pyx_k_ndarray), 0, 0, 1, 1},
  {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_nii, __pyx_k_nii, sizeof(__pyx_k_nii), 0, 0, 1, 1},
  {&__pyx_n_s_nn, __pyx_k_nn, sizeof(__pyx_k_nn), 0, 0, 1, 1},
  {&__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},
  {&__pyx_n_s_nonzero, __pyx_k_nonzero, sizeof(__pyx_k_nonzero), 0, 0, 1, 1},
  {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  {&__pyx_n_s_nt, __pyx_k_nt, sizeof(__pyx_k_nt), 0, 0, 1, 1},
  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  {&__pyx_n_s_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 0, 0, 1, 1},
  {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
  {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
  {&__pyx_n_s_pIn, __pyx_k_pIn, sizeof(__pyx_k_pIn), 0, 0, 1, 1},
  {&__pyx_n_s_pN, __pyx_k_pN, sizeof(__pyx_k_pN), 0, 0, 1, 1},
  {&__pyx_n_s_pNbis, __pyx_k_pNbis, sizeof(__pyx_k_pNbis), 0, 0, 1, 1},
  {&__pyx_n_s_pOut, __pyx_k_pOut, sizeof(__pyx_k_pOut), 0, 0, 1, 1},
  {&__pyx_n_s_pP, __pyx_k_pP, sizeof(__pyx_k_pP), 0, 0, 1, 1},
  {&__pyx_n_s_pPbis, __pyx_k_pPbis, sizeof(__pyx_k_pPbis), 0, 0, 1, 1},
  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  {&__pyx_n_s_parameters, __pyx_k_parameters, sizeof(__pyx_k_parameters), 0, 0, 1, 1},
  {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
  {&__pyx_n_s_phi, __pyx_k_phi, sizeof(__pyx_k_phi), 0, 0, 1, 1},
  {&__pyx_n_s_phiMinMax, __pyx_k_phiMinMax, sizeof(__pyx_k_phiMinMax), 0, 0, 1, 1},
  {&__pyx_n_s_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_poly, __pyx_k_poly, sizeof(__pyx_k_poly), 0, 0, 1, 1},
  {&__pyx_n_s_pp, __pyx_k_pp, sizeof(__pyx_k_pp), 0, 0, 1, 1},
  {&__pyx_n_s_pts, __pyx_k_pts, sizeof(__pyx_k_pts), 0, 0, 1, 1},
  {&__pyx_n_s_ptsrz, __pyx_k_ptsrz, sizeof(__pyx_k_ptsrz), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_ravel, __pyx_k_ravel, sizeof(__pyx_k_ravel), 0, 0, 1, 1},
  {&__pyx_n_s_real, __pyx_k_real, sizeof(__pyx_k_real), 0, 0, 1, 1},
  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  {&__pyx_n_s_rel, __pyx_k_rel, sizeof(__pyx_k_rel), 0, 0, 1, 1},
  {&__pyx_n_s_repeat, __pyx_k_repeat, sizeof(__pyx_k_repeat), 0, 0, 1, 1},
  {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
  {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1},
  {&__pyx_n_s_resize, __pyx_k_resize, sizeof(__pyx_k_resize), 0, 0, 1, 1},
  {&__pyx_n_s_romb, __pyx_k_romb, sizeof(__pyx_k_romb), 0, 0, 1, 1},
  {&__pyx_n_s_roots, __pyx_k_roots, sizeof(__pyx_k_roots), 0, 0, 1, 1},
  {&__pyx_n_s_scipy_integrate, __pyx_k_scipy_integrate, sizeof(__pyx_k_scipy_integrate), 0, 0, 1, 1},
  {&__pyx_n_s_scpintg, __pyx_k_scpintg, sizeof(__pyx_k_scpintg), 0, 0, 1, 1},
  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  {&__pyx_n_s_show, __pyx_k_show, sizeof(__pyx_k_show), 0, 0, 1, 1},
  {&__pyx_n_s_sig, __pyx_k_sig, sizeof(__pyx_k_sig), 0, 0, 1, 1},
  {&__pyx_n_s_signature, __pyx_k_signature, sizeof(__pyx_k_signature), 0, 0, 1, 1},
  {&__pyx_n_s_simps, __pyx_k_simps, sizeof(__pyx_k_simps), 0, 0, 1, 1},
  {&__pyx_n_s_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 0, 0, 1, 1},
  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  {&__pyx_n_s_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 0, 0, 1, 1},
  {&__pyx_n_s_ss, __pyx_k_ss, sizeof(__pyx_k_ss), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  {&__pyx_n_s_stre, __pyx_k_stre, sizeof(__pyx_k_stre), 0, 0, 1, 1},
  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  {&__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},
  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1},
  {&__pyx_n_s_swapaxes, __pyx_k_swapaxes, sizeof(__pyx_k_swapaxes), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_kp_s_t_a_len_nt_iterable_must_return, __pyx_k_t_a_len_nt_iterable_must_return, sizeof(__pyx_k_t_a_len_nt_iterable_must_return), 0, 0, 1, 0},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_theta, __pyx_k_theta, sizeof(__pyx_k_theta), 0, 0, 1, 1},
  {&__pyx_n_s_tile, __pyx_k_tile, sizeof(__pyx_k_tile), 0, 0, 1, 1},
  {&__pyx_n_s_tofu_geom__GG03, __pyx_k_tofu_geom__GG03, sizeof(__pyx_k_tofu_geom__GG03), 0, 0, 1, 1},
  {&__pyx_kp_s_tofu_geom__GG03_pyx, __pyx_k_tofu_geom__GG03_pyx, sizeof(__pyx_k_tofu_geom__GG03_pyx), 0, 0, 1, 0},
  {&__pyx_n_s_tor, __pyx_k_tor, sizeof(__pyx_k_tor), 0, 0, 1, 1},
  {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1},
  {&__pyx_n_s_u, __pyx_k_u, sizeof(__pyx_k_u), 0, 0, 1, 1},
  {&__pyx_n_s_u0, __pyx_k_u0, sizeof(__pyx_k_u0), 0, 0, 1, 1},
  {&__pyx_n_s_u1, __pyx_k_u1, sizeof(__pyx_k_u1), 0, 0, 1, 1},
  {&__pyx_n_s_u2, __pyx_k_u2, sizeof(__pyx_k_u2), 0, 0, 1, 1},
  {&__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},
  {&__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},
  {&__pyx_n_s_unique, __pyx_k_unique, sizeof(__pyx_k_unique), 0, 0, 1, 1},
  {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_us, __pyx_k_us, sizeof(__pyx_k_us), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_v0, __pyx_k_v0, sizeof(__pyx_k_v0), 0, 0, 1, 1},
  {&__pyx_n_s_v1, __pyx_k_v1, sizeof(__pyx_k_v1), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 0, 1, 1},
  {&__pyx_n_s_vperpIn, __pyx_k_vperpIn, sizeof(__pyx_k_vperpIn), 0, 0, 1, 1},
  {&__pyx_n_s_vperpOut, __pyx_k_vperpOut, sizeof(__pyx_k_vperpOut), 0, 0, 1, 1},
  {&__pyx_n_s_vstack, __pyx_k_vstack, sizeof(__pyx_k_vstack), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_kp_s_x_y_z, __pyx_k_x_y_z, sizeof(__pyx_k_x_y_z), 0, 0, 1, 0},
  {&__pyx_n_s_xi, __pyx_k_xi, sizeof(__pyx_k_xi), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_z, __pyx_k_z, sizeof(__pyx_k_z), 0, 0, 1, 1},
  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  {&__pyx_n_s_zz, __pyx_k_zz, sizeof(__pyx_k_zz), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 51, __pyx_L1_error)
  __pyx_builtin_any = __Pyx_GetBuiltinName(__pyx_n_s_any); if (!__pyx_builtin_any) __PYX_ERR(0, 63, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 147, __pyx_L1_error)
  __pyx_builtin_max = __Pyx_GetBuiltinName(__pyx_n_s_max); if (!__pyx_builtin_max) __PYX_ERR(0, 171, __pyx_L1_error)
  __pyx_builtin_min = __Pyx_GetBuiltinName(__pyx_n_s_min); if (!__pyx_builtin_min) __PYX_ERR(0, 182, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 235, __pyx_L1_error)
  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 823, __pyx_L1_error)
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1013, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 146, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 149, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 398, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 601, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 820, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "tofu/geom/_GG03.pyx":59
 * 
 *     # Get order
 *     Ins = In.replace('(','').replace(')','').split(',')             # <<<<<<<<<<<<<<
 *     Outs = Out.replace('(','').replace(')','').split(',')
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 */
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_kp_s__2, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);
  __pyx_tuple__6 = PyTuple_Pack(2, __pyx_kp_s__5, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "tofu/geom/_GG03.pyx":60
 *     # Get order
 *     Ins = In.replace('(','').replace(')','').split(',')
 *     Outs = Out.replace('(','').replace(')','').split(',')             # <<<<<<<<<<<<<<
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 */
  __pyx_tuple__8 = PyTuple_Pack(2, __pyx_kp_s__2, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_s__5, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 60, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "tofu/geom/_GG03.pyx":63
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Ins]), "Non-valid In !"
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 *     InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart'             # <<<<<<<<<<<<<<
 *     OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart'
 * 
 */
  __pyx_tuple__11 = PyTuple_Pack(2, __pyx_n_s_r, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "tofu/geom/_GG03.pyx":64
 *     assert all([ss in ['x','y','z','r','phi'] for ss in Outs]), "Non-valid Out !"
 *     InT = 'cyl' if any([ss in Ins for ss in ['r','phi']]) else 'cart'
 *     OutT = 'cyl' if any([ss in Outs for ss in ['r','phi']]) else 'cart'             # <<<<<<<<<<<<<<
 * 
 *     ndim = Pts.ndim
 */
  __pyx_tuple__12 = PyTuple_Pack(2, __pyx_n_s_r, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 64, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "tofu/geom/_GG03.pyx":76
 *         for ii in Outs:
 *             if ii=='phi':
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))             # <<<<<<<<<<<<<<
 *             else:
 *                 pts.append(Pts[Ins.index(ii),:])
 */
  __pyx_slice__13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__13)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__13);
  __Pyx_GIVEREF(__pyx_slice__13);
  __pyx_slice__14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__14);
  __Pyx_GIVEREF(__pyx_slice__14);

  /* "tofu/geom/_GG03.pyx":78
 *                 pts.append(np.arctan2(np.sin(Pts[Ins.index(ii),:]),np.cos(Pts[Ins.index(ii),:])))
 *             else:
 *                 pts.append(Pts[Ins.index(ii),:])             # <<<<<<<<<<<<<<
 *     elif InT=='cart':
 *         pts = []
 */
  __pyx_slice__15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__15)) __PYX_ERR(0, 78, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__15);
  __Pyx_GIVEREF(__pyx_slice__15);

  /* "tofu/geom/_GG03.pyx":83
 *         for ii in Outs:
 *             if ii=='r':
 *                 assert all([ss in Ins for ss in ['x','y']])             # <<<<<<<<<<<<<<
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))
 *             elif ii=='z':
 */
  __pyx_tuple__16 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 83, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "tofu/geom/_GG03.pyx":84
 *             if ii=='r':
 *                 assert all([ss in Ins for ss in ['x','y']])
 *                 pts.append(np.hypot(Pts[Ins.index('x'),:],Pts[Ins.index('y'),:]))             # <<<<<<<<<<<<<<
 *             elif ii=='z':
 *                 assert 'z' in Ins
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_slice__18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__18);
  __Pyx_GIVEREF(__pyx_slice__18);
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_slice__20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__20)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__20);
  __Pyx_GIVEREF(__pyx_slice__20);

  /* "tofu/geom/_GG03.pyx":87
 *             elif ii=='z':
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])             # <<<<<<<<<<<<<<
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_z); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(0, 87, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__22);
  __Pyx_GIVEREF(__pyx_slice__22);

  /* "tofu/geom/_GG03.pyx":89
 *                 pts.append(Pts[Ins.index('z'),:])
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):             # <<<<<<<<<<<<<<
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))
 *                 elif CrossRef is not None:
 */
  __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_x, __pyx_n_s_y); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 89, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "tofu/geom/_GG03.pyx":90
 *             elif ii=='phi':
 *                 if all([ss in Ins for ss in ['x','y']]):
 *                     pts.append(np.arctan2(Pts[Ins.index('y'),:],Pts[Ins.index('x'),:]))             # <<<<<<<<<<<<<<
 *                 elif CrossRef is not None:
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_y); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__25);
  __Pyx_GIVEREF(__pyx_slice__25);
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_x); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(0, 90, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__27);
  __Pyx_GIVEREF(__pyx_slice__27);

  /* "tofu/geom/_GG03.pyx":94
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 *                     raise Exception("There is no phi value available !")             # <<<<<<<<<<<<<<
 *     else:
 *         pts = []
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_There_is_no_phi_value_available); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 94, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "tofu/geom/_GG03.pyx":99
 *         for ii in Outs:
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):             # <<<<<<<<<<<<<<
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))
 *                 elif CrossRef is not None:
 */
  __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_r, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "tofu/geom/_GG03.pyx":100
 *             if ii=='x':
 *                 if all([ss in Ins for ss in ['r','phi']]):
 *                     pts.append(Pts[Ins.index('r'),:]*np.cos(Pts[Ins.index('phi'),:]))             # <<<<<<<<<<<<<<
 *                 elif CrossRef is not None:
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_r); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_slice__31 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__31)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__31);
  __Pyx_GIVEREF(__pyx_slice__31);
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_slice__33 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__33)) __PYX_ERR(0, 100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__33);
  __Pyx_GIVEREF(__pyx_slice__33);

  /* "tofu/geom/_GG03.pyx":104
 *                     pts.append( CrossRef*np.ones((Pts.shape[1],)) )
 *                 else:
 *                     raise Exception("There is no x value available !")             # <<<<<<<<<<<<<<
 *             elif ii=='y':
 *                 assert all([ss in Ins for ss in ['r','phi']])
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_There_is_no_x_value_available); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "tofu/geom/_GG03.pyx":106
 *                     raise Exception("There is no x value available !")
 *             elif ii=='y':
 *                 assert all([ss in Ins for ss in ['r','phi']])             # <<<<<<<<<<<<<<
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))
 *             elif ii=='z':
 */
  __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_r, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);

  /* "tofu/geom/_GG03.pyx":107
 *             elif ii=='y':
 *                 assert all([ss in Ins for ss in ['r','phi']])
 *                 pts.append(Pts[Ins.index('r'),:]*np.sin(Pts[Ins.index('phi'),:]))             # <<<<<<<<<<<<<<
 *             elif ii=='z':
 *                 assert 'z' in Ins
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_r); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_slice__37 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__37)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__37);
  __Pyx_GIVEREF(__pyx_slice__37);
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_slice__39 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__39)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__39);
  __Pyx_GIVEREF(__pyx_slice__39);

  /* "tofu/geom/_GG03.pyx":110
 *             elif ii=='z':
 *                 assert 'z' in Ins
 *                 pts.append(Pts[Ins.index('z'),:])             # <<<<<<<<<<<<<<
 * 
 *     # Format output
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_z); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);
  __pyx_slice__41 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__41)) __PYX_ERR(0, 110, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__41);
  __Pyx_GIVEREF(__pyx_slice__41);

  /* "tofu/geom/_GG03.pyx":178
 *         assert layout_in is None or layout_in.lower() in ['(cc,n)','(n,cc)'], "Arg layout_in must be in ['(cc,n)','(n,cc)'] !"
 * 
 *     if np.shape(Poly)==(3,3):             # <<<<<<<<<<<<<<
 *         assert not layout_in is None, "Could not resolve the input layout of Poly because shape==(3,3), specify !"
 *         poly = np.array(Poly).T if layout_in.lower()=='(n,cc)' else np.array(Poly)
 */
  __pyx_tuple__42 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_3); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__42);
  __Pyx_GIVEREF(__pyx_tuple__42);

  /* "tofu/geom/_GG03.pyx":183
 *     else:
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):             # <<<<<<<<<<<<<<
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)
 *     if poly.shape[0]==2 and not Clock is None:
 */
  __pyx_slice__43 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__43)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__43);
  __Pyx_GIVEREF(__pyx_slice__43);
  __pyx_tuple__44 = PyTuple_Pack(2, __pyx_slice__43, __pyx_int_0); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__44);
  __Pyx_GIVEREF(__pyx_tuple__44);
  __pyx_slice__45 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__45)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__45);
  __Pyx_GIVEREF(__pyx_slice__45);
  __pyx_tuple__46 = PyTuple_Pack(2, __pyx_slice__45, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 183, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);

  /* "tofu/geom/_GG03.pyx":184
 *         poly = np.array(Poly).T if min(np.shape(Poly))==Poly.shape[1] else np.array(Poly)
 *     if not np.allclose(poly[:,0],poly[:,-1], atol=1.e-9):
 *         poly = np.concatenate((poly,poly[:,0:1]),axis=1)             # <<<<<<<<<<<<<<
 *     if poly.shape[0]==2 and not Clock is None:
 *         if not Clock==Poly_isClockwise(poly):
 */
  __pyx_slice__47 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__47)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__47);
  __Pyx_GIVEREF(__pyx_slice__47);
  __pyx_slice__48 = PySlice_New(__pyx_int_0, __pyx_int_1, Py_None); if (unlikely(!__pyx_slice__48)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__48);
  __Pyx_GIVEREF(__pyx_slice__48);
  __pyx_tuple__49 = PyTuple_Pack(2, __pyx_slice__47, __pyx_slice__48); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);

  /* "tofu/geom/_GG03.pyx":187
 *     if poly.shape[0]==2 and not Clock is None:
 *         if not Clock==Poly_isClockwise(poly):
 *             poly = poly[:,::-1]             # <<<<<<<<<<<<<<
 *     if not close:
 *         poly = poly[:,:-1]
 */
  __pyx_slice__50 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__50)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__50);
  __Pyx_GIVEREF(__pyx_slice__50);
  __pyx_slice__51 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__51)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__51);
  __Pyx_GIVEREF(__pyx_slice__51);
  __pyx_tuple__52 = PyTuple_Pack(2, __pyx_slice__50, __pyx_slice__51); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 187, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);

  /* "tofu/geom/_GG03.pyx":189
 *             poly = poly[:,::-1]
 *     if not close:
 *         poly = poly[:,:-1]             # <<<<<<<<<<<<<<
 *     if layout.lower()=='(n,cc)':
 *         poly = poly.T
 */
  __pyx_slice__53 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__53)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__53);
  __Pyx_GIVEREF(__pyx_slice__53);
  __pyx_slice__54 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__54)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__54);
  __Pyx_GIVEREF(__pyx_slice__54);
  __pyx_tuple__55 = PyTuple_Pack(2, __pyx_slice__53, __pyx_slice__54); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);

  /* "tofu/geom/_GG03.pyx":199
 * 
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]             # <<<<<<<<<<<<<<
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 *     cdef double BV0 = np.sum((Ri0*Zi1 - Zi0*Ri1) * 0.5 * (Ri1**2 + Ri1*Ri0 + Ri0**2)) / (6.*V)
 */
  __pyx_slice__56 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__56)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__56);
  __Pyx_GIVEREF(__pyx_slice__56);
  __pyx_tuple__57 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__56); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_slice__58 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__58)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__58);
  __Pyx_GIVEREF(__pyx_slice__58);
  __pyx_tuple__59 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__58); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  __pyx_slice__60 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__60)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__60);
  __Pyx_GIVEREF(__pyx_slice__60);
  __pyx_tuple__61 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__60); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_slice__62 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__62)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__62);
  __Pyx_GIVEREF(__pyx_slice__62);
  __pyx_tuple__63 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__62); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "tofu/geom/_GG03.pyx":298
 *         else:
 *             pts = CoordShift(Pts, In=In, Out='(R,Z,Phi)')
 *             ind0 = Path(VPoly.T).contains_points(pts[:2,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if hasattr(Lim[0],'__iter__'):
 *                 ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 */
  __pyx_slice__64 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__64)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__64);
  __Pyx_GIVEREF(__pyx_slice__64);
  __pyx_slice__65 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__65)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__65);
  __Pyx_GIVEREF(__pyx_slice__65);
  __pyx_tuple__66 = PyTuple_Pack(2, __pyx_slice__64, __pyx_slice__65); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 298, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "tofu/geom/_GG03.pyx":304
 *                     lim = [Catan2(Csin(Lim[ii][0]),Ccos(Lim[ii][0])), Catan2(Csin(Lim[ii][1]),Ccos(Lim[ii][1]))]
 *                     if lim[0]<lim[1]:
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])             # <<<<<<<<<<<<<<
 *                     else:
 *                         ind[ii,:] = ind0 & ((pts[2,:]>=lim[0]) | (pts[2,:]<=lim[1]))
 */
  __pyx_slice__67 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__67)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__67);
  __Pyx_GIVEREF(__pyx_slice__67);
  __pyx_tuple__68 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__67); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);
  __pyx_slice__69 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__69)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__69);
  __Pyx_GIVEREF(__pyx_slice__69);
  __pyx_tuple__70 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__69); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);
  __pyx_slice__71 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__71)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__71);
  __Pyx_GIVEREF(__pyx_slice__71);

  /* "tofu/geom/_GG03.pyx":306
 *                         ind[ii,:] = ind0 & (pts[2,:]>=lim[0]) & (pts[2,:]<=lim[1])
 *                     else:
 *                         ind[ii,:] = ind0 & ((pts[2,:]>=lim[0]) | (pts[2,:]<=lim[1]))             # <<<<<<<<<<<<<<
 *             else:
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]
 */
  __pyx_slice__72 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__72)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__72);
  __Pyx_GIVEREF(__pyx_slice__72);
  __pyx_tuple__73 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__72); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_slice__74 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__74)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__74);
  __Pyx_GIVEREF(__pyx_slice__74);
  __pyx_tuple__75 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__74); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_slice__76 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__76)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__76);
  __Pyx_GIVEREF(__pyx_slice__76);

  /* "tofu/geom/_GG03.pyx":310
 *                 Lim = [Catan2(Csin(Lim[0]),Ccos(Lim[0])), Catan2(Csin(Lim[1]),Ccos(Lim[1]))]
 *                 if Lim[0]<Lim[1]:
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])             # <<<<<<<<<<<<<<
 *                 else:
 *                     ind = ind0 & ((pts[2,:]>=Lim[0]) | (pts[2,:]<=Lim[1]))
 */
  __pyx_slice__77 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__77)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__77);
  __Pyx_GIVEREF(__pyx_slice__77);
  __pyx_tuple__78 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__77); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);
  __pyx_slice__79 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__79)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__79);
  __Pyx_GIVEREF(__pyx_slice__79);
  __pyx_tuple__80 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__79); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__80);
  __Pyx_GIVEREF(__pyx_tuple__80);

  /* "tofu/geom/_GG03.pyx":312
 *                     ind = ind0 & (pts[2,:]>=Lim[0]) & (pts[2,:]<=Lim[1])
 *                 else:
 *                     ind = ind0 & ((pts[2,:]>=Lim[0]) | (pts[2,:]<=Lim[1]))             # <<<<<<<<<<<<<<
 *     else:
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')
 */
  __pyx_slice__81 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__81)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__81);
  __Pyx_GIVEREF(__pyx_slice__81);
  __pyx_tuple__82 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__81); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__82);
  __Pyx_GIVEREF(__pyx_tuple__82);
  __pyx_slice__83 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__83)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__83);
  __Pyx_GIVEREF(__pyx_slice__83);
  __pyx_tuple__84 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__83); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 312, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__84);
  __Pyx_GIVEREF(__pyx_tuple__84);

  /* "tofu/geom/_GG03.pyx":315
 *     else:
 *         pts = CoordShift(Pts, In=In, Out='(X,Y,Z)')
 *         ind0 = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *         if hasattr(Lim[0],'__iter__'):
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 */
  __pyx_slice__85 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__85)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__85);
  __Pyx_GIVEREF(__pyx_slice__85);
  __pyx_slice__86 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__86)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__86);
  __Pyx_GIVEREF(__pyx_slice__86);
  __pyx_tuple__87 = PyTuple_Pack(2, __pyx_slice__85, __pyx_slice__86); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 315, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);

  /* "tofu/geom/_GG03.pyx":319
 *             ind = np.zeros((len(Lim),Pts.shape[1]),dtype=bool)
 *             for ii in range(0,len(Lim)):
 *                 ind[ii,:] = ind0 & (pts[0,:]>=Lim[ii][0]) & (pts[0,:]<=Lim[ii][1])             # <<<<<<<<<<<<<<
 *         else:
 *             ind = ind0 & (pts[0,:]>=Lim[0]) & (pts[0,:]<=Lim[1])
 */
  __pyx_slice__88 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__88)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__88);
  __Pyx_GIVEREF(__pyx_slice__88);
  __pyx_tuple__89 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__88); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_slice__90 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__90)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__90);
  __Pyx_GIVEREF(__pyx_slice__90);
  __pyx_tuple__91 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__90); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_slice__92 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__92)) __PYX_ERR(0, 319, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__92);
  __Pyx_GIVEREF(__pyx_slice__92);

  /* "tofu/geom/_GG03.pyx":321
 *                 ind[ii,:] = ind0 & (pts[0,:]>=Lim[ii][0]) & (pts[0,:]<=Lim[ii][1])
 *         else:
 *             ind = ind0 & (pts[0,:]>=Lim[0]) & (pts[0,:]<=Lim[1])             # <<<<<<<<<<<<<<
 *     return ind
 * 
 */
  __pyx_slice__93 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__93)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__93);
  __Pyx_GIVEREF(__pyx_slice__93);
  __pyx_tuple__94 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__93); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__94);
  __Pyx_GIVEREF(__pyx_tuple__94);
  __pyx_slice__95 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__95)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__95);
  __Pyx_GIVEREF(__pyx_slice__95);
  __pyx_tuple__96 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__95); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__96);
  __Pyx_GIVEREF(__pyx_tuple__96);

  /* "tofu/geom/_GG03.pyx":424
 *         iin = Path(VPoly.T).contains_points(Pts.T, transform=None, radius=0.0)
 *         if np.sum(iin)==1:
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]             # <<<<<<<<<<<<<<
 *         else:
 *             Pts, dS, ind = Pts[:,iin], dS[iin], ind[iin]
 */
  __pyx_slice__97 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__97)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__97);
  __Pyx_GIVEREF(__pyx_slice__97);
  __pyx_tuple__98 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);
  __pyx_tuple__99 = PyTuple_Pack(1, __pyx_tuple__98); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__99);
  __Pyx_GIVEREF(__pyx_tuple__99);

  /* "tofu/geom/_GG03.pyx":426
 *             Pts, dS, ind = Pts[:,iin].reshape((2,1)), dS[iin], ind[iin]
 *         else:
 *             Pts, dS, ind = Pts[:,iin], dS[iin], ind[iin]             # <<<<<<<<<<<<<<
 *     return Pts, dS, ind, d1r, d2r
 * 
 */
  __pyx_slice__100 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__100)) __PYX_ERR(0, 426, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__100);
  __Pyx_GIVEREF(__pyx_slice__100);

  /* "tofu/geom/_GG03.pyx":505
 *     PtsCross, dLr, ind, Rref = np.array(LPtsCross).T, np.array(LdLr), np.array(Lind,dtype=int), np.array(LRref)
 *     if D1 is not None:
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])             # <<<<<<<<<<<<<<
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]
 */
  __pyx_slice__101 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__101)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__101);
  __Pyx_GIVEREF(__pyx_slice__101);
  __pyx_tuple__102 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__101); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);
  __pyx_slice__103 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__103)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__103);
  __Pyx_GIVEREF(__pyx_slice__103);
  __pyx_tuple__104 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__103); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 505, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__104);
  __Pyx_GIVEREF(__pyx_tuple__104);

  /* "tofu/geom/_GG03.pyx":506
 *     if D1 is not None:
 *         indin = (PtsCross[0,:]>=D1[0]) & (PtsCross[0,:]<=D1[1])
 *         PtsCross = PtsCross[:,indin]             # <<<<<<<<<<<<<<
 *         dLr, ind = dLr[indin], ind[indin]
 *     if D2 is not None:
 */
  __pyx_slice__105 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__105)) __PYX_ERR(0, 506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__105);
  __Pyx_GIVEREF(__pyx_slice__105);

  /* "tofu/geom/_GG03.pyx":509
 *         dLr, ind = dLr[indin], ind[indin]
 *     if D2 is not None:
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])             # <<<<<<<<<<<<<<
 *         PtsCross = PtsCross[:,indin]
 *         dLr, ind = dLr[indin], ind[indin]
 */
  __pyx_slice__106 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__106)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__106);
  __Pyx_GIVEREF(__pyx_slice__106);
  __pyx_tuple__107 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__106); if (unlikely(!__pyx_tuple__107)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_slice__108 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__108)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__108);
  __Pyx_GIVEREF(__pyx_slice__108);
  __pyx_tuple__109 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__108); if (unlikely(!__pyx_tuple__109)) __PYX_ERR(0, 509, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);

  /* "tofu/geom/_GG03.pyx":510
 *     if D2 is not None:
 *         indin = (PtsCross[1,:]>=D2[0]) & (PtsCross[1,:]<=D2[1])
 *         PtsCross = PtsCross[:,indin]             # <<<<<<<<<<<<<<
 *         dLr, ind = dLr[indin], ind[indin]
 * 
 */
  __pyx_slice__110 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__110)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__110);
  __Pyx_GIVEREF(__pyx_slice__110);

  /* "tofu/geom/_GG03.pyx":634
 *     if Out.lower()=='(x,y,z)':
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])]) # To make sure the indices are in increasing order             # <<<<<<<<<<<<<<
 *             for zz in range(0,Zn):
 *                 for jj in range(0,Phin[ii]):
 */
  __pyx_slice__111 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__111)) __PYX_ERR(0, 634, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__111);
  __Pyx_GIVEREF(__pyx_slice__111);

  /* "tofu/geom/_GG03.pyx":647
 *     else:
 *         for ii in range(0,Rn):
 *             iii = np.sort(indI[ii,~np.isnan(indI[ii,:])])             # <<<<<<<<<<<<<<
 *             #assert iii.size==Phin[ii] and np.all(np.unique(iii)==iii)
 *             for zz in range(0,Zn):
 */
  __pyx_slice__112 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__112)) __PYX_ERR(0, 647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__112);
  __Pyx_GIVEREF(__pyx_slice__112);

  /* "tofu/geom/_GG03.pyx":661
 *     if VPoly is not None:
 *         if Out.lower()=='(x,y,z)':
 *             R = np.hypot(Pts[0,:],Pts[1,:])             # <<<<<<<<<<<<<<
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 */
  __pyx_slice__113 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__113)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__113);
  __Pyx_GIVEREF(__pyx_slice__113);
  __pyx_tuple__114 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__113); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__114);
  __Pyx_GIVEREF(__pyx_tuple__114);
  __pyx_slice__115 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__115)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__115);
  __Pyx_GIVEREF(__pyx_slice__115);
  __pyx_tuple__116 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__115); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 661, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__116);
  __Pyx_GIVEREF(__pyx_tuple__116);

  /* "tofu/geom/_GG03.pyx":662
 *         if Out.lower()=='(x,y,z)':
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(R)
 */
  __pyx_slice__117 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__117)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__117);
  __Pyx_GIVEREF(__pyx_slice__117);
  __pyx_tuple__118 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__117); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 662, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__118);
  __Pyx_GIVEREF(__pyx_tuple__118);

  /* "tofu/geom/_GG03.pyx":663
 *             R = np.hypot(Pts[0,:],Pts[1,:])
 *             indin = Path(VPoly.T).contains_points(np.array([R,Pts[2,:]]).T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]             # <<<<<<<<<<<<<<
 *             Ru = np.unique(R)
 *         else:
 */
  __pyx_slice__119 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__119)) __PYX_ERR(0, 663, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__119);
  __Pyx_GIVEREF(__pyx_slice__119);

  /* "tofu/geom/_GG03.pyx":666
 *             Ru = np.unique(R)
 *         else:
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(Pts[0,:])
 */
  __pyx_slice__120 = PySlice_New(Py_None, __pyx_int_neg_1, Py_None); if (unlikely(!__pyx_slice__120)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__120);
  __Pyx_GIVEREF(__pyx_slice__120);
  __pyx_slice__121 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__121)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__121);
  __Pyx_GIVEREF(__pyx_slice__121);
  __pyx_tuple__122 = PyTuple_Pack(2, __pyx_slice__120, __pyx_slice__121); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);

  /* "tofu/geom/_GG03.pyx":667
 *         else:
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]             # <<<<<<<<<<<<<<
 *             Ru = np.unique(Pts[0,:])
 *         if not np.all(Ru==R):
 */
  __pyx_slice__123 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__123)) __PYX_ERR(0, 667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__123);
  __Pyx_GIVEREF(__pyx_slice__123);

  /* "tofu/geom/_GG03.pyx":668
 *             indin = Path(VPoly.T).contains_points(Pts[:-1,:].T, transform=None, radius=0.0)
 *             Pts, dV, ind = Pts[:,indin], dV[indin], ind[indin]
 *             Ru = np.unique(Pts[0,:])             # <<<<<<<<<<<<<<
 *         if not np.all(Ru==R):
 *             dRPhir = np.array([dRPhir[ii] for ii in range(0,len(R)) if R[ii] in Ru])
 */
  __pyx_slice__124 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__124)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__124);
  __Pyx_GIVEREF(__pyx_slice__124);
  __pyx_tuple__125 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__124); if (unlikely(!__pyx_tuple__125)) __PYX_ERR(0, 668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__125);
  __Pyx_GIVEREF(__pyx_tuple__125);

  /* "tofu/geom/_GG03.pyx":780
 * 
 *     if VPoly is not None:
 *         indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *         Pts, ind = Pts[:,indin], ind[indin]
 * 
 */
  __pyx_slice__126 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__126)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__126);
  __Pyx_GIVEREF(__pyx_slice__126);
  __pyx_slice__127 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__127)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__127);
  __Pyx_GIVEREF(__pyx_slice__127);
  __pyx_tuple__128 = PyTuple_Pack(2, __pyx_slice__126, __pyx_slice__127); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 780, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);

  /* "tofu/geom/_GG03.pyx":781
 *     if VPoly is not None:
 *         indin = Path(VPoly.T).contains_points(Pts[1:,:].T, transform=None, radius=0.0)
 *         Pts, ind = Pts[:,indin], ind[indin]             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dV, ind.astype(int), dXr, dYr, dZr
 */
  __pyx_slice__129 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__129)) __PYX_ERR(0, 781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__129);
  __Pyx_GIVEREF(__pyx_slice__129);

  /* "tofu/geom/_GG03.pyx":954
 *             indin = indin & (R0>=DR[0]) & (R0<=DR[1])
 *         if DZ is not None:
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])             # <<<<<<<<<<<<<<
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()
 */
  __pyx_slice__130 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__130)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__130);
  __Pyx_GIVEREF(__pyx_slice__130);
  __pyx_tuple__131 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__130); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__131);
  __Pyx_GIVEREF(__pyx_tuple__131);
  __pyx_slice__132 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__132)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__132);
  __Pyx_GIVEREF(__pyx_slice__132);
  __pyx_tuple__133 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__132); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 954, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__133);
  __Pyx_GIVEREF(__pyx_tuple__133);

  /* "tofu/geom/_GG03.pyx":955
 *         if DZ is not None:
 *             indin = indin & (PtsCross[1,:]>=DZ[0]) & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]             # <<<<<<<<<<<<<<
 *         Ln = indin.sum()
 *         Indin = indin.nonzero()[0]
 */
  __pyx_slice__134 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__134)) __PYX_ERR(0, 955, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__134);
  __Pyx_GIVEREF(__pyx_slice__134);

  /* "tofu/geom/_GG03.pyx":1020
 *         if Out.lower()=='(x,y,z)':
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])]) # Some rare cases with doubles have to be eliminated             # <<<<<<<<<<<<<<
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]
 */
  __pyx_slice__135 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__135)) __PYX_ERR(0, 1020, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__135);
  __Pyx_GIVEREF(__pyx_slice__135);

  /* "tofu/geom/_GG03.pyx":1032
 *         else:
 *             for ii in range(0,Ln):
 *                 iii = np.unique(indI[ii,~np.isnan(indI[ii,:])])             # <<<<<<<<<<<<<<
 *                 for jj in range(0,len(iii)):
 *                     indiijj = iii[jj]
 */
  __pyx_slice__136 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__136)) __PYX_ERR(0, 1032, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__136);
  __Pyx_GIVEREF(__pyx_slice__136);

  /* "tofu/geom/_GG03.pyx":1045
 *         dS = dS[indok]
 *         if len(indok)==1:
 *             Pts = Pts[:,indok].reshape((3,1))             # <<<<<<<<<<<<<<
 *         else:
 *             Pts = Pts[:,indok]
 */
  __pyx_slice__137 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__137)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__137);
  __Pyx_GIVEREF(__pyx_slice__137);
  __pyx_tuple__138 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__138)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__138);
  __Pyx_GIVEREF(__pyx_tuple__138);
  __pyx_tuple__139 = PyTuple_Pack(1, __pyx_tuple__138); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__139);
  __Pyx_GIVEREF(__pyx_tuple__139);

  /* "tofu/geom/_GG03.pyx":1047
 *             Pts = Pts[:,indok].reshape((3,1))
 *         else:
 *             Pts = Pts[:,indok]             # <<<<<<<<<<<<<<
 *     else:
 *         Pts, dS, ind, NL, Rref, dRPhir, nRPhi0 = np.ones((3,0)), np.ones((0,)), np.ones((0,)), np.nan*np.ones((VPoly.shape[1]-1,)), np.ones((0,)), np.ones((0,)), 0
 */
  __pyx_slice__140 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__140)) __PYX_ERR(0, 1047, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__140);
  __Pyx_GIVEREF(__pyx_slice__140);

  /* "tofu/geom/_GG03.pyx":1049
 *             Pts = Pts[:,indok]
 *     else:
 *         Pts, dS, ind, NL, Rref, dRPhir, nRPhi0 = np.ones((3,0)), np.ones((0,)), np.ones((0,)), np.nan*np.ones((VPoly.shape[1]-1,)), np.ones((0,)), np.ones((0,)), 0             # <<<<<<<<<<<<<<
 *     return Pts, dS, ind.astype(int), NL, dLr, Rref, dRPhir, nRPhi0, VPbis
 * 
 */
  __pyx_tuple__141 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_0); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__141);
  __Pyx_GIVEREF(__pyx_tuple__141);
  __pyx_tuple__142 = PyTuple_Pack(1, __pyx_tuple__141); if (unlikely(!__pyx_tuple__142)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_tuple__143 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__143);
  __Pyx_GIVEREF(__pyx_tuple__143);
  __pyx_tuple__144 = PyTuple_Pack(1, __pyx_tuple__143); if (unlikely(!__pyx_tuple__144)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);
  __pyx_tuple__145 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__145);
  __Pyx_GIVEREF(__pyx_tuple__145);
  __pyx_tuple__146 = PyTuple_Pack(1, __pyx_tuple__145); if (unlikely(!__pyx_tuple__146)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__146);
  __Pyx_GIVEREF(__pyx_tuple__146);
  __pyx_tuple__147 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__147);
  __Pyx_GIVEREF(__pyx_tuple__147);
  __pyx_tuple__148 = PyTuple_Pack(1, __pyx_tuple__147); if (unlikely(!__pyx_tuple__148)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__148);
  __Pyx_GIVEREF(__pyx_tuple__148);
  __pyx_tuple__149 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__149);
  __Pyx_GIVEREF(__pyx_tuple__149);
  __pyx_tuple__150 = PyTuple_Pack(1, __pyx_tuple__149); if (unlikely(!__pyx_tuple__150)) __PYX_ERR(0, 1049, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__150);
  __Pyx_GIVEREF(__pyx_tuple__150);

  /* "tofu/geom/_GG03.pyx":1203
 *             indin = Path(VPoly.T).contains_points(ptsrz.T, transform=None, radius=0.0)
 *             if np.any(indin):
 *                 ptsrz = ptsrz[:,indin] if indin.sum()>1 else ptsrz[:,indin].reshape((2,1))             # <<<<<<<<<<<<<<
 *                 iindF = iind[indin]
 *                 dsF = dR0r*dZ0r*np.ones((indin.sum(),))
 */
  __pyx_slice__151 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__151)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__151);
  __Pyx_GIVEREF(__pyx_slice__151);
  __pyx_slice__152 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__152)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__152);
  __Pyx_GIVEREF(__pyx_slice__152);
  __pyx_tuple__153 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__153);
  __Pyx_GIVEREF(__pyx_tuple__153);
  __pyx_tuple__154 = PyTuple_Pack(1, __pyx_tuple__153); if (unlikely(!__pyx_tuple__154)) __PYX_ERR(0, 1203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__154);
  __Pyx_GIVEREF(__pyx_tuple__154);

  /* "tofu/geom/_GG03.pyx":1210
 *         if Faces[0]:
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])             # <<<<<<<<<<<<<<
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[0]+Dphi)*np.ones((indin.sum(),))])
 */
  __pyx_slice__155 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__155)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__155);
  __Pyx_GIVEREF(__pyx_slice__155);
  __pyx_tuple__156 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__155); if (unlikely(!__pyx_tuple__156)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__156);
  __Pyx_GIVEREF(__pyx_tuple__156);
  __pyx_slice__157 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__157)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__157);
  __Pyx_GIVEREF(__pyx_slice__157);
  __pyx_tuple__158 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__157); if (unlikely(!__pyx_tuple__158)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__158);
  __Pyx_GIVEREF(__pyx_tuple__158);
  __pyx_slice__159 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__159)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__159);
  __Pyx_GIVEREF(__pyx_slice__159);
  __pyx_tuple__160 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__159); if (unlikely(!__pyx_tuple__160)) __PYX_ERR(0, 1210, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__160);
  __Pyx_GIVEREF(__pyx_tuple__160);

  /* "tofu/geom/_GG03.pyx":1212
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[0]+Dphi), ptsrz[0,:]*Csin(phiMinMax[0]+Dphi), ptsrz[1,:]])
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[0]+Dphi)*np.ones((indin.sum(),))])             # <<<<<<<<<<<<<<
 *             LPts.append( pts )
 *             Lind.append( iindF )
 */
  __pyx_slice__161 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__161)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__161);
  __Pyx_GIVEREF(__pyx_slice__161);
  __pyx_tuple__162 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__161); if (unlikely(!__pyx_tuple__162)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__162);
  __Pyx_GIVEREF(__pyx_tuple__162);
  __pyx_slice__163 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__163)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__163);
  __Pyx_GIVEREF(__pyx_slice__163);
  __pyx_tuple__164 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__163); if (unlikely(!__pyx_tuple__164)) __PYX_ERR(0, 1212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__164);
  __Pyx_GIVEREF(__pyx_tuple__164);

  /* "tofu/geom/_GG03.pyx":1225
 *         if PtsM.shape[1]>=1:
 *             if PtsM.shape[1]==1:
 *                 LPts.append(PtsM.reshape((3,1)))             # <<<<<<<<<<<<<<
 *             else:
 *                 LPts.append(PtsM)
 */
  __pyx_tuple__165 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__165)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__165);
  __Pyx_GIVEREF(__pyx_tuple__165);
  __pyx_tuple__166 = PyTuple_Pack(1, __pyx_tuple__165); if (unlikely(!__pyx_tuple__166)) __PYX_ERR(0, 1225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__166);
  __Pyx_GIVEREF(__pyx_tuple__166);

  /* "tofu/geom/_GG03.pyx":1234
 *         if Faces[1]:
 *             if Out.lower()=='(x,y,z)':
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])             # <<<<<<<<<<<<<<
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[1]-Dphi)*np.ones((indin.sum(),))])
 */
  __pyx_slice__167 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__167)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__167);
  __Pyx_GIVEREF(__pyx_slice__167);
  __pyx_tuple__168 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__167); if (unlikely(!__pyx_tuple__168)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__168);
  __Pyx_GIVEREF(__pyx_tuple__168);
  __pyx_slice__169 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__169)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__169);
  __Pyx_GIVEREF(__pyx_slice__169);
  __pyx_tuple__170 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__169); if (unlikely(!__pyx_tuple__170)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__170);
  __Pyx_GIVEREF(__pyx_tuple__170);
  __pyx_slice__171 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__171)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__171);
  __Pyx_GIVEREF(__pyx_slice__171);
  __pyx_tuple__172 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__171); if (unlikely(!__pyx_tuple__172)) __PYX_ERR(0, 1234, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__172);
  __Pyx_GIVEREF(__pyx_tuple__172);

  /* "tofu/geom/_GG03.pyx":1236
 *                 pts = np.array([ptsrz[0,:]*Ccos(phiMinMax[1]-Dphi), ptsrz[0,:]*Csin(phiMinMax[1]-Dphi), ptsrz[1,:]])
 *             else:
 *                 pts = np.array([ptsrz[0,:],ptsrz[1,:],(phiMinMax[1]-Dphi)*np.ones((indin.sum(),))])             # <<<<<<<<<<<<<<
 *             LPts.append( pts )
 *             Lind.append( iindF + NR0*NZ0 + nRPhi0 )
 */
  __pyx_slice__173 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__173)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__173);
  __Pyx_GIVEREF(__pyx_slice__173);
  __pyx_tuple__174 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__173); if (unlikely(!__pyx_tuple__174)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__174);
  __Pyx_GIVEREF(__pyx_tuple__174);
  __pyx_slice__175 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__175)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__175);
  __Pyx_GIVEREF(__pyx_slice__175);
  __pyx_tuple__176 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__175); if (unlikely(!__pyx_tuple__176)) __PYX_ERR(0, 1236, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__176);
  __Pyx_GIVEREF(__pyx_tuple__176);

  /* "tofu/geom/_GG03.pyx":1252
 * 
 *     else:
 *         Pts, dS, ind, NL, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.nan*np.ones((VPoly.shape[1]-1,))             # <<<<<<<<<<<<<<
 *         dLr, dR0r, dZ0r, dRPhir, VPbis = np.ones((0,)), 0., 0., np.ones((0,)), np.asarray(VPoly)
 * 
 */
  __pyx_tuple__177 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_0); if (unlikely(!__pyx_tuple__177)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__177);
  __Pyx_GIVEREF(__pyx_tuple__177);
  __pyx_tuple__178 = PyTuple_Pack(1, __pyx_tuple__177); if (unlikely(!__pyx_tuple__178)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__178);
  __Pyx_GIVEREF(__pyx_tuple__178);
  __pyx_tuple__179 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__179)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__179);
  __Pyx_GIVEREF(__pyx_tuple__179);
  __pyx_tuple__180 = PyTuple_Pack(1, __pyx_tuple__179); if (unlikely(!__pyx_tuple__180)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__180);
  __Pyx_GIVEREF(__pyx_tuple__180);
  __pyx_tuple__181 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__181)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__181);
  __Pyx_GIVEREF(__pyx_tuple__181);
  __pyx_tuple__182 = PyTuple_Pack(1, __pyx_tuple__181); if (unlikely(!__pyx_tuple__182)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__182);
  __Pyx_GIVEREF(__pyx_tuple__182);
  __pyx_tuple__183 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__183)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__183);
  __Pyx_GIVEREF(__pyx_tuple__183);
  __pyx_tuple__184 = PyTuple_Pack(1, __pyx_tuple__183); if (unlikely(!__pyx_tuple__184)) __PYX_ERR(0, 1252, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__184);
  __Pyx_GIVEREF(__pyx_tuple__184);

  /* "tofu/geom/_GG03.pyx":1253
 *     else:
 *         Pts, dS, ind, NL, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.nan*np.ones((VPoly.shape[1]-1,))
 *         dLr, dR0r, dZ0r, dRPhir, VPbis = np.ones((0,)), 0., 0., np.ones((0,)), np.asarray(VPoly)             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dS, ind, NL, dLr, Rref, dR0r, dZ0r, dRPhir, VPbis
 */
  __pyx_tuple__185 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__185)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__185);
  __Pyx_GIVEREF(__pyx_tuple__185);
  __pyx_tuple__186 = PyTuple_Pack(1, __pyx_tuple__185); if (unlikely(!__pyx_tuple__186)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__186);
  __Pyx_GIVEREF(__pyx_tuple__186);
  __pyx_tuple__187 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__187)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__187);
  __Pyx_GIVEREF(__pyx_tuple__187);
  __pyx_tuple__188 = PyTuple_Pack(1, __pyx_tuple__187); if (unlikely(!__pyx_tuple__188)) __PYX_ERR(0, 1253, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__188);
  __Pyx_GIVEREF(__pyx_tuple__188);

  /* "tofu/geom/_GG03.pyx":1296
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[0]+Dphi)*np.ones((nii,))])
 *         pts = pts if nii>1 else pts.reshape((3,1))             # <<<<<<<<<<<<<<
 *         LPts.append( pts )
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )
 */
  __pyx_tuple__189 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__189)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__189);
  __Pyx_GIVEREF(__pyx_tuple__189);
  __pyx_tuple__190 = PyTuple_Pack(1, __pyx_tuple__189); if (unlikely(!__pyx_tuple__190)) __PYX_ERR(0, 1296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__190);
  __Pyx_GIVEREF(__pyx_tuple__190);

  /* "tofu/geom/_GG03.pyx":1304
 *     nii = len(ii)
 *     if nii>0:
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))             # <<<<<<<<<<<<<<
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )
 *         LdS.append( dSM[ind[ii]-NR0*NZ0] )
 */
  __pyx_slice__191 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__191)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__191);
  __Pyx_GIVEREF(__pyx_slice__191);
  __pyx_slice__192 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__192)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__192);
  __Pyx_GIVEREF(__pyx_slice__192);
  __pyx_tuple__193 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__193)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__193);
  __Pyx_GIVEREF(__pyx_tuple__193);
  __pyx_tuple__194 = PyTuple_Pack(1, __pyx_tuple__193); if (unlikely(!__pyx_tuple__194)) __PYX_ERR(0, 1304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__194);
  __Pyx_GIVEREF(__pyx_tuple__194);

  /* "tofu/geom/_GG03.pyx":1305
 *     if nii>0:
 *         pts = PtsM[:,ind[ii]-NR0*NZ0] if nii>1 else PtsM[:,ind[ii]-NR0*NZ0].reshape((3,1))
 *         LPts.append( PtsM[:,ind[ii]-NR0*NZ0] )             # <<<<<<<<<<<<<<
 *         LdS.append( dSM[ind[ii]-NR0*NZ0] )
 * 
 */
  __pyx_slice__195 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__195)) __PYX_ERR(0, 1305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__195);
  __Pyx_GIVEREF(__pyx_slice__195);

  /* "tofu/geom/_GG03.pyx":1318
 *         else:
 *             pts = np.array([R0[indR0], Z0[indZ0], (phiMinMax[1]-Dphi)*np.ones((nii,))])
 *         pts = pts if nii>1 else pts.reshape((3,1))             # <<<<<<<<<<<<<<
 *         LPts.append( pts )
 *         LdS.append( dR0r*dZ0r*np.ones((nii,)) )
 */
  __pyx_tuple__196 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__196)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__196);
  __Pyx_GIVEREF(__pyx_tuple__196);
  __pyx_tuple__197 = PyTuple_Pack(1, __pyx_tuple__196); if (unlikely(!__pyx_tuple__197)) __PYX_ERR(0, 1318, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__197);
  __Pyx_GIVEREF(__pyx_tuple__197);

  /* "tofu/geom/_GG03.pyx":1399
 *         if DY is not None:
 *             if DY[0] is not None:
 *                 indin = indin & (PtsCross[0,:]>=DY[0])             # <<<<<<<<<<<<<<
 *             if DY[1] is not None:
 *                 indin = indin & (PtsCross[0,:]<=DY[1])
 */
  __pyx_slice__198 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__198)) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__198);
  __Pyx_GIVEREF(__pyx_slice__198);
  __pyx_tuple__199 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__198); if (unlikely(!__pyx_tuple__199)) __PYX_ERR(0, 1399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__199);
  __Pyx_GIVEREF(__pyx_tuple__199);

  /* "tofu/geom/_GG03.pyx":1401
 *                 indin = indin & (PtsCross[0,:]>=DY[0])
 *             if DY[1] is not None:
 *                 indin = indin & (PtsCross[0,:]<=DY[1])             # <<<<<<<<<<<<<<
 *         if DZ is not None:
 *             if DZ[0] is not None:
 */
  __pyx_slice__200 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__200)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__200);
  __Pyx_GIVEREF(__pyx_slice__200);
  __pyx_tuple__201 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__200); if (unlikely(!__pyx_tuple__201)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__201);
  __Pyx_GIVEREF(__pyx_tuple__201);

  /* "tofu/geom/_GG03.pyx":1404
 *         if DZ is not None:
 *             if DZ[0] is not None:
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])             # <<<<<<<<<<<<<<
 *             if DZ[1] is not None:
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 */
  __pyx_slice__202 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__202)) __PYX_ERR(0, 1404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__202);
  __Pyx_GIVEREF(__pyx_slice__202);
  __pyx_tuple__203 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__202); if (unlikely(!__pyx_tuple__203)) __PYX_ERR(0, 1404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__203);
  __Pyx_GIVEREF(__pyx_tuple__203);

  /* "tofu/geom/_GG03.pyx":1406
 *                 indin = indin & (PtsCross[1,:]>=DZ[0])
 *             if DZ[1] is not None:
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])             # <<<<<<<<<<<<<<
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]
 *         Ln = indin.sum()
 */
  __pyx_slice__204 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__204)) __PYX_ERR(0, 1406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__204);
  __Pyx_GIVEREF(__pyx_slice__204);
  __pyx_tuple__205 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__204); if (unlikely(!__pyx_tuple__205)) __PYX_ERR(0, 1406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__205);
  __Pyx_GIVEREF(__pyx_tuple__205);

  /* "tofu/geom/_GG03.pyx":1407
 *             if DZ[1] is not None:
 *                 indin = indin & (PtsCross[1,:]<=DZ[1])
 *         PtsCross, dLr, indL, Rref = PtsCross[:,indin], dLr[indin], indL[indin], Rref[indin]             # <<<<<<<<<<<<<<
 *         Ln = indin.sum()
 *         # Agregating
 */
  __pyx_slice__206 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__206)) __PYX_ERR(0, 1407, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__206);
  __Pyx_GIVEREF(__pyx_slice__206);

  /* "tofu/geom/_GG03.pyx":1410
 *         Ln = indin.sum()
 *         # Agregating
 *         Pts = np.array([np.repeat(X,Ln), np.tile(PtsCross[0,:],Xn), np.tile(PtsCross[1,:],Xn)])             # <<<<<<<<<<<<<<
 *         ind = NY0*NZ0 + np.repeat(indX*NR0,Ln) + np.tile(indL,Xn)
 *         dS = np.tile(dLr*dXr,Xn)
 */
  __pyx_slice__207 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__207)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__207);
  __Pyx_GIVEREF(__pyx_slice__207);
  __pyx_tuple__208 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__207); if (unlikely(!__pyx_tuple__208)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__208);
  __Pyx_GIVEREF(__pyx_tuple__208);
  __pyx_slice__209 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__209)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__209);
  __Pyx_GIVEREF(__pyx_slice__209);
  __pyx_tuple__210 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__209); if (unlikely(!__pyx_tuple__210)) __PYX_ERR(0, 1410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__210);
  __Pyx_GIVEREF(__pyx_tuple__210);

  /* "tofu/geom/_GG03.pyx":1416
 *             pts = np.array([(XMinMax[0]+DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 */
  __pyx_slice__211 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__211)) __PYX_ERR(0, 1416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__211);
  __Pyx_GIVEREF(__pyx_slice__211);
  __pyx_slice__212 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__212)) __PYX_ERR(0, 1416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__212);
  __Pyx_GIVEREF(__pyx_slice__212);
  __pyx_tuple__213 = PyTuple_Pack(2, __pyx_slice__211, __pyx_slice__212); if (unlikely(!__pyx_tuple__213)) __PYX_ERR(0, 1416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__213);
  __Pyx_GIVEREF(__pyx_tuple__213);

  /* "tofu/geom/_GG03.pyx":1418
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]             # <<<<<<<<<<<<<<
 *                 Pts = np.concatenate((pts,Pts),axis=1)
 *                 ind = np.concatenate((iind[indin], ind))
 */
  __pyx_slice__214 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__214)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__214);
  __Pyx_GIVEREF(__pyx_slice__214);
  __pyx_tuple__215 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__215)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__215);
  __Pyx_GIVEREF(__pyx_tuple__215);
  __pyx_tuple__216 = PyTuple_Pack(1, __pyx_tuple__215); if (unlikely(!__pyx_tuple__216)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__216);
  __Pyx_GIVEREF(__pyx_tuple__216);
  __pyx_slice__217 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__217)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__217);
  __Pyx_GIVEREF(__pyx_slice__217);

  /* "tofu/geom/_GG03.pyx":1425
 *             pts = np.array([(XMinMax[1]-DIn)*np.ones((Y0n*Z0n,)), np.tile(Y0,Z0n), np.repeat(Z0,Y0n)])
 *             iind = NY0*NZ0 + NX*NR0 + NY0*np.repeat(indZ0,Y0n) + np.tile(indY0,Z0n)
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)             # <<<<<<<<<<<<<<
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]
 */
  __pyx_slice__218 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__218)) __PYX_ERR(0, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__218);
  __Pyx_GIVEREF(__pyx_slice__218);
  __pyx_slice__219 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__219)) __PYX_ERR(0, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__219);
  __Pyx_GIVEREF(__pyx_slice__219);
  __pyx_tuple__220 = PyTuple_Pack(2, __pyx_slice__218, __pyx_slice__219); if (unlikely(!__pyx_tuple__220)) __PYX_ERR(0, 1425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__220);
  __Pyx_GIVEREF(__pyx_tuple__220);

  /* "tofu/geom/_GG03.pyx":1427
 *             indin = Path(VPoly.T).contains_points(pts[1:,:].T, transform=None, radius=0.0)
 *             if np.any(indin):
 *                 pts = pts[:,indin].reshape((3,1)) if indin.sum()==1 else pts[:,indin]             # <<<<<<<<<<<<<<
 *                 Pts = np.concatenate((Pts,pts),axis=1)
 *                 ind = np.concatenate((ind,iind[indin]))
 */
  __pyx_slice__221 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__221)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__221);
  __Pyx_GIVEREF(__pyx_slice__221);
  __pyx_tuple__222 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__222)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__222);
  __Pyx_GIVEREF(__pyx_tuple__222);
  __pyx_tuple__223 = PyTuple_Pack(1, __pyx_tuple__222); if (unlikely(!__pyx_tuple__223)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__223);
  __Pyx_GIVEREF(__pyx_tuple__223);
  __pyx_slice__224 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__224)) __PYX_ERR(0, 1427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__224);
  __Pyx_GIVEREF(__pyx_slice__224);

  /* "tofu/geom/_GG03.pyx":1433
 * 
 *     else:
 *         Pts, dS, ind, NL, dLr, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.ones((0,)), np.ones((0,))             # <<<<<<<<<<<<<<
 *         dXr, dY0r, dZ0r, VPbis = 0., 0., 0., np.ones((3,0))
 * 
 */
  __pyx_tuple__225 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_0); if (unlikely(!__pyx_tuple__225)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__225);
  __Pyx_GIVEREF(__pyx_tuple__225);
  __pyx_tuple__226 = PyTuple_Pack(1, __pyx_tuple__225); if (unlikely(!__pyx_tuple__226)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__226);
  __Pyx_GIVEREF(__pyx_tuple__226);
  __pyx_tuple__227 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__227)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__227);
  __Pyx_GIVEREF(__pyx_tuple__227);
  __pyx_tuple__228 = PyTuple_Pack(1, __pyx_tuple__227); if (unlikely(!__pyx_tuple__228)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__228);
  __Pyx_GIVEREF(__pyx_tuple__228);
  __pyx_tuple__229 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__229)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__229);
  __Pyx_GIVEREF(__pyx_tuple__229);
  __pyx_tuple__230 = PyTuple_Pack(1, __pyx_tuple__229); if (unlikely(!__pyx_tuple__230)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__230);
  __Pyx_GIVEREF(__pyx_tuple__230);
  __pyx_tuple__231 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__231)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__231);
  __Pyx_GIVEREF(__pyx_tuple__231);
  __pyx_tuple__232 = PyTuple_Pack(1, __pyx_tuple__231); if (unlikely(!__pyx_tuple__232)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__232);
  __Pyx_GIVEREF(__pyx_tuple__232);
  __pyx_tuple__233 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__233)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__233);
  __Pyx_GIVEREF(__pyx_tuple__233);
  __pyx_tuple__234 = PyTuple_Pack(1, __pyx_tuple__233); if (unlikely(!__pyx_tuple__234)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__234);
  __Pyx_GIVEREF(__pyx_tuple__234);
  __pyx_tuple__235 = PyTuple_Pack(1, __pyx_int_0); if (unlikely(!__pyx_tuple__235)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__235);
  __Pyx_GIVEREF(__pyx_tuple__235);
  __pyx_tuple__236 = PyTuple_Pack(1, __pyx_tuple__235); if (unlikely(!__pyx_tuple__236)) __PYX_ERR(0, 1433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__236);
  __Pyx_GIVEREF(__pyx_tuple__236);

  /* "tofu/geom/_GG03.pyx":1434
 *     else:
 *         Pts, dS, ind, NL, dLr, Rref = np.ones((3,0)), np.ones((0,)), np.ones((0,),dtype=int), np.ones((0,),dtype=int), np.ones((0,)), np.ones((0,))
 *         dXr, dY0r, dZ0r, VPbis = 0., 0., 0., np.ones((3,0))             # <<<<<<<<<<<<<<
 * 
 *     return Pts, dS, ind, NL, dLr, Rref, dXr, dY0r, dZ0r, VPbis
 */
  __pyx_tuple__237 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_0); if (unlikely(!__pyx_tuple__237)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__237);
  __Pyx_GIVEREF(__pyx_tuple__237);
  __pyx_tuple__238 = PyTuple_Pack(1, __pyx_tuple__237); if (unlikely(!__pyx_tuple__238)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__238);
  __Pyx_GIVEREF(__pyx_tuple__238);

  /* "tofu/geom/_GG03.pyx":1576
 *     v = Ds.ndim==2
 *     if not v:
 *         Ds, dus = Ds.reshape((3,1)), dus.reshape((3,1))             # <<<<<<<<<<<<<<
 *     NL = Ds.shape[1]
 *     IOut = np.zeros((3,Ds.shape[1]))
 */
  __pyx_tuple__239 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__239)) __PYX_ERR(0, 1576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__239);
  __Pyx_GIVEREF(__pyx_tuple__239);
  __pyx_tuple__240 = PyTuple_Pack(1, __pyx_tuple__239); if (unlikely(!__pyx_tuple__240)) __PYX_ERR(0, 1576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__240);
  __Pyx_GIVEREF(__pyx_tuple__240);
  __pyx_tuple__241 = PyTuple_Pack(2, __pyx_int_3, __pyx_int_1); if (unlikely(!__pyx_tuple__241)) __PYX_ERR(0, 1576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__241);
  __Pyx_GIVEREF(__pyx_tuple__241);
  __pyx_tuple__242 = PyTuple_Pack(1, __pyx_tuple__241); if (unlikely(!__pyx_tuple__242)) __PYX_ERR(0, 1576, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__242);
  __Pyx_GIVEREF(__pyx_tuple__242);

  /* "tofu/geom/_GG03.pyx":1582
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))             # <<<<<<<<<<<<<<
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 */
  __pyx_slice__243 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__243)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__243);
  __Pyx_GIVEREF(__pyx_slice__243);
  __pyx_tuple__244 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__243); if (unlikely(!__pyx_tuple__244)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__244);
  __Pyx_GIVEREF(__pyx_tuple__244);
  __pyx_slice__245 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__245)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__245);
  __Pyx_GIVEREF(__pyx_slice__245);
  __pyx_tuple__246 = PyTuple_Pack(2, __pyx_int_1, __pyx_slice__245); if (unlikely(!__pyx_tuple__246)) __PYX_ERR(0, 1582, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__246);
  __Pyx_GIVEREF(__pyx_tuple__246);

  /* "tofu/geom/_GG03.pyx":1581
 *     if VType.lower()=='tor':
 *         if RMin is None:
 *             RMin = 0.95*min(np.min(VPoly[0,:]),             # <<<<<<<<<<<<<<
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,
 */
  __pyx_slice__247 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__247)) __PYX_ERR(0, 1581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__247);
  __Pyx_GIVEREF(__pyx_slice__247);
  __pyx_tuple__248 = PyTuple_Pack(2, __pyx_int_0, __pyx_slice__247); if (unlikely(!__pyx_tuple__248)) __PYX_ERR(0, 1581, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__248);
  __Pyx_GIVEREF(__pyx_tuple__248);

  /* "tofu/geom/_GG03.pyx":1583
 *             RMin = 0.95*min(np.min(VPoly[0,:]),
 *                             np.min(np.hypot(Ds[0,:],Ds[1,:])))
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Tor(Ds, dus, VPoly, VIn, Lim=Lim, Forbid=Forbid, RMin=RMin,             # <<<<<<<<<<<<<<
 *                                                                          EpsUz=EpsUz, EpsVz=EpsVz, EpsA=EpsA, EpsB=EpsB, EpsPlane=EpsPlane)
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 */
  __pyx_slice__249 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__249)) __PYX_ERR(0, 1583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__249);
  __Pyx_GIVEREF(__pyx_slice__249);
  __pyx_tuple__250 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__249); if (unlikely(!__pyx_tuple__250)) __PYX_ERR(0, 1583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__250);
  __Pyx_GIVEREF(__pyx_tuple__250);

  /* "tofu/geom/_GG03.pyx":1606
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]             # <<<<<<<<<<<<<<
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]
 */
  __pyx_slice__251 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__251)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__251);
  __Pyx_GIVEREF(__pyx_slice__251);
  __pyx_slice__252 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__252)) __PYX_ERR(0, 1606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__252);
  __Pyx_GIVEREF(__pyx_slice__252);

  /* "tofu/geom/_GG03.pyx":1607
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]             # <<<<<<<<<<<<<<
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii
 */
  __pyx_slice__253 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__253)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__253);
  __Pyx_GIVEREF(__pyx_slice__253);
  __pyx_slice__254 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__254)) __PYX_ERR(0, 1607, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__254);
  __Pyx_GIVEREF(__pyx_slice__254);

  /* "tofu/geom/_GG03.pyx":1612
 *                         IOut[1,indout] = jj
 *     else:
 *         PIn, POut, VperpIn, VperpOut, IIn, IOut[2,:] = Calc_LOS_PInOut_Lin(Ds, dus, VPoly, VIn, Lim, EpsPlane=EpsPlane)             # <<<<<<<<<<<<<<
 *         kPOut = np.sqrt(np.sum((POut-Ds)**2,axis=0))
 *         kPIn = np.sqrt(np.sum((PIn-Ds)**2,axis=0))
 */
  __pyx_slice__255 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__255)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__255);
  __Pyx_GIVEREF(__pyx_slice__255);
  __pyx_tuple__256 = PyTuple_Pack(2, __pyx_int_2, __pyx_slice__255); if (unlikely(!__pyx_tuple__256)) __PYX_ERR(0, 1612, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__256);
  __Pyx_GIVEREF(__pyx_tuple__256);

  /* "tofu/geom/_GG03.pyx":1630
 *                     if np.any(indout):
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]             # <<<<<<<<<<<<<<
 *                         VperpOut[:,indout] = vperpIn[:,indout]
 *                         IOut[2,indout] = iIn[indout]
 */
  __pyx_slice__257 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__257)) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__257);
  __Pyx_GIVEREF(__pyx_slice__257);
  __pyx_slice__258 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__258)) __PYX_ERR(0, 1630, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__258);
  __Pyx_GIVEREF(__pyx_slice__258);

  /* "tofu/geom/_GG03.pyx":1631
 *                         kPOut[indout] = kpin[indout]
 *                         POut[:,indout] = pIn[:,indout]
 *                         VperpOut[:,indout] = vperpIn[:,indout]             # <<<<<<<<<<<<<<
 *                         IOut[2,indout] = iIn[indout]
 *                         IOut[0,indout] = 1+ii
 */
  __pyx_slice__259 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__259)) __PYX_ERR(0, 1631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__259);
  __Pyx_GIVEREF(__pyx_slice__259);
  __pyx_slice__260 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__260)) __PYX_ERR(0, 1631, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__260);
  __Pyx_GIVEREF(__pyx_slice__260);

  /* "tofu/geom/_GG03.pyx":2357
 *         nat, nak = len(out.args), len(out.defaults)
 *         na = nat-nak
 *         kw = [out.args[ii] for ii in range(nat-1,na-1,-1)][::-1]             # <<<<<<<<<<<<<<
 *     return na, kw
 * 
 */
  __pyx_slice__261 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_slice__261)) __PYX_ERR(0, 2357, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__261);
  __Pyx_GIVEREF(__pyx_slice__261);

  /* "tofu/geom/_GG03.pyx":2476
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
  __pyx_slice__263 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__263)) __PYX_ERR(0, 2476, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__263);
  __Pyx_GIVEREF(__pyx_slice__263);

  /* "tofu/geom/_GG03.pyx":2493
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
  __pyx_slice__264 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__264)) __PYX_ERR(0, 2493, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__264);
  __Pyx_GIVEREF(__pyx_slice__264);

  /* "tofu/geom/_GG03.pyx":2511
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
  __pyx_slice__265 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__265)) __PYX_ERR(0, 2511, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__265);
  __Pyx_GIVEREF(__pyx_slice__265);

  /* "tofu/geom/_GG03.pyx":2531
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
  __pyx_slice__266 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__266)) __PYX_ERR(0, 2531, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__266);
  __Pyx_GIVEREF(__pyx_slice__266);

  /* "tofu/geom/_GG03.pyx":2550
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
  __pyx_slice__267 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__267)) __PYX_ERR(0, 2550, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__267);
  __Pyx_GIVEREF(__pyx_slice__267);

  /* "tofu/geom/_GG03.pyx":2570
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
  __pyx_slice__268 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__268)) __PYX_ERR(0, 2570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__268);
  __Pyx_GIVEREF(__pyx_slice__268);

  /* "tofu/geom/_GG03.pyx":2591
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 *             elif method=='simps':
 *                 for ii in range(0,ND):
 */
  __pyx_slice__269 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__269)) __PYX_ERR(0, 2591, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__269);
  __Pyx_GIVEREF(__pyx_slice__269);

  /* "tofu/geom/_GG03.pyx":2608
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
  __pyx_slice__270 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__270)) __PYX_ERR(0, 2608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__270);
  __Pyx_GIVEREF(__pyx_slice__270);

  /* "tofu/geom/_GG03.pyx":2627
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
  __pyx_slice__271 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__271)) __PYX_ERR(0, 2627, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__271);
  __Pyx_GIVEREF(__pyx_slice__271);

  /* "tofu/geom/_GG03.pyx":2647
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = np.sum(ff(pts,t=t,**fkwdargs),axis=axm)*dl             # <<<<<<<<<<<<<<
 * 
 *             elif method=='simps':
 */
  __pyx_slice__272 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__272)) __PYX_ERR(0, 2647, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__272);
  __Pyx_GIVEREF(__pyx_slice__272);

  /* "tofu/geom/_GG03.pyx":2666
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.simps(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                               x=None,dx=dl,axis=axm)
 * 
 */
  __pyx_slice__273 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__273)) __PYX_ERR(0, 2666, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__273);
  __Pyx_GIVEREF(__pyx_slice__273);

  /* "tofu/geom/_GG03.pyx":2686
 *                     if ani:
 *                         fkwdargs['Vect'] = (-u0,-u1,-u2)
 *                     sig[:,ii] = scpintg.romb(ff(pts,t=t,**fkwdargs),             # <<<<<<<<<<<<<<
 *                                              dx=dl,axis=axm,show=False)
 * 
 */
  __pyx_slice__274 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__274)) __PYX_ERR(0, 2686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__274);
  __Pyx_GIVEREF(__pyx_slice__274);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":235
 *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
 * 
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 */
  __pyx_tuple__277 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__277)) __PYX_ERR(1, 235, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__277);
  __Pyx_GIVEREF(__pyx_tuple__277);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":239
 *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
 *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
 *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
 * 
 *             info.buf = PyArray_DATA(self)
 */
  __pyx_tuple__278 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__278)) __PYX_ERR(1, 239, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__278);
  __Pyx_GIVEREF(__pyx_tuple__278);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276
 *                 if ((descr.byteorder == c'>' and little_endian) or
 *                     (descr.byteorder == c'<' and not little_endian)):
 *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *                 if   t == NPY_BYTE:        f = "b"
 *                 elif t == NPY_UBYTE:       f = "B"
 */
  __pyx_tuple__279 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__279)) __PYX_ERR(1, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__279);
  __Pyx_GIVEREF(__pyx_tuple__279);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":823
 * 
 *         if (end - f) - <int>(new_offset - offset[0]) < 15:
 *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
 * 
 *         if ((child.byteorder == c'>' and little_endian) or
 */
  __pyx_tuple__280 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__280)) __PYX_ERR(1, 823, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__280);
  __Pyx_GIVEREF(__pyx_tuple__280);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827
 *         if ((child.byteorder == c'>' and little_endian) or
 *             (child.byteorder == c'<' and not little_endian)):
 *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
 *             # One could encode it in the format string and have Cython
 *             # complain instead, BUT: < and > in format strings also imply
 */
  __pyx_tuple__281 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__281)) __PYX_ERR(1, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__281);
  __Pyx_GIVEREF(__pyx_tuple__281);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847
 *             t = child.type_num
 *             if end - f < 5:
 *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
 * 
 *             # Until ticket #99 is fixed, use integers to avoid warnings
 */
  __pyx_tuple__282 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__282)) __PYX_ERR(1, 847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__282);
  __Pyx_GIVEREF(__pyx_tuple__282);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1013
 *         _import_array()
 *     except Exception:
 *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_umath() except -1:
 */
  __pyx_tuple__283 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__283)) __PYX_ERR(1, 1013, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__283);
  __Pyx_GIVEREF(__pyx_tuple__283);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1019
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 * 
 * cdef inline int import_ufunc() except -1:
 */
  __pyx_tuple__284 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__284)) __PYX_ERR(1, 1019, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__284);
  __Pyx_GIVEREF(__pyx_tuple__284);

  /* "../../../miniconda/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1025
 *         _import_umath()
 *     except Exception:
 *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__285 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__285)) __PYX_ERR(1, 1025, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__285);
  __Pyx_GIVEREF(__pyx_tuple__285);

  /* "View.MemoryView":131
 * 
 *         if not self.ndim:
 *             raise ValueError("Empty shape tuple for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if itemsize <= 0:
 */
  __pyx_tuple__286 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__286)) __PYX_ERR(2, 131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__286);
  __Pyx_GIVEREF(__pyx_tuple__286);

  /* "View.MemoryView":134
 * 
 *         if itemsize <= 0:
 *             raise ValueError("itemsize <= 0 for cython.array")             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(format, bytes):
 */
  __pyx_tuple__287 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__287)) __PYX_ERR(2, 134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__287);
  __Pyx_GIVEREF(__pyx_tuple__287);

  /* "View.MemoryView":137
 * 
 *         if not isinstance(format, bytes):
 *             format = format.encode('ASCII')             # <<<<<<<<<<<<<<
 *         self._format = format  # keep a reference to the byte string
 *         self.format = self._format
 */
  __pyx_tuple__288 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__288)) __PYX_ERR(2, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__288);
  __Pyx_GIVEREF(__pyx_tuple__288);

  /* "View.MemoryView":146
 * 
 *         if not self._shape:
 *             raise MemoryError("unable to allocate shape and strides.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__289 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__289)) __PYX_ERR(2, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__289);
  __Pyx_GIVEREF(__pyx_tuple__289);

  /* "View.MemoryView":174
 *             self.data = <char *>malloc(self.len)
 *             if not self.data:
 *                 raise MemoryError("unable to allocate array data.")             # <<<<<<<<<<<<<<
 * 
 *             if self.dtype_is_object:
 */
  __pyx_tuple__290 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__290)) __PYX_ERR(2, 174, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__290);
  __Pyx_GIVEREF(__pyx_tuple__290);

  /* "View.MemoryView":190
 *             bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
 *         if not (flags & bufmode):
 *             raise ValueError("Can only create a buffer that is contiguous in memory.")             # <<<<<<<<<<<<<<
 *         info.buf = self.data
 *         info.len = self.len
 */
  __pyx_tuple__291 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__291)) __PYX_ERR(2, 190, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__291);
  __Pyx_GIVEREF(__pyx_tuple__291);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__292 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__292)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__292);
  __Pyx_GIVEREF(__pyx_tuple__292);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__293 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__293)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__293);
  __Pyx_GIVEREF(__pyx_tuple__293);

  /* "View.MemoryView":486
 *             result = struct.unpack(self.view.format, bytesitem)
 *         except struct.error:
 *             raise ValueError("Unable to convert item to object")             # <<<<<<<<<<<<<<
 *         else:
 *             if len(self.view.format) == 1:
 */
  __pyx_tuple__294 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__294)) __PYX_ERR(2, 486, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__294);
  __Pyx_GIVEREF(__pyx_tuple__294);

  /* "View.MemoryView":558
 *         if self.view.strides == NULL:
 * 
 *             raise ValueError("Buffer view does not expose strides")             # <<<<<<<<<<<<<<
 * 
 *         return tuple([stride for stride in self.view.strides[:self.view.ndim]])
 */
  __pyx_tuple__295 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__295)) __PYX_ERR(2, 558, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__295);
  __Pyx_GIVEREF(__pyx_tuple__295);

  /* "View.MemoryView":565
 *     def suboffsets(self):
 *         if self.view.suboffsets == NULL:
 *             return (-1,) * self.view.ndim             # <<<<<<<<<<<<<<
 * 
 *         return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
 */
  __pyx_tuple__296 = PyTuple_New(1); if (unlikely(!__pyx_tuple__296)) __PYX_ERR(2, 565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__296);
  __Pyx_INCREF(__pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_tuple__296, 0, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_tuple__296);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__297 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__297)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__297);
  __Pyx_GIVEREF(__pyx_tuple__297);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__298 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__298)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__298);
  __Pyx_GIVEREF(__pyx_tuple__298);

  /* "View.MemoryView":670
 *         if item is Ellipsis:
 *             if not seen_ellipsis:
 *                 result.extend([slice(None)] * (ndim - len(tup) + 1))             # <<<<<<<<<<<<<<
 *                 seen_ellipsis = True
 *             else:
 */
  __pyx_slice__299 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__299)) __PYX_ERR(2, 670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__299);
  __Pyx_GIVEREF(__pyx_slice__299);

  /* "View.MemoryView":673
 *                 seen_ellipsis = True
 *             else:
 *                 result.append(slice(None))             # <<<<<<<<<<<<<<
 *             have_slices = True
 *         else:
 */
  __pyx_slice__300 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__300)) __PYX_ERR(2, 673, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__300);
  __Pyx_GIVEREF(__pyx_slice__300);

  /* "View.MemoryView":684
 *     nslices = ndim - len(result)
 *     if nslices:
 *         result.extend([slice(None)] * nslices)             # <<<<<<<<<<<<<<
 * 
 *     return have_slices or nslices, tuple(result)
 */
  __pyx_slice__301 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__301)) __PYX_ERR(2, 684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__301);
  __Pyx_GIVEREF(__pyx_slice__301);

  /* "View.MemoryView":691
 *     for suboffset in suboffsets[:ndim]:
 *         if suboffset >= 0:
 *             raise ValueError("Indirect dimensions not supported")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__302 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__302)) __PYX_ERR(2, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__302);
  __Pyx_GIVEREF(__pyx_tuple__302);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_tuple__303 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__303)) __PYX_ERR(2, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__303);
  __Pyx_GIVEREF(__pyx_tuple__303);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_tuple__304 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__304)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__304);
  __Pyx_GIVEREF(__pyx_tuple__304);

  /* "tofu/geom/_GG03.pyx":49
 * ########################################################
 * 
 * def CoordShift(Pts, In='(X,Y,Z)', Out='(R,Z)', CrossRef=None):             # <<<<<<<<<<<<<<
 *     """ Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))"""
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"
 */
  __pyx_tuple__306 = PyTuple_Pack(13, __pyx_n_s_Pts, __pyx_n_s_In, __pyx_n_s_Out, __pyx_n_s_CrossRef, __pyx_n_s_Ins, __pyx_n_s_Outs, __pyx_n_s_InT, __pyx_n_s_OutT, __pyx_n_s_ndim, __pyx_n_s_pts, __pyx_n_s_ii, __pyx_n_s_ff, __pyx_n_s_ss); if (unlikely(!__pyx_tuple__306)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__306);
  __Pyx_GIVEREF(__pyx_tuple__306);
  __pyx_codeobj__307 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__306, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_CoordShift, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__307)) __PYX_ERR(0, 49, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":143
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def Poly_isClockwise(cnp.ndarray[double,ndim=2] Poly):             # <<<<<<<<<<<<<<
 *     """ Assuming 2D closed Poly ! """
 *     cdef int ii, NP=Poly.shape[1]
 */
  __pyx_tuple__308 = PyTuple_Pack(4, __pyx_n_s_Poly, __pyx_n_s_ii, __pyx_n_s_NP, __pyx_n_s_Sum); if (unlikely(!__pyx_tuple__308)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__308);
  __Pyx_GIVEREF(__pyx_tuple__308);
  __pyx_codeobj__309 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__308, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Poly_isClockwise, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__309)) __PYX_ERR(0, 143, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":152
 * 
 * 
 * def Poly_Order(cnp.ndarray[double,ndim=2] Poly, str order='C', Clock=False, close=True, str layout='(cc,N)', str layout_in=None, Test=True):             # <<<<<<<<<<<<<<
 *     """
 *     Return a polygon Poly as a np.ndarray formatted according to parameters
 */
  __pyx_tuple__310 = PyTuple_Pack(8, __pyx_n_s_Poly, __pyx_n_s_order, __pyx_n_s_Clock, __pyx_n_s_close, __pyx_n_s_layout, __pyx_n_s_layout_in, __pyx_n_s_Test, __pyx_n_s_poly); if (unlikely(!__pyx_tuple__310)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__310);
  __Pyx_GIVEREF(__pyx_tuple__310);
  __pyx_codeobj__311 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__310, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Poly_Order, 152, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__311)) __PYX_ERR(0, 152, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":198
 * 
 * 
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 */
  __pyx_tuple__312 = PyTuple_Pack(8, __pyx_n_s_Poly, __pyx_n_s_Ri0, __pyx_n_s_Ri1, __pyx_n_s_Zi0, __pyx_n_s_Zi1, __pyx_n_s_V, __pyx_n_s_BV0, __pyx_n_s_BV1); if (unlikely(!__pyx_tuple__312)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__312);
  __Pyx_GIVEREF(__pyx_tuple__312);
  __pyx_codeobj__313 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__312, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Poly_VolAngTor, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__313)) __PYX_ERR(0, 198, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":218
 * 
 * 
 * def Sino_ImpactEnv(cnp.ndarray[double,ndim=1] RZ, cnp.ndarray[double,ndim=2] Poly, int NP=50, Test=True):             # <<<<<<<<<<<<<<
 *     """ Computes impact parameters of a Tor enveloppe (Tor is a closed 2D polygon)
 * 
 */
  __pyx_tuple__314 = PyTuple_Pack(10, __pyx_n_s_RZ, __pyx_n_s_Poly, __pyx_n_s_NP, __pyx_n_s_Test, __pyx_n_s_NPoly, __pyx_n_s_EnvTheta, __pyx_n_s_Vect, __pyx_n_s_Vectbis, __pyx_n_s_RZPoly, __pyx_n_s_Sca); if (unlikely(!__pyx_tuple__314)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__314);
  __Pyx_GIVEREF(__pyx_tuple__314);
  __pyx_codeobj__315 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__314, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Sino_ImpactEnv, 218, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__315)) __PYX_ERR(0, 218, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":244
 * 
 * # For sinograms
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):             # <<<<<<<<<<<<<<
 *     if hasattr(theta,'__getitem__'):
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 */
  __pyx_tuple__316 = PyTuple_Pack(8, __pyx_n_s_theta, __pyx_n_s_pP, __pyx_n_s_pN, __pyx_n_s_sort, __pyx_n_s_pPbis, __pyx_n_s_pNbis, __pyx_n_s_xi, __pyx_n_s_ind); if (unlikely(!__pyx_tuple__316)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__316);
  __Pyx_GIVEREF(__pyx_tuple__316);
  __pyx_codeobj__317 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__316, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_ConvertImpact_Theta2Xi, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__317)) __PYX_ERR(0, 244, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":284
 * ########################################################
 * 
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):             # <<<<<<<<<<<<<<
 *     if Test:
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 */
  __pyx_tuple__318 = PyTuple_Pack(13, __pyx_n_s_Pts, __pyx_n_s_VPoly, __pyx_n_s_Lim, __pyx_n_s_VType, __pyx_n_s_In, __pyx_n_s_Test, __pyx_n_s_path, __pyx_n_s_pts, __pyx_n_s_ind, __pyx_n_s_ind0, __pyx_n_s_ii, __pyx_n_s_lim, __pyx_n_s_ll); if (unlikely(!__pyx_tuple__318)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__318);
  __Pyx_GIVEREF(__pyx_tuple__318);
  __pyx_codeobj__319 = (PyObject*)__Pyx_PyCode_New(6, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__318, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_isInside, 284, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__319)) __PYX_ERR(0, 284, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":338
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_mesh_dlfromL_cython(double[::1] LMinMax, double dL, DL=None, Lim=True, dLMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     """ Get the actual reolution from the desired resolution and MinMax and limits """
 *     # Get the number of mesh elements in LMinMax
 */
  __pyx_tuple__320 = PyTuple_Pack(20, __pyx_n_s_LMinMax, __pyx_n_s_dL, __pyx_n_s_DL, __pyx_n_s_Lim, __pyx_n_s_dLMode, __pyx_n_s_margin, __pyx_n_s_N, __pyx_n_s_dLr, __pyx_n_s_DLc, __pyx_n_s_L, __pyx_n_s_indL, __pyx_n_s_abs0, __pyx_n_s_abs1, __pyx_n_s_A, __pyx_n_s_nL0, __pyx_n_s_nL1, __pyx_n_s_Nind, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_dl); if (unlikely(!__pyx_tuple__320)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__320);
  __Pyx_GIVEREF(__pyx_tuple__320);
  __pyx_codeobj__321 = (PyObject*)__Pyx_PyCode_New(6, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__320, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_mesh_dlfromL_cython, 338, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__321)) __PYX_ERR(0, 338, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":399
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromD(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, D1=None, D2=None,str dSMode='abs', VPoly=None, double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */
  __pyx_tuple__322 = PyTuple_Pack(28, __pyx_n_s_MinMax1, __pyx_n_s_MinMax2, __pyx_n_s_d1, __pyx_n_s_d2, __pyx_n_s_D1, __pyx_n_s_D2, __pyx_n_s_dSMode, __pyx_n_s_VPoly, __pyx_n_s_margin, __pyx_n_s_X1, __pyx_n_s_X2, __pyx_n_s_dX1, __pyx_n_s_dX2, __pyx_n_s_ind1, __pyx_n_s_ind2, __pyx_n_s_N1, __pyx_n_s_N2, __pyx_n_s_n1, __pyx_n_s_n2, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_nn, __pyx_n_s_Pts, __pyx_n_s_dS, __pyx_n_s_ind, __pyx_n_s_d1r, __pyx_n_s_d2r, __pyx_n_s_iin); if (unlikely(!__pyx_tuple__322)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__322);
  __Pyx_GIVEREF(__pyx_tuple__322);
  __pyx_codeobj__323 = (PyObject*)__Pyx_PyCode_New(9, 0, 28, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__322, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_meshCross_FromD, 399, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__323)) __PYX_ERR(0, 399, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":433
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromInd(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, long[::1] ind, str dSMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */
  __pyx_tuple__324 = PyTuple_Pack(22, __pyx_n_s_MinMax1, __pyx_n_s_MinMax2, __pyx_n_s_d1, __pyx_n_s_d2, __pyx_n_s_ind, __pyx_n_s_dSMode, __pyx_n_s_margin, __pyx_n_s_X1, __pyx_n_s_X2, __pyx_n_s_dX1, __pyx_n_s_dX2, __pyx_n_s_bla, __pyx_n_s_N1, __pyx_n_s_N2, __pyx_n_s_NP, __pyx_n_s_ii, __pyx_n_s_i1, __pyx_n_s_i2, __pyx_n_s_Pts, __pyx_n_s_dS, __pyx_n_s_d1r, __pyx_n_s_d2r); if (unlikely(!__pyx_tuple__324)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__324);
  __Pyx_GIVEREF(__pyx_tuple__324);
  __pyx_codeobj__325 = (PyObject*)__Pyx_PyCode_New(7, 0, 22, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__324, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_meshCross_FromInd, 433, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__325)) __PYX_ERR(0, 433, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":460
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Cross(double[:,::1] VPoly, double dL, str dLMode='abs', D1=None, D2=None, double margin=1.e-9, double DIn=0., VIn=None):             # <<<<<<<<<<<<<<
 *     cdef int ii, jj, nn=0, NP=VPoly.shape[1]
 *     cdef double[::1] LMinMax, L
 */
  __pyx_tuple__326 = PyTuple_Pack(29, __pyx_n_s_VPoly, __pyx_n_s_dL, __pyx_n_s_dLMode, __pyx_n_s_D1, __pyx_n_s_D2, __pyx_n_s_margin, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_nn, __pyx_n_s_NP, __pyx_n_s_LMinMax, __pyx_n_s_L, __pyx_n_s_v0, __pyx_n_s_v1, __pyx_n_s_dlr, __pyx_n_s_indL, __pyx_n_s_N, __pyx_n_s_ind, __pyx_n_s_dLr, __pyx_n_s_Rref, __pyx_n_s_PtsCross, __pyx_n_s_LPtsCross, __pyx_n_s_LdLr, __pyx_n_s_Lind, __pyx_n_s_LRref, __pyx_n_s_VPolybis, __pyx_n_s_indin); if (unlikely(!__pyx_tuple__326)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__326);
  __Pyx_GIVEREF(__pyx_tuple__326);
  __pyx_codeobj__327 = (PyObject*)__Pyx_PyCode_New(8, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__326, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_Cross, 460, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__327)) __PYX_ERR(0, 460, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":547
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[::1] RMinMax, double[::1] ZMinMax,
 *                                    DR=None, DZ=None, DPhi=None, VPoly=None,
 */
  __pyx_tuple__328 = PyTuple_Pack(54, __pyx_n_s_dR, __pyx_n_s_dZ, __pyx_n_s_dRPhi, __pyx_n_s_RMinMax, __pyx_n_s_ZMinMax, __pyx_n_s_DR, __pyx_n_s_DZ, __pyx_n_s_DPhi, __pyx_n_s_VPoly, __pyx_n_s_Out, __pyx_n_s_margin, __pyx_n_s_R0, __pyx_n_s_R, __pyx_n_s_Z, __pyx_n_s_dRPhir, __pyx_n_s_dPhir, __pyx_n_s_NRPhi, __pyx_n_s_dRr0, __pyx_n_s_dRr, __pyx_n_s_dZr, __pyx_n_s_DPhi0, __pyx_n_s_DPhi1, __pyx_n_s_abs0, __pyx_n_s_abs1, __pyx_n_s_phi, __pyx_n_s_indiijj, __pyx_n_s_indR0, __pyx_n_s_indR, __pyx_n_s_indZ, __pyx_n_s_Phin, __pyx_n_s_NRPhi0, __pyx_n_s_NR0, __pyx_n_s_NR, __pyx_n_s_NZ, __pyx_n_s_Rn, __pyx_n_s_Zn, __pyx_n_s_nRPhi0, __pyx_n_s_indR0ii, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_nPhi0, __pyx_n_s_nPhi1, __pyx_n_s_zz, __pyx_n_s_NP, __pyx_n_s_NRPhi_int, __pyx_n_s_Rratio, __pyx_n_s_Pts, __pyx_n_s_indI, __pyx_n_s_iii, __pyx_n_s_dV, __pyx_n_s_ind, __pyx_n_s_NPhimax, __pyx_n_s_indin, __pyx_n_s_Ru); if (unlikely(!__pyx_tuple__328)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__328);
  __Pyx_GIVEREF(__pyx_tuple__328);
  __pyx_codeobj__329 = (PyObject*)__Pyx_PyCode_New(11, 0, 54, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__328, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython, 547, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__329)) __PYX_ERR(0, 547, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":679
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromInd_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[::1] RMinMax, double[::1] ZMinMax, long[::1] ind,
 *                                      str Out='(X,Y,Z)', double margin=1.e-9):
 */
  __pyx_tuple__330 = PyTuple_Pack(35, __pyx_n_s_dR, __pyx_n_s_dZ, __pyx_n_s_dRPhi, __pyx_n_s_RMinMax, __pyx_n_s_ZMinMax, __pyx_n_s_ind, __pyx_n_s_Out, __pyx_n_s_margin, __pyx_n_s_R, __pyx_n_s_Z, __pyx_n_s_dRPhirRef, __pyx_n_s_dPhir, __pyx_n_s_Ru, __pyx_n_s_dRPhir, __pyx_n_s_dRr, __pyx_n_s_dZr, __pyx_n_s_phi, __pyx_n_s_indR, __pyx_n_s_indZ, __pyx_n_s_NRPhi0, __pyx_n_s_NRPhi, __pyx_n_s_NR, __pyx_n_s_NZ, __pyx_n_s_Rn, __pyx_n_s_Zn, __pyx_n_s_NP, __pyx_n_s_Rratio, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_iiR, __pyx_n_s_iiZ, __pyx_n_s_iiphi, __pyx_n_s_Phi, __pyx_n_s_Pts, __pyx_n_s_dV); if (unlikely(!__pyx_tuple__330)) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__330);
  __Pyx_GIVEREF(__pyx_tuple__330);
  __pyx_codeobj__331 = (PyObject*)__Pyx_PyCode_New(8, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__330, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython, 679, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__331)) __PYX_ERR(0, 679, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":756
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                    double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                    DX=None, DY=None, DZ=None, VPoly=None,
 */
  __pyx_tuple__332 = PyTuple_Pack(30, __pyx_n_s_dX, __pyx_n_s_dY, __pyx_n_s_dZ, __pyx_n_s_XMinMax, __pyx_n_s_YMinMax, __pyx_n_s_ZMinMax, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ, __pyx_n_s_VPoly, __pyx_n_s_margin, __pyx_n_s_X, __pyx_n_s_Y, __pyx_n_s_Z, __pyx_n_s_dXr, __pyx_n_s_dYr, __pyx_n_s_dZr, __pyx_n_s_dV, __pyx_n_s_indX, __pyx_n_s_indY, __pyx_n_s_indZ, __pyx_n_s_NX, __pyx_n_s_NY, __pyx_n_s_NZ, __pyx_n_s_Xn, __pyx_n_s_Yn, __pyx_n_s_Zn, __pyx_n_s_Pts, __pyx_n_s_ind, __pyx_n_s_indin); if (unlikely(!__pyx_tuple__332)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__332);
  __Pyx_GIVEREF(__pyx_tuple__332);
  __pyx_codeobj__333 = (PyObject*)__Pyx_PyCode_New(11, 0, 30, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__332, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython, 756, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__333)) __PYX_ERR(0, 756, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":786
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromInd_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                      double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                      cnp.ndarray[long,ndim=1] ind, double margin=1.e-9):
 */
  __pyx_tuple__334 = PyTuple_Pack(26, __pyx_n_s_dX, __pyx_n_s_dY, __pyx_n_s_dZ, __pyx_n_s_XMinMax, __pyx_n_s_YMinMax, __pyx_n_s_ZMinMax, __pyx_n_s_ind, __pyx_n_s_margin, __pyx_n_s_X, __pyx_n_s_Y, __pyx_n_s_Z, __pyx_n_s_dXr, __pyx_n_s_dYr, __pyx_n_s_dZr, __pyx_n_s_dV, __pyx_n_s_bla, __pyx_n_s_indX, __pyx_n_s_indY, __pyx_n_s_indZ, __pyx_n_s_NX, __pyx_n_s_NY, __pyx_n_s_NZ, __pyx_n_s_Xn, __pyx_n_s_Yn, __pyx_n_s_Zn, __pyx_n_s_Pts); if (unlikely(!__pyx_tuple__334)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__334);
  __Pyx_GIVEREF(__pyx_tuple__334);
  __pyx_codeobj__335 = (PyObject*)__Pyx_PyCode_New(8, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__334, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython, 786, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__335)) __PYX_ERR(0, 786, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":822
 * ########################################################
 * 
 * def _getBoundsInter2AngSeg(bool Full, double Phi0, double Phi1, double DPhi0, double DPhi1):             # <<<<<<<<<<<<<<
 *     """ Return Inter=True if an intersection exist (all angles in radians in [-pi;pi])
 * 
 */
  __pyx_tuple__336 = PyTuple_Pack(8, __pyx_n_s_Full, __pyx_n_s_Phi0, __pyx_n_s_Phi1, __pyx_n_s_DPhi0, __pyx_n_s_DPhi1, __pyx_n_s_Bounds, __pyx_n_s_Inter, __pyx_n_s_Faces); if (unlikely(!__pyx_tuple__336)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__336);
  __Pyx_GIVEREF(__pyx_tuple__336);
  __pyx_codeobj__337 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__336, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_getBoundsInter2AngSeg, 822, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__337)) __PYX_ERR(0, 822, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":901
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,
 */
  __pyx_tuple__338 = PyTuple_Pack(74, __pyx_n_s_dL, __pyx_n_s_dRPhi, __pyx_n_s_VPoly, __pyx_n_s_DR, __pyx_n_s_DZ, __pyx_n_s_DPhi, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_PhiMinMax, __pyx_n_s_Out, __pyx_n_s_margin, __pyx_n_s_R, __pyx_n_s_Z, __pyx_n_s_dPhir, __pyx_n_s_NRPhi, __pyx_n_s_dRr0, __pyx_n_s_dRr, __pyx_n_s_dZr, __pyx_n_s_DPhi0, __pyx_n_s_DPhi1, __pyx_n_s_DDPhi, __pyx_n_s_DPhiMinMax, __pyx_n_s_abs0, __pyx_n_s_abs1, __pyx_n_s_phi, __pyx_n_s_indiijj, __pyx_n_s_indR0, __pyx_n_s_indR, __pyx_n_s_indZ, __pyx_n_s_Phin, __pyx_n_s_NRPhi0, __pyx_n_s_Indin, __pyx_n_s_NR0, __pyx_n_s_NR, __pyx_n_s_NZ, __pyx_n_s_Rn, __pyx_n_s_Zn, __pyx_n_s_nRPhi0, __pyx_n_s_indR0ii, __pyx_n_s_ii, __pyx_n_s_jj0, __pyx_n_s_jj, __pyx_n_s_nPhi0, __pyx_n_s_nPhi1, __pyx_n_s_zz, __pyx_n_s_NP, __pyx_n_s_NRPhi_int, __pyx_n_s_Rratio, __pyx_n_s_Ln, __pyx_n_s_Pts, __pyx_n_s_indI, __pyx_n_s_PtsCross, __pyx_n_s_VPbis, __pyx_n_s_R0, __pyx_n_s_dS, __pyx_n_s_ind, __pyx_n_s_dLr, __pyx_n_s_Rref, __pyx_n_s_dRPhir, __pyx_n_s_iii, __pyx_n_s_indL, __pyx_n_s_NL, __pyx_n_s_indok, __pyx_n_s_Full, __pyx_n_s_Inter, __pyx_n_s_Bounds, __pyx_n_s_Faces, __pyx_n_s_BC, __pyx_n_s_nBounds, __pyx_n_s_indin, __pyx_n_s_NPhimax, __pyx_n_s_indBounds, __pyx_n_s_kk, __pyx_n_s_kkb); if (unlikely(!__pyx_tuple__338)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__338);
  __Pyx_GIVEREF(__pyx_tuple__338);
  __pyx_codeobj__339 = (PyObject*)__Pyx_PyCode_New(11, 0, 74, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__338, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_Tor_SubFromD_cython, 901, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__339)) __PYX_ERR(0, 901, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1057
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, long[::1] ind,
 *                                      double DIn=0., VIn=None, PhiMinMax=None,
 */
  __pyx_tuple__340 = PyTuple_Pack(42, __pyx_n_s_dL, __pyx_n_s_dRPhi, __pyx_n_s_VPoly, __pyx_n_s_ind, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_PhiMinMax, __pyx_n_s_Out, __pyx_n_s_margin, __pyx_n_s_dRPhirRef, __pyx_n_s_dPhir, __pyx_n_s_indL, __pyx_n_s_NRPhi0, __pyx_n_s_NRPhi, __pyx_n_s_NR, __pyx_n_s_NZ, __pyx_n_s_Rn, __pyx_n_s_Zn, __pyx_n_s_NP, __pyx_n_s_Rratio, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_iiL, __pyx_n_s_iiphi, __pyx_n_s_Ln, __pyx_n_s_nn, __pyx_n_s_kk, __pyx_n_s_nRPhi0, __pyx_n_s_Phi, __pyx_n_s_Pts, __pyx_n_s_indI, __pyx_n_s_PtsCross, __pyx_n_s_VPbis, __pyx_n_s_R0, __pyx_n_s_dS, __pyx_n_s_dLr, __pyx_n_s_dRPhir, __pyx_n_s_Rref, __pyx_n_s_NL, __pyx_n_s_DPhiMinMax, __pyx_n_s_dLrRef, __pyx_n_s_RrefRef); if (unlikely(!__pyx_tuple__340)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__340);
  __Pyx_GIVEREF(__pyx_tuple__340);
  __pyx_codeobj__341 = (PyObject*)__Pyx_PyCode_New(9, 0, 42, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__340, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython, 1057, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__341)) __PYX_ERR(0, 1057, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1149
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,
 */
  __pyx_tuple__342 = PyTuple_Pack(56, __pyx_n_s_PhiMinMax, __pyx_n_s_dL, __pyx_n_s_dRPhi, __pyx_n_s_VPoly, __pyx_n_s_DR, __pyx_n_s_DZ, __pyx_n_s_DPhi, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_Out, __pyx_n_s_margin, __pyx_n_s_Dphi, __pyx_n_s_dR0r, __pyx_n_s_dZ0r, __pyx_n_s_NR0, __pyx_n_s_NZ0, __pyx_n_s_R0n, __pyx_n_s_Z0n, __pyx_n_s_NRPhi0, __pyx_n_s_phiMinMax, __pyx_n_s_R0, __pyx_n_s_Z0, __pyx_n_s_dsF, __pyx_n_s_dSM, __pyx_n_s_dLr, __pyx_n_s_Rref, __pyx_n_s_dRPhir, __pyx_n_s_dS, __pyx_n_s_indR0, __pyx_n_s_indZ0, __pyx_n_s_iind, __pyx_n_s_iindF, __pyx_n_s_indM, __pyx_n_s_NL, __pyx_n_s_ind, __pyx_n_s_ptsrz, __pyx_n_s_pts, __pyx_n_s_PtsM, __pyx_n_s_VPbis, __pyx_n_s_Pts, __pyx_n_s_LPts, __pyx_n_s_LdS, __pyx_n_s_Lind, __pyx_n_s_DPhiMinMax, __pyx_n_s_Full, __pyx_n_s_DPhi0, __pyx_n_s_DPhi1, __pyx_n_s_DDPhi, __pyx_n_s_Inter, __pyx_n_s_Bounds, __pyx_n_s_Faces, __pyx_n_s_BC, __pyx_n_s_nBounds, __pyx_n_s_ii, __pyx_n_s_indin, __pyx_n_s_nRPhi0); if (unlikely(!__pyx_tuple__342)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__342);
  __Pyx_GIVEREF(__pyx_tuple__342);
  __pyx_codeobj__343 = (PyObject*)__Pyx_PyCode_New(11, 0, 56, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__342, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy, 1149, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__343)) __PYX_ERR(0, 1149, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1262
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                            double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                            double DIn=0., VIn=None,
 */
  __pyx_tuple__344 = PyTuple_Pack(44, __pyx_n_s_PhiMinMax, __pyx_n_s_dL, __pyx_n_s_dRPhi, __pyx_n_s_VPoly, __pyx_n_s_ind, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_Out, __pyx_n_s_margin, __pyx_n_s_Dphi, __pyx_n_s_dR0r, __pyx_n_s_dZ0r, __pyx_n_s_NR0, __pyx_n_s_NZ0, __pyx_n_s_R0n, __pyx_n_s_Z0n, __pyx_n_s_NRPhi0, __pyx_n_s_phiMinMax, __pyx_n_s_R0, __pyx_n_s_Z0, __pyx_n_s_dsF, __pyx_n_s_dSM, __pyx_n_s_dLr, __pyx_n_s_Rref, __pyx_n_s_dRPhir, __pyx_n_s_dS, __pyx_n_s_bla, __pyx_n_s_indR0, __pyx_n_s_indZ0, __pyx_n_s_iind, __pyx_n_s_iindF, __pyx_n_s_indM, __pyx_n_s_NL, __pyx_n_s_ptsrz, __pyx_n_s_pts, __pyx_n_s_PtsM, __pyx_n_s_VPbis, __pyx_n_s_Pts, __pyx_n_s_LPts, __pyx_n_s_LdS, __pyx_n_s_Lind, __pyx_n_s_nRPhi0, __pyx_n_s_ii, __pyx_n_s_nii); if (unlikely(!__pyx_tuple__344)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__344);
  __Pyx_GIVEREF(__pyx_tuple__344);
  __pyx_codeobj__345 = (PyObject*)__Pyx_PyCode_New(9, 0, 44, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__344, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_TorStruct_SubFromInd, 1262, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__345)) __PYX_ERR(0, 1262, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1366
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,
 */
  __pyx_tuple__346 = PyTuple_Pack(43, __pyx_n_s_XMinMax, __pyx_n_s_dL, __pyx_n_s_dX, __pyx_n_s_VPoly, __pyx_n_s_DX, __pyx_n_s_DY, __pyx_n_s_DZ, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_margin, __pyx_n_s_X, __pyx_n_s_Y0, __pyx_n_s_Z0, __pyx_n_s_dXr, __pyx_n_s_dY0r, __pyx_n_s_dZ0r, __pyx_n_s_NY0, __pyx_n_s_NZ0, __pyx_n_s_Y0n, __pyx_n_s_Z0n, __pyx_n_s_NX, __pyx_n_s_Xn, __pyx_n_s_Ln, __pyx_n_s_NR0, __pyx_n_s_Inter, __pyx_n_s_Pts, __pyx_n_s_PtsCross, __pyx_n_s_VPbis, __pyx_n_s_dS, __pyx_n_s_dLr, __pyx_n_s_Rref, __pyx_n_s_indX, __pyx_n_s_indY0, __pyx_n_s_indZ0, __pyx_n_s_indL, __pyx_n_s_NL, __pyx_n_s_ind, __pyx_n_s_InterX, __pyx_n_s_InterY, __pyx_n_s_InterZ, __pyx_n_s_indin, __pyx_n_s_pts, __pyx_n_s_iind); if (unlikely(!__pyx_tuple__346)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__346);
  __Pyx_GIVEREF(__pyx_tuple__346);
  __pyx_codeobj__347 = (PyObject*)__Pyx_PyCode_New(10, 0, 43, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__346, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_Lin_SubFromD_cython, 1366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__347)) __PYX_ERR(0, 1366, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1443
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                      double DIn=0., VIn=None, double margin=1.e-9):
 */
  __pyx_tuple__348 = PyTuple_Pack(35, __pyx_n_s_XMinMax, __pyx_n_s_dL, __pyx_n_s_dX, __pyx_n_s_VPoly, __pyx_n_s_ind, __pyx_n_s_DIn, __pyx_n_s_VIn, __pyx_n_s_margin, __pyx_n_s_dXr, __pyx_n_s_dY0r, __pyx_n_s_dZ0r, __pyx_n_s_NX, __pyx_n_s_NY0, __pyx_n_s_NZ0, __pyx_n_s_Ln, __pyx_n_s_NR0, __pyx_n_s_nii, __pyx_n_s_LPts, __pyx_n_s_LdS, __pyx_n_s_Pts, __pyx_n_s_PtsCross, __pyx_n_s_VPbis, __pyx_n_s_X, __pyx_n_s_Y0, __pyx_n_s_Z0, __pyx_n_s_dS, __pyx_n_s_dLr, __pyx_n_s_Rref, __pyx_n_s_indX, __pyx_n_s_indY0, __pyx_n_s_indZ0, __pyx_n_s_indL, __pyx_n_s_NL, __pyx_n_s_ii, __pyx_n_s_bla); if (unlikely(!__pyx_tuple__348)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__348);
  __Pyx_GIVEREF(__pyx_tuple__348);
  __pyx_codeobj__349 = (PyObject*)__Pyx_PyCode_New(8, 0, 35, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__348, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython, 1443, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__349)) __PYX_ERR(0, 1443, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":1532
 * 
 * 
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,             # <<<<<<<<<<<<<<
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 */
  __pyx_tuple__350 = PyTuple_Pack(45, __pyx_n_s_Ds, __pyx_n_s_dus, __pyx_n_s_VPoly, __pyx_n_s_VIn, __pyx_n_s_Lim, __pyx_n_s_LSPoly, __pyx_n_s_LSLim, __pyx_n_s_LSVIn, __pyx_n_s_RMin, __pyx_n_s_Forbid, __pyx_n_s_EpsUz, __pyx_n_s_EpsVz, __pyx_n_s_EpsA, __pyx_n_s_EpsB, __pyx_n_s_EpsPlane, __pyx_n_s_VType, __pyx_n_s_Test, __pyx_n_s_C1, __pyx_n_s_C2, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_v, __pyx_n_s_NL, __pyx_n_s_IOut, __pyx_n_s_PIn, __pyx_n_s_POut, __pyx_n_s_VperpIn, __pyx_n_s_VperpOut, __pyx_n_s_IIn, __pyx_n_s_kPOut, __pyx_n_s_kPIn, __pyx_n_s_Ind, __pyx_n_s_lslim, __pyx_n_s_pIn, __pyx_n_s_pOut, __pyx_n_s_vperpIn, __pyx_n_s_vperpOut, __pyx_n_s_iIn, __pyx_n_s_iOut, __pyx_n_s_kpin, __pyx_n_s_indNoNan, __pyx_n_s_indout, __pyx_n_s_pp, __pyx_n_s_ee, __pyx_n_s_ll); if (unlikely(!__pyx_tuple__350)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__350);
  __Pyx_GIVEREF(__pyx_tuple__350);
  __pyx_codeobj__351 = (PyObject*)__Pyx_PyCode_New(17, 0, 45, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__350, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_LOS_Calc_PInOut_VesStruct, 1532, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__351)) __PYX_ERR(0, 1532, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":2058
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_get_sample(double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, str dLMode='abs', str method='sum',
 *                    Test=True):
 */
  __pyx_tuple__352 = PyTuple_Pack(27, __pyx_n_s_Ds, __pyx_n_s_us, __pyx_n_s_dL, __pyx_n_s_DLs, __pyx_n_s_dLMode, __pyx_n_s_method, __pyx_n_s_Test, __pyx_n_s_C0, __pyx_n_s_C1, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_N, __pyx_n_s_ND, __pyx_n_s_kkk, __pyx_n_s_D0, __pyx_n_s_D1, __pyx_n_s_D2, __pyx_n_s_u0, __pyx_n_s_u1, __pyx_n_s_u2, __pyx_n_s_dl0, __pyx_n_s_dl, __pyx_n_s_dLr, __pyx_n_s_kk, __pyx_n_s_pts, __pyx_n_s_Pts, __pyx_n_s_k); if (unlikely(!__pyx_tuple__352)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__352);
  __Pyx_GIVEREF(__pyx_tuple__352);
  __pyx_codeobj__353 = (PyObject*)__Pyx_PyCode_New(7, 0, 27, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__352, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_LOS_get_sample, 2058, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__353)) __PYX_ERR(0, 2058, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":2362
 * 
 * 
 * def check_ff(ff, t=None, Ani=None, bool Vuniq=False):             # <<<<<<<<<<<<<<
 *     cdef bool ani
 *     stre = "Input emissivity function (ff)"
 */
  __pyx_tuple__354 = PyTuple_Pack(15, __pyx_n_s_ff, __pyx_n_s_t, __pyx_n_s_Ani, __pyx_n_s_Vuniq, __pyx_n_s_ani, __pyx_n_s_stre, __pyx_n_s_na, __pyx_n_s_kw, __pyx_n_s_C, __pyx_n_s_Pts, __pyx_n_s_NP, __pyx_n_s_out, __pyx_n_s_Str, __pyx_n_s_nt, __pyx_n_s_Vect); if (unlikely(!__pyx_tuple__354)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__354);
  __Pyx_GIVEREF(__pyx_tuple__354);
  __pyx_codeobj__355 = (PyObject*)__Pyx_PyCode_New(4, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__354, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_check_ff, 2362, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__355)) __PYX_ERR(0, 2362, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":2421
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},
 *                    str dLMode='abs', str method='simps',
 */
  __pyx_tuple__356 = PyTuple_Pack(31, __pyx_n_s_ff, __pyx_n_s_Ds, __pyx_n_s_us, __pyx_n_s_dL, __pyx_n_s_DLs, __pyx_n_s_t, __pyx_n_s_Ani, __pyx_n_s_fkwdargs, __pyx_n_s_dLMode, __pyx_n_s_method, __pyx_n_s_Test, __pyx_n_s_C0, __pyx_n_s_C1, __pyx_n_s_ani, __pyx_n_s_nt, __pyx_n_s_axm, __pyx_n_s_ii, __pyx_n_s_jj, __pyx_n_s_N, __pyx_n_s_ND, __pyx_n_s_kkk, __pyx_n_s_D0, __pyx_n_s_D1, __pyx_n_s_D2, __pyx_n_s_u0, __pyx_n_s_u1, __pyx_n_s_u2, __pyx_n_s_dl0, __pyx_n_s_dl, __pyx_n_s_pts, __pyx_n_s_sig); if (unlikely(!__pyx_tuple__356)) __PYX_ERR(0, 2421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__356);
  __Pyx_GIVEREF(__pyx_tuple__356);
  __pyx_codeobj__357 = (PyObject*)__Pyx_PyCode_New(11, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__356, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_LOS_calc_signal, 2421, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__357)) __PYX_ERR(0, 2421, __pyx_L1_error)

  /* "tofu/geom/_GG03.pyx":2777
 * 
 * 
 * def LOS_sino(double[:,::1] D, double[:,::1] u, double[::1] RZ, double[::1] kOut, str Mode='LOS', str VType='Tor'):             # <<<<<<<<<<<<<<
 *     cdef unsigned int nL = D.shape[1], ii
 *     cdef tuple out
 */
  __pyx_tuple__358 = PyTuple_Pack(16, __pyx_n_s_D, __pyx_n_s_u, __pyx_n_s_RZ, __pyx_n_s_kOut, __pyx_n_s_Mode, __pyx_n_s_VType, __pyx_n_s_nL, __pyx_n_s_ii, __pyx_n_s_out, __pyx_n_s_PMin, __pyx_n_s_kPMin, __pyx_n_s_RMin, __pyx_n_s_Theta, __pyx_n_s_p, __pyx_n_s_ImpTheta, __pyx_n_s_phi); if (unlikely(!__pyx_tuple__358)) __PYX_ERR(0, 2777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__358);
  __Pyx_GIVEREF(__pyx_tuple__358);
  __pyx_codeobj__359 = (PyObject*)__Pyx_PyCode_New(6, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__358, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_tofu_geom__GG03_pyx, __pyx_n_s_LOS_sino, 2777, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__359)) __PYX_ERR(0, 2777, __pyx_L1_error)

  /* "View.MemoryView":284
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_tuple__360 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__360)) __PYX_ERR(2, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__360);
  __Pyx_GIVEREF(__pyx_tuple__360);

  /* "View.MemoryView":285
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_tuple__361 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__361)) __PYX_ERR(2, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__361);
  __Pyx_GIVEREF(__pyx_tuple__361);

  /* "View.MemoryView":286
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__362 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__362)) __PYX_ERR(2, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__362);
  __Pyx_GIVEREF(__pyx_tuple__362);

  /* "View.MemoryView":289
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_tuple__363 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__363)) __PYX_ERR(2, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__363);
  __Pyx_GIVEREF(__pyx_tuple__363);

  /* "View.MemoryView":290
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__364 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__364)) __PYX_ERR(2, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__364);
  __Pyx_GIVEREF(__pyx_tuple__364);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_tuple__365 = 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__365)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__365);
  __Pyx_GIVEREF(__pyx_tuple__365);
  __pyx_codeobj__366 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__365, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__366)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
  __pyx_float_0_ = PyFloat_FromDouble(0.); if (unlikely(!__pyx_float_0_)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_2_ = PyFloat_FromDouble(2.); if (unlikely(!__pyx_float_2_)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_4_ = PyFloat_FromDouble(4.); if (unlikely(!__pyx_float_4_)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_6_ = PyFloat_FromDouble(6.); if (unlikely(!__pyx_float_6_)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_0_95 = PyFloat_FromDouble(0.95); if (unlikely(!__pyx_float_0_95)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_1_eneg_4 = PyFloat_FromDouble(1.e-4); if (unlikely(!__pyx_float_1_eneg_4)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_1_eneg_6 = PyFloat_FromDouble(1.e-6); if (unlikely(!__pyx_float_1_eneg_6)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_1_eneg_9 = PyFloat_FromDouble(1.e-9); if (unlikely(!__pyx_float_1_eneg_9)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_float_neg_0_5 = PyFloat_FromDouble(-0.5); if (unlikely(!__pyx_float_neg_0_5)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_GG03(void); /*proto*/
PyMODINIT_FUNC init_GG03(void)
#else
PyMODINIT_FUNC PyInit__GG03(void); /*proto*/
PyMODINIT_FUNC PyInit__GG03(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        result = PyDict_SetItemString(moddict, to_name, value);
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__pyx_m)
        return __Pyx_NewRef(__pyx_m);
    modname = PyObject_GetAttrString(spec, "name");
    if (unlikely(!modname)) goto bad;
    module = PyModule_NewObject(modname);
    Py_DECREF(modname);
    if (unlikely(!module)) goto bad;
    moddict = PyModule_GetDict(module);
    if (unlikely(!moddict)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static int __pyx_pymod_exec__GG03(PyObject *__pyx_pyinit_module)
#endif
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  double __pyx_t_4;
  static PyThread_type_lock __pyx_t_5[8];
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0;
  #endif
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__GG03(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 2, __pyx_L1_error)
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  #ifdef __Pyx_StopAsyncIteration_USED
  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __pyx_m = __pyx_pyinit_module;
  Py_INCREF(__pyx_m);
  #else
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("_GG03", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 2, __pyx_L1_error)
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 2, __pyx_L1_error)
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 2, __pyx_L1_error)
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 2, __pyx_L1_error);
  /*--- Initialize various global constants etc. ---*/
  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif
  if (__pyx_module_is_main_tofu__geom___GG03) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 2, __pyx_L1_error)
    if (!PyDict_GetItemString(modules, "tofu.geom._GG03")) {
      if (unlikely(PyDict_SetItemString(modules, "tofu.geom._GG03", __pyx_m) < 0)) __PYX_ERR(0, 2, __pyx_L1_error)
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  /*--- Constants init code ---*/
  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  /*--- Global init code ---*/
  generic = Py_None; Py_INCREF(Py_None);
  strided = Py_None; Py_INCREF(Py_None);
  indirect = Py_None; Py_INCREF(Py_None);
  contiguous = Py_None; Py_INCREF(Py_None);
  indirect_contiguous = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_array = &__pyx_vtable_array;
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error)
  __pyx_type___pyx_array.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 103, __pyx_L1_error)
  __pyx_array_type = &__pyx_type___pyx_array;
  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 277, __pyx_L1_error)
  __pyx_type___pyx_MemviewEnum.tp_print = 0;
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 277, __pyx_L1_error)
  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 328, __pyx_L1_error)
  __pyx_type___pyx_memoryview.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 328, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 328, __pyx_L1_error)
  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 953, __pyx_L1_error)
  __pyx_type___pyx_memoryviewslice.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 953, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 953, __pyx_L1_error)
  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  /*--- Type import code ---*/
  __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", 
  #if CYTHON_COMPILING_IN_PYPY
  sizeof(PyTypeObject),
  #else
  sizeof(PyHeapTypeObject),
  #endif
  0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(3, 9, __pyx_L1_error)
  __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(4, 8, __pyx_L1_error)
  __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(5, 15, __pyx_L1_error)
  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 163, __pyx_L1_error)
  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 185, __pyx_L1_error)
  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 189, __pyx_L1_error)
  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 198, __pyx_L1_error)
  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 885, __pyx_L1_error)
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/
  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  #endif

  /* "tofu/geom/_GG03.pyx":12
 * 
 * # import
 * import sys             # <<<<<<<<<<<<<<
 * import numpy as np
 * import scipy.integrate as scpintg
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":13
 * # import
 * import sys
 * import numpy as np             # <<<<<<<<<<<<<<
 * import scipy.integrate as scpintg
 * from matplotlib.path import Path
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":14
 * import sys
 * import numpy as np
 * import scipy.integrate as scpintg             # <<<<<<<<<<<<<<
 * from matplotlib.path import Path
 * 
 */
  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s__305);
  __Pyx_GIVEREF(__pyx_n_s__305);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s__305);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_integrate, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scpintg, __pyx_t_2) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "tofu/geom/_GG03.pyx":15
 * import numpy as np
 * import scipy.integrate as scpintg
 * from matplotlib.path import Path             # <<<<<<<<<<<<<<
 * 
 * if sys.version[0]=='3':
 */
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_n_s_Path);
  __Pyx_GIVEREF(__pyx_n_s_Path);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Path);
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_matplotlib_path, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Path); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Path, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":17
 * from matplotlib.path import Path
 * 
 * if sys.version[0]=='3':             # <<<<<<<<<<<<<<
 *     from inspect import signature as insp
 * elif sys.version[0]=='2':
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s_3, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 17, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "tofu/geom/_GG03.pyx":18
 * 
 * if sys.version[0]=='3':
 *     from inspect import signature as insp             # <<<<<<<<<<<<<<
 * elif sys.version[0]=='2':
 *     from inspect import getargspec as insp
 */
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_n_s_signature);
    __Pyx_GIVEREF(__pyx_n_s_signature);
    PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_signature);
    __pyx_t_2 = __Pyx_patch_inspect(__Pyx_Import(__pyx_n_s_inspect, __pyx_t_1, -1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_signature); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_insp, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "tofu/geom/_GG03.pyx":17
 * from matplotlib.path import Path
 * 
 * if sys.version[0]=='3':             # <<<<<<<<<<<<<<
 *     from inspect import signature as insp
 * elif sys.version[0]=='2':
 */
    goto __pyx_L2;
  }

  /* "tofu/geom/_GG03.pyx":19
 * if sys.version[0]=='3':
 *     from inspect import signature as insp
 * elif sys.version[0]=='2':             # <<<<<<<<<<<<<<
 *     from inspect import getargspec as insp
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_version); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s_2, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 19, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "tofu/geom/_GG03.pyx":20
 *     from inspect import signature as insp
 * elif sys.version[0]=='2':
 *     from inspect import getargspec as insp             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_n_s_getargspec);
    __Pyx_GIVEREF(__pyx_n_s_getargspec);
    PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_getargspec);
    __pyx_t_1 = __Pyx_patch_inspect(__Pyx_Import(__pyx_n_s_inspect, __pyx_t_2, -1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_getargspec); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_insp, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "tofu/geom/_GG03.pyx":19
 * if sys.version[0]=='3':
 *     from inspect import signature as insp
 * elif sys.version[0]=='2':             # <<<<<<<<<<<<<<
 *     from inspect import getargspec as insp
 * 
 */
  }
  __pyx_L2:;

  /* "tofu/geom/_GG03.pyx":24
 * 
 * 
 * __all__ = ['CoordShift',             # <<<<<<<<<<<<<<
 *            'Poly_isClockwise', 'Poly_Order', 'Poly_VolAngTor',
 *            'Sino_ImpactEnv', 'ConvertImpact_Theta2Xi',
 */
  __pyx_t_1 = PyList_New(26); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_CoordShift);
  __Pyx_GIVEREF(__pyx_n_s_CoordShift);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_CoordShift);
  __Pyx_INCREF(__pyx_n_s_Poly_isClockwise);
  __Pyx_GIVEREF(__pyx_n_s_Poly_isClockwise);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Poly_isClockwise);
  __Pyx_INCREF(__pyx_n_s_Poly_Order);
  __Pyx_GIVEREF(__pyx_n_s_Poly_Order);
  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_Poly_Order);
  __Pyx_INCREF(__pyx_n_s_Poly_VolAngTor);
  __Pyx_GIVEREF(__pyx_n_s_Poly_VolAngTor);
  PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_Poly_VolAngTor);
  __Pyx_INCREF(__pyx_n_s_Sino_ImpactEnv);
  __Pyx_GIVEREF(__pyx_n_s_Sino_ImpactEnv);
  PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_Sino_ImpactEnv);
  __Pyx_INCREF(__pyx_n_s_ConvertImpact_Theta2Xi);
  __Pyx_GIVEREF(__pyx_n_s_ConvertImpact_Theta2Xi);
  PyList_SET_ITEM(__pyx_t_1, 5, __pyx_n_s_ConvertImpact_Theta2Xi);
  __Pyx_INCREF(__pyx_n_s_Ves_isInside);
  __Pyx_GIVEREF(__pyx_n_s_Ves_isInside);
  PyList_SET_ITEM(__pyx_t_1, 6, __pyx_n_s_Ves_isInside);
  __Pyx_INCREF(__pyx_n_s_Ves_mesh_dlfromL_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_mesh_dlfromL_cython);
  PyList_SET_ITEM(__pyx_t_1, 7, __pyx_n_s_Ves_mesh_dlfromL_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_meshCross_FromD);
  __Pyx_GIVEREF(__pyx_n_s_Ves_meshCross_FromD);
  PyList_SET_ITEM(__pyx_t_1, 8, __pyx_n_s_Ves_meshCross_FromD);
  __Pyx_INCREF(__pyx_n_s_Ves_meshCross_FromInd);
  __Pyx_GIVEREF(__pyx_n_s_Ves_meshCross_FromInd);
  PyList_SET_ITEM(__pyx_t_1, 9, __pyx_n_s_Ves_meshCross_FromInd);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_Cross);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_Cross);
  PyList_SET_ITEM(__pyx_t_1, 10, __pyx_n_s_Ves_Smesh_Cross);
  __Pyx_INCREF(__pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython);
  PyList_SET_ITEM(__pyx_t_1, 11, __pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython);
  PyList_SET_ITEM(__pyx_t_1, 12, __pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython);
  PyList_SET_ITEM(__pyx_t_1, 13, __pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython);
  PyList_SET_ITEM(__pyx_t_1, 14, __pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_Tor_SubFromD_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_Tor_SubFromD_cython);
  PyList_SET_ITEM(__pyx_t_1, 15, __pyx_n_s_Ves_Smesh_Tor_SubFromD_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython);
  PyList_SET_ITEM(__pyx_t_1, 16, __pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy);
  PyList_SET_ITEM(__pyx_t_1, 17, __pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_TorStruct_SubFromInd);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_TorStruct_SubFromInd);
  PyList_SET_ITEM(__pyx_t_1, 18, __pyx_n_s_Ves_Smesh_TorStruct_SubFromInd);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_Lin_SubFromD_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_Lin_SubFromD_cython);
  PyList_SET_ITEM(__pyx_t_1, 19, __pyx_n_s_Ves_Smesh_Lin_SubFromD_cython);
  __Pyx_INCREF(__pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython);
  __Pyx_GIVEREF(__pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython);
  PyList_SET_ITEM(__pyx_t_1, 20, __pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython);
  __Pyx_INCREF(__pyx_n_s_LOS_Calc_PInOut_VesStruct);
  __Pyx_GIVEREF(__pyx_n_s_LOS_Calc_PInOut_VesStruct);
  PyList_SET_ITEM(__pyx_t_1, 21, __pyx_n_s_LOS_Calc_PInOut_VesStruct);
  __Pyx_INCREF(__pyx_n_s_check_ff);
  __Pyx_GIVEREF(__pyx_n_s_check_ff);
  PyList_SET_ITEM(__pyx_t_1, 22, __pyx_n_s_check_ff);
  __Pyx_INCREF(__pyx_n_s_LOS_get_sample);
  __Pyx_GIVEREF(__pyx_n_s_LOS_get_sample);
  PyList_SET_ITEM(__pyx_t_1, 23, __pyx_n_s_LOS_get_sample);
  __Pyx_INCREF(__pyx_n_s_LOS_calc_signal);
  __Pyx_GIVEREF(__pyx_n_s_LOS_calc_signal);
  PyList_SET_ITEM(__pyx_t_1, 24, __pyx_n_s_LOS_calc_signal);
  __Pyx_INCREF(__pyx_n_s_LOS_sino);
  __Pyx_GIVEREF(__pyx_n_s_LOS_sino);
  PyList_SET_ITEM(__pyx_t_1, 25, __pyx_n_s_LOS_sino);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_all_2, __pyx_t_1) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":49
 * ########################################################
 * 
 * def CoordShift(Pts, In='(X,Y,Z)', Out='(R,Z)', CrossRef=None):             # <<<<<<<<<<<<<<
 *     """ Check the shape of an array of points coordinates and/or converts from 2D to 3D, 3D to 2D, cylindrical to cartesian... (CrossRef is an angle (Tor) or a distance (X for Lin))"""
 *     assert all([type(ff) is str and ',' in ff for ff in [In,Out]]), "Arg In and Out (coordinate format) must be comma-separated  !"
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_1CoordShift, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_CoordShift, __pyx_t_1) < 0) __PYX_ERR(0, 49, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":143
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def Poly_isClockwise(cnp.ndarray[double,ndim=2] Poly):             # <<<<<<<<<<<<<<
 *     """ Assuming 2D closed Poly ! """
 *     cdef int ii, NP=Poly.shape[1]
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_3Poly_isClockwise, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Poly_isClockwise, __pyx_t_1) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":152
 * 
 * 
 * def Poly_Order(cnp.ndarray[double,ndim=2] Poly, str order='C', Clock=False, close=True, str layout='(cc,N)', str layout_in=None, Test=True):             # <<<<<<<<<<<<<<
 *     """
 *     Return a polygon Poly as a np.ndarray formatted according to parameters
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_5Poly_Order, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Poly_Order, __pyx_t_1) < 0) __PYX_ERR(0, 152, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":198
 * 
 * 
 * def Poly_VolAngTor(cnp.ndarray[double,ndim=2,mode='c'] Poly):             # <<<<<<<<<<<<<<
 *     cdef cnp.ndarray[double,ndim=1] Ri0=Poly[0,:-1], Ri1=Poly[0,1:], Zi0=Poly[1,:-1], Zi1=Poly[1,1:]
 *     cdef double V = np.sum((Ri0*Zi1 - Zi0*Ri1)*(Ri0+Ri1))/6.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_7Poly_VolAngTor, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Poly_VolAngTor, __pyx_t_1) < 0) __PYX_ERR(0, 198, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":218
 * 
 * 
 * def Sino_ImpactEnv(cnp.ndarray[double,ndim=1] RZ, cnp.ndarray[double,ndim=2] Poly, int NP=50, Test=True):             # <<<<<<<<<<<<<<
 *     """ Computes impact parameters of a Tor enveloppe (Tor is a closed 2D polygon)
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_9Sino_ImpactEnv, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Sino_ImpactEnv, __pyx_t_1) < 0) __PYX_ERR(0, 218, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":244
 * 
 * # For sinograms
 * def ConvertImpact_Theta2Xi(theta, pP, pN, sort=True):             # <<<<<<<<<<<<<<
 *     if hasattr(theta,'__getitem__'):
 *         pP, pN, theta = np.asarray(pP), np.asarray(pN), np.asarray(theta)
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_11ConvertImpact_Theta2Xi, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ConvertImpact_Theta2Xi, __pyx_t_1) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":284
 * ########################################################
 * 
 * def _Ves_isInside(Pts, VPoly, Lim=None, VType='Tor', In='(X,Y,Z)', Test=True):             # <<<<<<<<<<<<<<
 *     if Test:
 *         assert type(Pts) is np.ndarray and Pts.ndim in [1,2], "Arg Pts must be a 1D or 2D np.ndarray !"
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_13_Ves_isInside, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_isInside, __pyx_t_1) < 0) __PYX_ERR(0, 284, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":338
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_mesh_dlfromL_cython(double[::1] LMinMax, double dL, DL=None, Lim=True, dLMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     """ Get the actual reolution from the desired resolution and MinMax and limits """
 *     # Get the number of mesh elements in LMinMax
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_15_Ves_mesh_dlfromL_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_mesh_dlfromL_cython, __pyx_t_1) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":399
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromD(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, D1=None, D2=None,str dSMode='abs', VPoly=None, double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_17_Ves_meshCross_FromD, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_meshCross_FromD, __pyx_t_1) < 0) __PYX_ERR(0, 399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":433
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_meshCross_FromInd(double[::1] MinMax1, double[::1] MinMax2, double d1, double d2, long[::1] ind, str dSMode='abs', double margin=1.e-9):             # <<<<<<<<<<<<<<
 *     cdef double[::1] X1, X2
 *     cdef double dX1, dX2
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_19_Ves_meshCross_FromInd, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_meshCross_FromInd, __pyx_t_1) < 0) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":460
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Cross(double[:,::1] VPoly, double dL, str dLMode='abs', D1=None, D2=None, double margin=1.e-9, double DIn=0., VIn=None):             # <<<<<<<<<<<<<<
 *     cdef int ii, jj, nn=0, NP=VPoly.shape[1]
 *     cdef double[::1] LMinMax, L
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_21_Ves_Smesh_Cross, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_Cross, __pyx_t_1) < 0) __PYX_ERR(0, 460, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":547
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromD_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[::1] RMinMax, double[::1] ZMinMax,
 *                                    DR=None, DZ=None, DPhi=None, VPoly=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_23_Ves_Vmesh_Tor_SubFromD_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Vmesh_Tor_SubFromD_cython, __pyx_t_1) < 0) __PYX_ERR(0, 547, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":679
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Vmesh_Tor_SubFromInd_cython(double dR, double dZ, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[::1] RMinMax, double[::1] ZMinMax, long[::1] ind,
 *                                      str Out='(X,Y,Z)', double margin=1.e-9):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_25_Ves_Vmesh_Tor_SubFromInd_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Vmesh_Tor_SubFromInd_cython, __pyx_t_1) < 0) __PYX_ERR(0, 679, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":756
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromD_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                    double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                    DX=None, DY=None, DZ=None, VPoly=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_27_Ves_Vmesh_Lin_SubFromD_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Vmesh_Lin_SubFromD_cython, __pyx_t_1) < 0) __PYX_ERR(0, 756, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":786
 * 
 * 
 * def _Ves_Vmesh_Lin_SubFromInd_cython(double dX, double dY, double dZ,             # <<<<<<<<<<<<<<
 *                                      double[::1] XMinMax, double[::1] YMinMax, double[::1] ZMinMax,
 *                                      cnp.ndarray[long,ndim=1] ind, double margin=1.e-9):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_29_Ves_Vmesh_Lin_SubFromInd_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Vmesh_Lin_SubFromInd_cython, __pyx_t_1) < 0) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":822
 * ########################################################
 * 
 * def _getBoundsInter2AngSeg(bool Full, double Phi0, double Phi1, double DPhi0, double DPhi1):             # <<<<<<<<<<<<<<
 *     """ Return Inter=True if an intersection exist (all angles in radians in [-pi;pi])
 * 
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_31_getBoundsInter2AngSeg, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_getBoundsInter2AngSeg, __pyx_t_1) < 0) __PYX_ERR(0, 822, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":901
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromD_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DR=None, DZ=None, DPhi=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_33_Ves_Smesh_Tor_SubFromD_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_Tor_SubFromD_cython, __pyx_t_1) < 0) __PYX_ERR(0, 901, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1057
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Tor_SubFromInd_cython(double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, long[::1] ind,
 *                                      double DIn=0., VIn=None, PhiMinMax=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_35_Ves_Smesh_Tor_SubFromInd_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_Tor_SubFromInd_cython, __pyx_t_1) < 0) __PYX_ERR(0, 1057, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1149
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromD_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                          double[:,::1] VPoly,
 *                                          DR=None, DZ=None, DPhi=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_37_Ves_Smesh_TorStruct_SubFromD_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_TorStruct_SubFromD_cy, __pyx_t_1) < 0) __PYX_ERR(0, 1149, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1262
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_TorStruct_SubFromInd_cython(double[::1] PhiMinMax, double dL, double dRPhi,             # <<<<<<<<<<<<<<
 *                                            double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                            double DIn=0., VIn=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_39_Ves_Smesh_TorStruct_SubFromInd_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_TorStruct_SubFromInd, __pyx_t_1) < 0) __PYX_ERR(0, 1262, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1366
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromD_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                    double[:,::1] VPoly,
 *                                    DX=None, DY=None, DZ=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_41_Ves_Smesh_Lin_SubFromD_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_Lin_SubFromD_cython, __pyx_t_1) < 0) __PYX_ERR(0, 1366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1443
 * @cython.wraparound(False)
 * @cython.boundscheck(False)
 * def _Ves_Smesh_Lin_SubFromInd_cython(double[::1] XMinMax, double dL, double dX,             # <<<<<<<<<<<<<<
 *                                      double[:,::1] VPoly, cnp.ndarray[long,ndim=1] ind,
 *                                      double DIn=0., VIn=None, double margin=1.e-9):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_43_Ves_Smesh_Lin_SubFromInd_cython, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Ves_Smesh_Lin_SubFromInd_cython, __pyx_t_1) < 0) __PYX_ERR(0, 1443, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":1532
 * 
 * 
 * def LOS_Calc_PInOut_VesStruct(Ds, dus,             # <<<<<<<<<<<<<<
 *                               cnp.ndarray[double, ndim=2,mode='c'] VPoly, cnp.ndarray[double, ndim=2,mode='c'] VIn, Lim=None,
 *                               LSPoly=None, LSLim=None, LSVIn=None,
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_45LOS_Calc_PInOut_VesStruct, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOS_Calc_PInOut_VesStruct, __pyx_t_1) < 0) __PYX_ERR(0, 1532, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2058
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_get_sample(double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, str dLMode='abs', str method='sum',
 *                    Test=True):
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_47LOS_get_sample, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOS_get_sample, __pyx_t_1) < 0) __PYX_ERR(0, 2058, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2362
 * 
 * 
 * def check_ff(ff, t=None, Ani=None, bool Vuniq=False):             # <<<<<<<<<<<<<<
 *     cdef bool ani
 *     stre = "Input emissivity function (ff)"
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_49check_ff, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_ff, __pyx_t_1) < 0) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2422
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},             # <<<<<<<<<<<<<<
 *                    str dLMode='abs', str method='simps',
 *                    Test=True):
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2422, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k__262 = ((PyObject*)__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2421
 * @cython.linetrace(False)
 * @cython.binding(False)
 * def LOS_calc_signal(ff, double[:,::1] Ds, double[:,::1] us, dL,             # <<<<<<<<<<<<<<
 *                    double[:,::1] DLs, t=None, Ani=None, dict fkwdargs={},
 *                    str dLMode='abs', str method='simps',
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_51LOS_calc_signal, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2421, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOS_calc_signal, __pyx_t_1) < 0) __PYX_ERR(0, 2421, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2733
 * 
 * 
 * cdef LOS_sino_Tor(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    uN = Csqrt(u0**2+u1**2+u2**2), uParN = Csqrt(u0**2+u1**2), DParN = Csqrt(D0**2+D1**2)
 *     cdef double    Sca = u0*D0+u1*D1+u2*D2, ScaP = u0*D0+u1*D1
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_inf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2733, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_k__275 = __pyx_t_4;

  /* "tofu/geom/_GG03.pyx":2757
 * 
 * 
 * cdef LOS_sino_Lin(double D0, double D1, double D2, double u0, double u1, double u2, double RZ0, double RZ1, str Mode='LOS', double kOut=np.inf):             # <<<<<<<<<<<<<<
 *     cdef double    kPMin
 *     if u0**2==1.:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_inf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 2757, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_k__276 = __pyx_t_4;

  /* "tofu/geom/_GG03.pyx":2777
 * 
 * 
 * def LOS_sino(double[:,::1] D, double[:,::1] u, double[::1] RZ, double[::1] kOut, str Mode='LOS', str VType='Tor'):             # <<<<<<<<<<<<<<
 *     cdef unsigned int nL = D.shape[1], ii
 *     cdef tuple out
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4tofu_4geom_5_GG03_53LOS_sino, NULL, __pyx_n_s_tofu_geom__GG03); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOS_sino, __pyx_t_1) < 0) __PYX_ERR(0, 2777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "tofu/geom/_GG03.pyx":2
 * 
 * # cimport             # <<<<<<<<<<<<<<
 * cimport cython
 * cimport numpy as cnp
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "View.MemoryView":207
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(array self):
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 207, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_array_type);

  /* "View.MemoryView":284
 *         return self.name
 * 
 * cdef generic = Enum("<strided and direct or indirect>")             # <<<<<<<<<<<<<<
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__360, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(generic);
  __Pyx_DECREF_SET(generic, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":285
 * 
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default             # <<<<<<<<<<<<<<
 * cdef indirect = Enum("<strided and indirect>")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__361, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(strided);
  __Pyx_DECREF_SET(strided, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":286
 * cdef generic = Enum("<strided and direct or indirect>")
 * cdef strided = Enum("<strided and direct>") # default
 * cdef indirect = Enum("<strided and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__362, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(indirect);
  __Pyx_DECREF_SET(indirect, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":289
 * 
 * 
 * cdef contiguous = Enum("<contiguous and direct>")             # <<<<<<<<<<<<<<
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__363, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(contiguous);
  __Pyx_DECREF_SET(contiguous, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":290
 * 
 * cdef contiguous = Enum("<contiguous and direct>")
 * cdef indirect_contiguous = Enum("<contiguous and indirect>")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__364, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(indirect_contiguous);
  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "View.MemoryView":314
 * 
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0             # <<<<<<<<<<<<<<
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
 *     PyThread_allocate_lock(),
 */
  __pyx_memoryview_thread_locks_used = 0;

  /* "View.MemoryView":315
 * DEF THREAD_LOCKS_PREALLOCATED = 8
 * cdef int __pyx_memoryview_thread_locks_used = 0
 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [             # <<<<<<<<<<<<<<
 *     PyThread_allocate_lock(),
 *     PyThread_allocate_lock(),
 */
  __pyx_t_5[0] = PyThread_allocate_lock();
  __pyx_t_5[1] = PyThread_allocate_lock();
  __pyx_t_5[2] = PyThread_allocate_lock();
  __pyx_t_5[3] = PyThread_allocate_lock();
  __pyx_t_5[4] = PyThread_allocate_lock();
  __pyx_t_5[5] = PyThread_allocate_lock();
  __pyx_t_5[6] = PyThread_allocate_lock();
  __pyx_t_5[7] = PyThread_allocate_lock();
  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_5, sizeof(__pyx_memoryview_thread_locks[0]) * (8));

  /* "View.MemoryView":537
 *         info.obj = self
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 537, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_memoryview_type);

  /* "View.MemoryView":983
 *         return self.from_object
 * 
 *     __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 983, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 983, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_memoryviewslice_type);

  /* "(tree fragment)":1
 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xb068931:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __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)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":9
 *         __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.name = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init tofu.geom._GG03", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init tofu.geom._GG03");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  return (__pyx_m != NULL) ? 0 : -1;
  #elif PY_MAJOR_VERSION >= 3
  return __pyx_m;
  #else
  return;
  #endif
}

/* --- Runtime support code --- */
/* Refnanny */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* GetBuiltinName */
static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

/* RaiseDoubleKeywords */
static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

/* ParseKeywords */
static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

/* RaiseArgTupleInvalid */
static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* GetModuleGlobalName */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

/* PyIntBinop */
  #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    if (op1 == op2) {
        Py_RETURN_TRUE;
    }
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long a = PyInt_AS_LONG(op1);
        if (a == b) {
            Py_RETURN_TRUE;
        } else {
            Py_RETURN_FALSE;
        }
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a;
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
                    }
                #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
                default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
                #else
                default: Py_RETURN_FALSE;
                #endif
            }
        }
            if (a == b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            if ((double)a == (double)b) {
                Py_RETURN_TRUE;
            } else {
                Py_RETURN_FALSE;
            }
    }
    return PyObject_RichCompare(op1, op2, Py_EQ);
}
#endif

/* GetItemInt */
  static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

/* PyCFunctionFastCall */
  #if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
    PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    int flags = PyCFunction_GET_FLAGS(func);
    assert(PyCFunction_Check(func));
    assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
    assert(nargs >= 0);
    assert(nargs == 0 || args != NULL);
    /* _PyCFunction_FastCallDict() must not be called with an exception set,
       because it may clear it (directly or indirectly) and so the
       caller loses its exception */
    assert(!PyErr_Occurred());
    if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
        return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs);
    }
}
#endif

/* PyFunctionFastCall */
  #if CYTHON_FAST_PYCALL
#include "frameobject.h"
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = f->f_localsplus;
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
#if PY_MAJOR_VERSION >= 3
    PyObject *kwdefs;
#endif
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
        return NULL;
    }
    if (
#if PY_MAJOR_VERSION >= 3
            co->co_kwonlyargcount == 0 &&
#endif
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
#if PY_MAJOR_VERSION >= 3
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
#endif
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
#if PY_MAJOR_VERSION >= 3
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, nargs,
                               k, (int)nk,
                               d, (int)nd, closure);
#endif
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif
#endif

/* PyObjectCallMethO */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

/* PyObjectCallOneArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, &arg, 1);
    }
#endif
    if (likely(PyCFunction_Check(func))) {
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
#if CYTHON_FAST_PYCCALL
        } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
            return __Pyx_PyCFunction_FastCall(func, &arg, 1);
#endif
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_Pack(1, arg);
    if (unlikely(!args)) return NULL;
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
#endif

/* PyObjectCallNoArg */
  #if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCall(func, NULL, 0);
    }
#endif
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

/* BytesEquals */
    static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
    static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#endif
}

/* PyObjectCallMethod1 */
    static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = NULL;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(function)) {
                PyObject *args[2] = {self, arg};
                result = __Pyx_PyCFunction_FastCall(function, args, 2);
                goto done;
            }
            #endif
            args = PyTuple_New(2);
            if (unlikely(!args)) goto done;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
    goto done;
done:
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto done;
    result = __Pyx__PyObject_CallMethod1(method, arg);
done:
    Py_XDECREF(method);
    return result;
}

/* append */
    static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PyErrFetchRestore */
    #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}
#endif

/* RaiseException */
    #if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    __Pyx_PyThreadState_declare
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_PyThreadState_assign
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                int is_subclass = PyObject_IsSubclass(instance_class, type);
                if (!is_subclass) {
                    instance_class = NULL;
                } else if (unlikely(is_subclass == -1)) {
                    goto bad;
                } else {
                    type = instance_class;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = __Pyx_PyThreadState_Current;
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

/* ArgTypeTest */
    static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
{
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    else if (exact) {
        #if PY_MAJOR_VERSION == 2
        if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
        #endif
    }
    else {
        if (likely(__Pyx_TypeCheck(obj, type))) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

/* IsLittleEndian */
    static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
{
  union {
    uint32_t u32;
    uint8_t u8[4];
  } S;
  S.u32 = 0x01020304;
  return S.u8[0] == 4;
}

/* BufferFormatCheck */
    static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type) {
  stack[0].field = &ctx->root;
  stack[0].parent_offset = 0;
  ctx->root.type = type;
  ctx->root.name = "buffer dtype";
  ctx->root.offset = 0;
  ctx->head = stack;
  ctx->head->field = &ctx->root;
  ctx->fmt_offset = 0;
  ctx->head->parent_offset = 0;
  ctx->new_packmode = '@';
  ctx->enc_packmode = '@';
  ctx->new_count = 1;
  ctx->enc_count = 0;
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  ctx->is_valid_array = 0;
  ctx->struct_alignment = 0;
  while (type->typegroup == 'S') {
    ++ctx->head;
    ctx->head->field = type->fields;
    ctx->head->parent_offset = 0;
    type = type->fields->type;
  }
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
    int count;
    const char* t = *ts;
    if (*t < '0' || *t > '9') {
      return -1;
    } else {
        count = *t++ - '0';
        while (*t >= '0' && *t < '9') {
            count *= 10;
            count += *t++ - '0';
        }
    }
    *ts = t;
    return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
    int number = __Pyx_BufFmt_ParseNumber(ts);
    if (number == -1)
        PyErr_Format(PyExc_ValueError,\
                     "Does not understand character buffer dtype format string ('%c')", **ts);
    return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  PyErr_Format(PyExc_ValueError,
               "Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  switch (ch) {
    case 'c': return "'char'";
    case 'b': return "'signed char'";
    case 'B': return "'unsigned char'";
    case 'h': return "'short'";
    case 'H': return "'unsigned short'";
    case 'i': return "'int'";
    case 'I': return "'unsigned int'";
    case 'l': return "'long'";
    case 'L': return "'unsigned long'";
    case 'q': return "'long long'";
    case 'Q': return "'unsigned long long'";
    case 'f': return (is_complex ? "'complex float'" : "'float'");
    case 'd': return (is_complex ? "'complex double'" : "'double'");
    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
    case 'T': return "a struct";
    case 'O': return "Python object";
    case 'P': return "a pointer";
    case 's': case 'p': return "a string";
    case 0: return "end";
    default: return "unparseable format string";
  }
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return 2;
    case 'i': case 'I': case 'l': case 'L': return 4;
    case 'q': case 'Q': return 8;
    case 'f': return (is_complex ? 8 : 4);
    case 'd': return (is_complex ? 16 : 8);
    case 'g': {
      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
      return 0;
    }
    case 'O': case 'P': return sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  switch (ch) {
    case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(short);
    case 'i': case 'I': return sizeof(int);
    case 'l': case 'L': return sizeof(long);
    #ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
    #endif
    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
    case 'O': case 'P': return sizeof(void*);
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
/* These are for computing the padding at the end of the struct to align
   on the first member of the struct. This will probably the same as above,
   but we don't have any guarantees.
 */
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  switch (ch) {
    case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
    case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
    case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
    case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
    case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
    case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
    case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
    case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
    case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
    default:
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  switch (ch) {
    case 'c':
        return 'H';
    case 'b': case 'h': case 'i':
    case 'l': case 'q': case 's': case 'p':
        return 'I';
    case 'B': case 'H': case 'I': case 'L': case 'Q':
        return 'U';
    case 'f': case 'd': case 'g':
        return (is_complex ? 'C' : 'R');
    case 'O':
        return 'O';
    case 'P':
        return 'P';
    default: {
      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
      return 0;
    }
  }
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
    const char* expected;
    const char* quote;
    if (ctx->head == NULL) {
      expected = "end";
      quote = "";
    } else {
      expected = ctx->head->field->type->name;
      quote = "'";
    }
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected %s%s%s but got %s",
                 quote, expected, quote,
                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  } else {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_StructField* parent = (ctx->head - 1)->field;
    PyErr_Format(PyExc_ValueError,
                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
                 parent->type->name, field->name);
  }
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  char group;
  size_t size, offset, arraysize = 1;
  if (ctx->enc_type == 0) return 0;
  if (ctx->head->field->type->arraysize[0]) {
    int i, ndim = 0;
    if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
        ctx->is_valid_array = ctx->head->field->type->ndim == 1;
        ndim = 1;
        if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
            PyErr_Format(PyExc_ValueError,
                         "Expected a dimension of size %zu, got %zu",
                         ctx->head->field->type->arraysize[0], ctx->enc_count);
            return -1;
        }
    }
    if (!ctx->is_valid_array) {
      PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
                   ctx->head->field->type->ndim, ndim);
      return -1;
    }
    for (i = 0; i < ctx->head->field->type->ndim; i++) {
      arraysize *= ctx->head->field->type->arraysize[i];
    }
    ctx->is_valid_array = 0;
    ctx->enc_count = 1;
  }
  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  do {
    __Pyx_StructField* field = ctx->head->field;
    __Pyx_TypeInfo* type = field->type;
    if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
    } else {
      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
    }
    if (ctx->enc_packmode == '@') {
      size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
      size_t align_mod_offset;
      if (align_at == 0) return -1;
      align_mod_offset = ctx->fmt_offset % align_at;
      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
      if (ctx->struct_alignment == 0)
          ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
                                                                 ctx->is_complex);
    }
    if (type->size != size || type->typegroup != group) {
      if (type->typegroup == 'C' && type->fields != NULL) {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        ++ctx->head;
        ctx->head->field = type->fields;
        ctx->head->parent_offset = parent_offset;
        continue;
      }
      if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
      } else {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
      }
    }
    offset = ctx->head->parent_offset + field->offset;
    if (ctx->fmt_offset != offset) {
      PyErr_Format(PyExc_ValueError,
                   "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
                   (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
      return -1;
    }
    ctx->fmt_offset += size;
    if (arraysize)
      ctx->fmt_offset += (arraysize - 1) * size;
    --ctx->enc_count;
    while (1) {
      if (field == &ctx->root) {
        ctx->head = NULL;
        if (ctx->enc_count != 0) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return -1;
        }
        break;
      }
      ctx->head->field = ++field;
      if (field->type == NULL) {
        --ctx->head;
        field = ctx->head->field;
        continue;
      } else if (field->type->typegroup == 'S') {
        size_t parent_offset = ctx->head->parent_offset + field->offset;
        if (field->type->fields->type == NULL) continue;
        field = field->type->fields;
        ++ctx->head;
        ctx->head->field = field;
        ctx->head->parent_offset = parent_offset;
        break;
      } else {
        break;
      }
    }
  } while (ctx->enc_count);
  ctx->enc_type = 0;
  ctx->is_complex = 0;
  return 0;
}
static PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
    const char *ts = *tsp;
    int i = 0, number;
    int ndim = ctx->head->field->type->ndim;
;
    ++ts;
    if (ctx->new_count != 1) {
        PyErr_SetString(PyExc_ValueError,
                        "Cannot handle repeated arrays in format string");
        return NULL;
    }
    if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
    while (*ts && *ts != ')') {
        switch (*ts) {
            case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
            default:  break;
        }
        number = __Pyx_BufFmt_ExpectNumber(&ts);
        if (number == -1) return NULL;
        if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
            return PyErr_Format(PyExc_ValueError,
                        "Expected a dimension of size %zu, got %d",
                        ctx->head->field->type->arraysize[i], number);
        if (*ts != ',' && *ts != ')')
            return PyErr_Format(PyExc_ValueError,
                                "Expected a comma in format string, got '%c'", *ts);
        if (*ts == ',') ts++;
        i++;
    }
    if (i != ndim)
        return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
                            ctx->head->field->type->ndim, i);
    if (!*ts) {
        PyErr_SetString(PyExc_ValueError,
                        "Unexpected end of format string, expected ')'");
        return NULL;
    }
    ctx->is_valid_array = 1;
    ctx->new_count = 1;
    *tsp = ++ts;
    return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  int got_Z = 0;
  while (1) {
    switch(*ts) {
      case 0:
        if (ctx->enc_type != 0 && ctx->head == NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        if (ctx->head != NULL) {
          __Pyx_BufFmt_RaiseExpected(ctx);
          return NULL;
        }
        return ts;
      case ' ':
      case '\r':
      case '\n':
        ++ts;
        break;
      case '<':
        if (!__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '>':
      case '!':
        if (__Pyx_Is_Little_Endian()) {
          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
          return NULL;
        }
        ctx->new_packmode = '=';
        ++ts;
        break;
      case '=':
      case '@':
      case '^':
        ctx->new_packmode = *ts++;
        break;
      case 'T':
        {
          const char* ts_after_sub;
          size_t i, struct_count = ctx->new_count;
          size_t struct_alignment = ctx->struct_alignment;
          ctx->new_count = 1;
          ++ts;
          if (*ts != '{') {
            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
            return NULL;
          }
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          ctx->enc_count = 0;
          ctx->struct_alignment = 0;
          ++ts;
          ts_after_sub = ts;
          for (i = 0; i != struct_count; ++i) {
            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
            if (!ts_after_sub) return NULL;
          }
          ts = ts_after_sub;
          if (struct_alignment) ctx->struct_alignment = struct_alignment;
        }
        break;
      case '}':
        {
          size_t alignment = ctx->struct_alignment;
          ++ts;
          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
          ctx->enc_type = 0;
          if (alignment && ctx->fmt_offset % alignment) {
            ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
          }
        }
        return ts;
      case 'x':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->fmt_offset += ctx->new_count;
        ctx->new_count = 1;
        ctx->enc_count = 0;
        ctx->enc_type = 0;
        ctx->enc_packmode = ctx->new_packmode;
        ++ts;
        break;
      case 'Z':
        got_Z = 1;
        ++ts;
        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
          return NULL;
        }
      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
      case 'l': case 'L': case 'q': case 'Q':
      case 'f': case 'd': case 'g':
      case 'O': case 'p':
        if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
            ctx->enc_packmode == ctx->new_packmode) {
          ctx->enc_count += ctx->new_count;
          ctx->new_count = 1;
          got_Z = 0;
          ++ts;
          break;
        }
      case 's':
        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
        ctx->enc_count = ctx->new_count;
        ctx->enc_packmode = ctx->new_packmode;
        ctx->enc_type = *ts;
        ctx->is_complex = got_Z;
        ++ts;
        ctx->new_count = 1;
        got_Z = 0;
        break;
      case ':':
        ++ts;
        while(*ts != ':') ++ts;
        ++ts;
        break;
      case '(':
        if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
        break;
      default:
        {
          int number = __Pyx_BufFmt_ExpectNumber(&ts);
          if (number == -1) return NULL;
          ctx->new_count = (size_t)number;
        }
    }
  }
}

/* BufferGetAndValidate */
      static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  if (unlikely(info->buf == NULL)) return;
  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
  __Pyx_ReleaseBuffer(info);
}
static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  buf->buf = NULL;
  buf->obj = NULL;
  buf->strides = __Pyx_zeros;
  buf->shape = __Pyx_zeros;
  buf->suboffsets = __Pyx_minusones;
}
static int __Pyx__GetBufferAndValidate(
        Py_buffer* buf, PyObject* obj,  __Pyx_TypeInfo* dtype, int flags,
        int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
  buf->buf = NULL;
  if (unlikely(__Pyx_GetBuffer(obj, buf, flags) == -1)) {
    __Pyx_ZeroBuffer(buf);
    return -1;
  }
  if (unlikely(buf->ndim != nd)) {
    PyErr_Format(PyExc_ValueError,
                 "Buffer has wrong number of dimensions (expected %d, got %d)",
                 nd, buf->ndim);
    goto fail;
  }
  if (!cast) {
    __Pyx_BufFmt_Context ctx;
    __Pyx_BufFmt_Init(&ctx, stack, dtype);
    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  }
  if (unlikely((unsigned)buf->itemsize != dtype->size)) {
    PyErr_Format(PyExc_ValueError,
      "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
      dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
    goto fail;
  }
  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
  return 0;
fail:;
  __Pyx_SafeReleaseBuffer(buf);
  return -1;
}

/* ExtTypeTest */
      static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_SetString(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(__Pyx_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

/* PyFloatBinop */
      #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideObjC(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double b = floatval;
    double a, result;
    if (likely(PyFloat_CheckExact(op1))) {
        a = PyFloat_AS_DOUBLE(op1);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        a = (double) PyInt_AS_LONG(op1);
    } else
    #endif
    if (likely(PyLong_CheckExact(op1))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        switch (size) {
            case  0: a = 0.0; break;
            case -1: a = -(double) digits[0]; break;
            case  1: a = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    a = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            a = -a;
                        break;
                    }
                }
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            a = -a;
                        break;
                    }
                }
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    a = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (a < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            a = -a;
                        break;
                    }
                }
            default:
        #else
        {
        #endif
            a = PyLong_AsDouble(op1);
            if (unlikely(a == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* GetAttr */
        static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_USE_TYPE_SLOTS
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

/* HasAttr */
        static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
    PyObject *r;
    if (unlikely(!__Pyx_PyBaseString_Check(n))) {
        PyErr_SetString(PyExc_TypeError,
                        "hasattr(): attribute name must be string");
        return -1;
    }
    r = __Pyx_GetAttr(o, n);
    if (unlikely(!r)) {
        PyErr_Clear();
        return 0;
    } else {
        Py_DECREF(r);
        return 1;
    }
}

/* MemviewSliceInit */
        static int
__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
                        int ndim,
                        __Pyx_memviewslice *memviewslice,
                        int memview_is_new_reference)
{
    __Pyx_RefNannyDeclarations
    int i, retval=-1;
    Py_buffer *buf = &memview->view;
    __Pyx_RefNannySetupContext("init_memviewslice", 0);
    if (!buf) {
        PyErr_SetString(PyExc_ValueError,
            "buf is NULL.");
        goto fail;
    } else if (memviewslice->memview || memviewslice->data) {
        PyErr_SetString(PyExc_ValueError,
            "memviewslice is already initialized!");
        goto fail;
    }
    if (buf->strides) {
        for (i = 0; i < ndim; i++) {
            memviewslice->strides[i] = buf->strides[i];
        }
    } else {
        Py_ssize_t stride = buf->itemsize;
        for (i = ndim - 1; i >= 0; i--) {
            memviewslice->strides[i] = stride;
            stride *= buf->shape[i];
        }
    }
    for (i = 0; i < ndim; i++) {
        memviewslice->shape[i]   = buf->shape[i];
        if (buf->suboffsets) {
            memviewslice->suboffsets[i] = buf->suboffsets[i];
        } else {
            memviewslice->suboffsets[i] = -1;
        }
    }
    memviewslice->memview = memview;
    memviewslice->data = (char *)buf->buf;
    if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
        Py_INCREF(memview);
    }
    retval = 0;
    goto no_fail;
fail:
    memviewslice->memview = 0;
    memviewslice->data = 0;
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}
#ifndef Py_NO_RETURN
#define Py_NO_RETURN
#endif
static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
    va_list vargs;
    char msg[200];
#ifdef HAVE_STDARG_PROTOTYPES
    va_start(vargs, fmt);
#else
    va_start(vargs);
#endif
    vsnprintf(msg, 200, fmt, vargs);
    va_end(vargs);
    Py_FatalError(msg);
}
static CYTHON_INLINE int
__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)++;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE int
__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
                                   PyThread_type_lock lock)
{
    int result;
    PyThread_acquire_lock(lock, 1);
    result = (*acquisition_count)--;
    PyThread_release_lock(lock);
    return result;
}
static CYTHON_INLINE void
__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
{
    int first_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (!memview || (PyObject *) memview == Py_None)
        return;
    if (__pyx_get_slice_count(memview) < 0)
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    first_time = __pyx_add_acquisition_count(memview) == 0;
    if (first_time) {
        if (have_gil) {
            Py_INCREF((PyObject *) memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_INCREF((PyObject *) memview);
            PyGILState_Release(_gilstate);
        }
    }
}
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
                                             int have_gil, int lineno) {
    int last_time;
    struct __pyx_memoryview_obj *memview = memslice->memview;
    if (!memview ) {
        return;
    } else if ((PyObject *) memview == Py_None) {
        memslice->memview = NULL;
        return;
    }
    if (__pyx_get_slice_count(memview) <= 0)
        __pyx_fatalerror("Acquisition count is %d (line %d)",
                         __pyx_get_slice_count(memview), lineno);
    last_time = __pyx_sub_acquisition_count(memview) == 1;
    memslice->data = NULL;
    if (last_time) {
        if (have_gil) {
            Py_CLEAR(memslice->memview);
        } else {
            PyGILState_STATE _gilstate = PyGILState_Ensure();
            Py_CLEAR(memslice->memview);
            PyGILState_Release(_gilstate);
        }
    } else {
        memslice->memview = NULL;
    }
}

/* SetItemInt */
        static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
    int r;
    if (!j) return -1;
    r = PyObject_SetItem(o, j, v);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
            PyObject* old = PyList_GET_ITEM(o, n);
            Py_INCREF(v);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
            return 1;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return m->sq_ass_item(o, i, v);
        }
    }
#else
#if CYTHON_COMPILING_IN_PYPY
    if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) {
#else
    if (is_list || PySequence_Check(o)) {
#endif
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
}

/* RaiseTooManyValuesToUnpack */
          static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* RaiseNeedMoreValuesToUnpack */
          static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* IterFinish */
          static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_FAST_THREAD_STATE
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

/* UnpackItemEndCheck */
          static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

/* BufferFallbackError */
          static void __Pyx_RaiseBufferFallbackError(void) {
  PyErr_SetString(PyExc_ValueError,
     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
}

/* None */
          static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* PyIntBinop */
          #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a + b);
            if (likely((x^a) >= 0 || (x^b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_add(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
            }
        }
                x = a + b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla + llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("add", return NULL)
            result = ((double)a) + (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
}
#endif

/* PyFloatBinop */
          #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, CYTHON_UNUSED int inplace) {
    const double a = floatval;
    double b, result;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
    } else
    #endif
    if (likely(PyLong_CheckExact(op2))) {
        #if CYTHON_USE_PYLONG_INTERNALS
        const digit* digits = ((PyLongObject*)op2)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op2);
        switch (size) {
            case  0: b = 0.0; break;
            case -1: b = -(double) digits[0]; break;
            case  1: b = (double) digits[0]; break;
            case -2:
            case 2:
                if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (1 * PyLong_SHIFT < 53))) {
                    b = (double) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -2)
                            b = -b;
                        break;
                    }
                }
            case -3:
            case 3:
                if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -3)
                            b = -b;
                        break;
                    }
                }
            case -4:
            case 4:
                if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT && ((8 * sizeof(unsigned long) < 53) || (3 * PyLong_SHIFT < 53))) {
                    b = (double) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    if ((8 * sizeof(unsigned long) < 53) || (4 * PyLong_SHIFT < 53) || (b < (double) ((PY_LONG_LONG)1 << 53))) {
                        if (size == -4)
                            b = -b;
                        break;
                    }
                }
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* PyIntBinop */
            #if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op1))) {
        const long b = intval;
        long x;
        long a = PyInt_AS_LONG(op1);
            x = (long)((unsigned long)a - b);
            if (likely((x^a) >= 0 || (x^~b) >= 0))
                return PyInt_FromLong(x);
            return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
    }
    #endif
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        const long b = intval;
        long a, x;
#ifdef HAVE_LONG_LONG
        const PY_LONG_LONG llb = intval;
        PY_LONG_LONG lla, llx;
#endif
        const digit* digits = ((PyLongObject*)op1)->ob_digit;
        const Py_ssize_t size = Py_SIZE(op1);
        if (likely(__Pyx_sst_abs(size) <= 1)) {
            a = likely(size) ? digits[0] : 0;
            if (size == -1) a = -a;
        } else {
            switch (size) {
                case -2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case 2:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                        lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                        goto long_long;
#endif
                    }
                case -3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 3:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case -4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                case 4:
                    if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                        a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                        break;
#ifdef HAVE_LONG_LONG
                    } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                        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]));
                        goto long_long;
#endif
                    }
                default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
            }
        }
                x = a - b;
            return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
        long_long:
                llx = lla - llb;
            return PyLong_FromLongLong(llx);
#endif
        
        
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = PyFloat_AS_DOUBLE(op1);
            double result;
            PyFPE_START_PROTECT("subtract", return NULL)
            result = ((double)a) - (double)b;
            PyFPE_END_PROTECT(result)
            return PyFloat_FromDouble(result);
    }
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#endif

/* SaveResetException */
            #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if PY_VERSION_HEX >= 0x030700A2
    *type = tstate->exc_state.exc_type;
    *value = tstate->exc_state.exc_value;
    *tb = tstate->exc_state.exc_traceback;
    #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    #endif
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = type;
    tstate->exc_state.exc_value = value;
    tstate->exc_state.exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}
#endif

/* PyErrExceptionMatches */
            #if CYTHON_FAST_THREAD_STATE
static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    n = PyTuple_GET_SIZE(tuple);
#if PY_MAJOR_VERSION >= 3
    for (i=0; i<n; i++) {
        if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
    }
#endif
    for (i=0; i<n; i++) {
        if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
    PyObject *exc_type = tstate->curexc_type;
    if (exc_type == err) return 1;
    if (unlikely(!exc_type)) return 0;
    if (unlikely(PyTuple_Check(err)))
        return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
    return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
}
#endif

/* GetException */
            #if CYTHON_FAST_THREAD_STATE
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
#endif
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_FAST_THREAD_STATE
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_FAST_THREAD_STATE
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_FAST_THREAD_STATE
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = local_type;
    tstate->exc_state.exc_value = local_value;
    tstate->exc_state.exc_traceback = local_tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

/* PyObjectCallMethod0 */
              static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_UNPACK_METHODS
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *function = PyMethod_GET_FUNCTION(method);
            result = __Pyx_PyObject_CallOneArg(function, self);
            Py_DECREF(method);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNoneIterError */
              static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
              static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
              static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
              static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* MergeKeywords */
              static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
    PyObject *iter, *key = NULL, *value = NULL;
    int source_is_dict, result;
    Py_ssize_t orig_length, ppos = 0;
    iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
    if (unlikely(!iter)) {
        PyObject *args;
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        args = PyTuple_Pack(1, source_mapping);
        if (likely(args)) {
            PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
            Py_DECREF(args);
            if (likely(fallback)) {
                iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
                Py_DECREF(fallback);
            }
        }
        if (unlikely(!iter)) goto bad;
    }
    while (1) {
        result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
        if (unlikely(result < 0)) goto bad;
        if (!result) break;
        if (unlikely(PyDict_Contains(kwdict, key))) {
            __Pyx_RaiseDoubleKeywordsError("function", key);
            result = -1;
        } else {
            result = PyDict_SetItem(kwdict, key, value);
        }
        Py_DECREF(key);
        Py_DECREF(value);
        if (unlikely(result < 0)) goto bad;
    }
    Py_XDECREF(iter);
    return 0;
bad:
    Py_XDECREF(iter);
    return -1;
}

/* BufferIndexError */
              static void __Pyx_RaiseBufferIndexError(int axis) {
  PyErr_Format(PyExc_IndexError,
     "Out of bounds on buffer access (axis %d)", axis);
}

/* None */
              static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
    Py_ssize_t q = a / b;
    Py_ssize_t r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* decode_c_string */
              static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        size_t slen = strlen(cstring);
        if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
            PyErr_SetString(PyExc_OverflowError,
                            "c-string too long to convert to Python");
            return NULL;
        }
        length = (Py_ssize_t) slen;
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

/* GetAttr3 */
              static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    Py_INCREF(d);
    return d;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
}

/* SwapException */
              #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if PY_VERSION_HEX >= 0x030700A2
    tmp_type = tstate->exc_state.exc_type;
    tmp_value = tstate->exc_state.exc_value;
    tmp_tb = tstate->exc_state.exc_traceback;
    tstate->exc_state.exc_type = *type;
    tstate->exc_state.exc_value = *value;
    tstate->exc_state.exc_traceback = *tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
    #endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* Import */
              static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_MAJOR_VERSION < 3
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_MAJOR_VERSION < 3
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

/* None */
              static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

/* WriteUnraisableException */
              static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#endif
}

/* ImportFrom */
              static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

/* SetVTable */
              static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

/* SetupReduce */
              static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  int ret;
  PyObject *name_attr;
  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  if (likely(name_attr)) {
      ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  } else {
      ret = -1;
  }
  if (unlikely(ret < 0)) {
      PyErr_Clear();
      ret = 0;
  }
  Py_XDECREF(name_attr);
  return ret;
}
static int __Pyx_setup_reduce(PyObject* type_obj) {
    int ret = 0;
    PyObject *object_reduce = NULL;
    PyObject *object_reduce_ex = NULL;
    PyObject *reduce = NULL;
    PyObject *reduce_ex = NULL;
    PyObject *reduce_cython = NULL;
    PyObject *setstate = NULL;
    PyObject *setstate_cython = NULL;
#if CYTHON_USE_PYTYPE_LOOKUP
    if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD;
    if (reduce_ex == object_reduce_ex) {
#if CYTHON_USE_PYTYPE_LOOKUP
        object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD;
            ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD;
            ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD;
            setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
            if (!setstate) PyErr_Clear();
            if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
                setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD;
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD;
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto GOOD;
BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
GOOD:
#if !CYTHON_USE_PYTYPE_LOOKUP
    Py_XDECREF(object_reduce);
    Py_XDECREF(object_reduce_ex);
#endif
    Py_XDECREF(reduce);
    Py_XDECREF(reduce_ex);
    Py_XDECREF(reduce_cython);
    Py_XDECREF(setstate);
    Py_XDECREF(setstate_cython);
    return ret;
}

/* PatchModuleWithCoroutine */
              static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) {
#if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
    int result;
    PyObject *globals, *result_obj;
    globals = PyDict_New();  if (unlikely(!globals)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_coroutine_type",
    #ifdef __Pyx_Coroutine_USED
        (PyObject*)__pyx_CoroutineType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    result = PyDict_SetItemString(globals, "_cython_generator_type",
    #ifdef __Pyx_Generator_USED
        (PyObject*)__pyx_GeneratorType);
    #else
        Py_None);
    #endif
    if (unlikely(result < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore;
    if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore;
    result_obj = PyRun_String(py_code, Py_file_input, globals, globals);
    if (unlikely(!result_obj)) goto ignore;
    Py_DECREF(result_obj);
    Py_DECREF(globals);
    return module;
ignore:
    Py_XDECREF(globals);
    PyErr_WriteUnraisable(module);
    if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) {
        Py_DECREF(module);
        module = NULL;
    }
#else
    py_code++;
#endif
    return module;
}

/* PatchInspect */
              static PyObject* __Pyx_patch_inspect(PyObject* module) {
#if defined(__Pyx_Generator_USED) && (!defined(CYTHON_PATCH_INSPECT) || CYTHON_PATCH_INSPECT)
    static int inspect_patched = 0;
    if (unlikely((!inspect_patched) && module)) {
        module = __Pyx_Coroutine_patch_module(
            module, ""
"old_types = getattr(_module.isgenerator, '_cython_generator_types', None)\n"
"if old_types is None or not isinstance(old_types, set):\n"
"    old_types = set()\n"
"    def cy_wrap(orig_func, type=type, cython_generator_types=old_types):\n"
"        def cy_isgenerator(obj): return type(obj) in cython_generator_types or orig_func(obj)\n"
"        cy_isgenerator._cython_generator_types = cython_generator_types\n"
"        return cy_isgenerator\n"
"    _module.isgenerator = cy_wrap(_module.isgenerator)\n"
"old_types.add(_cython_generator_type)\n"
        );
        inspect_patched = 1;
    }
#else
    if ((0)) return __Pyx_Coroutine_patch_module(module, NULL);
#endif
    return module;
}

/* CLineInTraceback */
              #ifndef CYTHON_CLINE_IN_TRACEBACK
static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
      use_cline = PyDict_GetItem(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
    }
    else if (PyObject_Not(use_cline) != 0) {
        c_line = 0;
    }
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
              static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

/* AddTraceback */
              #include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    if (c_line) {
        c_line = __Pyx_CLineForTraceback(tstate, c_line);
    }
    py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        tstate,            /*PyThreadState *tstate,*/
        py_code,           /*PyCodeObject *code,*/
        __pyx_d,    /*PyObject *globals,*/
        0                  /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
    if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
        if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
    PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
    return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
    PyObject *obj = view->obj;
    if (!obj) return;
    if (PyObject_CheckBuffer(obj)) {
        PyBuffer_Release(view);
        return;
    }
    if ((0)) {}
        else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
    view->obj = NULL;
    Py_DECREF(obj);
}
#endif


              /* MemviewSliceIsContig */
              static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
{
    int i, index, step, start;
    Py_ssize_t itemsize = mvs.memview->view.itemsize;
    if (order == 'F') {
        step = 1;
        start = 0;
    } else {
        step = -1;
        start = ndim - 1;
    }
    for (i = 0; i < ndim; i++) {
        index = start + step * i;
        if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
            return 0;
        itemsize *= mvs.shape[index];
    }
    return 1;
}

/* OverlappingSlices */
              static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
                               void **out_start, void **out_end,
                               int ndim, size_t itemsize)
{
    char *start, *end;
    int i;
    start = end = slice->data;
    for (i = 0; i < ndim; i++) {
        Py_ssize_t stride = slice->strides[i];
        Py_ssize_t extent = slice->shape[i];
        if (extent == 0) {
            *out_start = *out_end = start;
            return;
        } else {
            if (stride > 0)
                end += stride * (extent - 1);
            else
                start += stride * (extent - 1);
        }
    }
    *out_start = start;
    *out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
                     __Pyx_memviewslice *slice2,
                     int ndim, size_t itemsize)
{
    void *start1, *end1, *start2, *end2;
    __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
    __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
    return (start1 < end2) && (start2 < end1);
}

/* Capsule */
              static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
{
    PyObject *cobj;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(p, sig, NULL);
#else
    cobj = PyCObject_FromVoidPtr(p, NULL);
#endif
    return cobj;
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

/* CIntFromPyVerify */
              #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* TypeInfoCompare */
              static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
{
    int i;
    if (!a || !b)
        return 0;
    if (a == b)
        return 1;
    if (a->size != b->size || a->typegroup != b->typegroup ||
            a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
        if (a->typegroup == 'H' || b->typegroup == 'H') {
            return a->size == b->size;
        } else {
            return 0;
        }
    }
    if (a->ndim) {
        for (i = 0; i < a->ndim; i++)
            if (a->arraysize[i] != b->arraysize[i])
                return 0;
    }
    if (a->typegroup == 'S') {
        if (a->flags != b->flags)
            return 0;
        if (a->fields || b->fields) {
            if (!(a->fields && b->fields))
                return 0;
            for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
                __Pyx_StructField *field_a = a->fields + i;
                __Pyx_StructField *field_b = b->fields + i;
                if (field_a->offset != field_b->offset ||
                    !__pyx_typeinfo_cmp(field_a->type, field_b->type))
                    return 0;
            }
            return !a->fields[i].type && !b->fields[i].type;
        }
    }
    return 1;
}

/* MemviewSliceValidateAndInit */
              static int
__pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
{
    if (buf->shape[dim] <= 1)
        return 1;
    if (buf->strides) {
        if (spec & __Pyx_MEMVIEW_CONTIG) {
            if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
                if (buf->strides[dim] != sizeof(void *)) {
                    PyErr_Format(PyExc_ValueError,
                                 "Buffer is not indirectly contiguous "
                                 "in dimension %d.", dim);
                    goto fail;
                }
            } else if (buf->strides[dim] != buf->itemsize) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
        if (spec & __Pyx_MEMVIEW_FOLLOW) {
            Py_ssize_t stride = buf->strides[dim];
            if (stride < 0)
                stride = -stride;
            if (stride < buf->itemsize) {
                PyErr_SetString(PyExc_ValueError,
                                "Buffer and memoryview are not contiguous "
                                "in the same dimension.");
                goto fail;
            }
        }
    } else {
        if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not contiguous in "
                         "dimension %d", dim);
            goto fail;
        } else if (spec & (__Pyx_MEMVIEW_PTR)) {
            PyErr_Format(PyExc_ValueError,
                         "C-contiguous buffer is not indirect in "
                         "dimension %d", dim);
            goto fail;
        } else if (buf->suboffsets) {
            PyErr_SetString(PyExc_ValueError,
                            "Buffer exposes suboffsets but no strides");
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
{
    if (spec & __Pyx_MEMVIEW_DIRECT) {
        if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer not compatible with direct access "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    if (spec & __Pyx_MEMVIEW_PTR) {
        if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) {
            PyErr_Format(PyExc_ValueError,
                         "Buffer is not indirectly accessible "
                         "in dimension %d.", dim);
            goto fail;
        }
    }
    return 1;
fail:
    return 0;
}
static int
__pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
{
    int i;
    if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = 0; i < ndim; i++) {
            if (stride * buf->itemsize != buf->strides[i] &&
                    buf->shape[i] > 1)
            {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not fortran contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
        Py_ssize_t stride = 1;
        for (i = ndim - 1; i >- 1; i--) {
            if (stride * buf->itemsize != buf->strides[i] &&
                    buf->shape[i] > 1) {
                PyErr_SetString(PyExc_ValueError,
                    "Buffer not C contiguous.");
                goto fail;
            }
            stride = stride * buf->shape[i];
        }
    }
    return 1;
fail:
    return 0;
}
static int __Pyx_ValidateAndInit_memviewslice(
                int *axes_specs,
                int c_or_f_flag,
                int buf_flags,
                int ndim,
                __Pyx_TypeInfo *dtype,
                __Pyx_BufFmt_StackElem stack[],
                __Pyx_memviewslice *memviewslice,
                PyObject *original_obj)
{
    struct __pyx_memoryview_obj *memview, *new_memview;
    __Pyx_RefNannyDeclarations
    Py_buffer *buf;
    int i, spec = 0, retval = -1;
    __Pyx_BufFmt_Context ctx;
    int from_memoryview = __pyx_memoryview_check(original_obj);
    __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
    if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
                                                            original_obj)->typeinfo)) {
        memview = (struct __pyx_memoryview_obj *) original_obj;
        new_memview = NULL;
    } else {
        memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                            original_obj, buf_flags, 0, dtype);
        new_memview = memview;
        if (unlikely(!memview))
            goto fail;
    }
    buf = &memview->view;
    if (buf->ndim != ndim) {
        PyErr_Format(PyExc_ValueError,
                "Buffer has wrong number of dimensions (expected %d, got %d)",
                ndim, buf->ndim);
        goto fail;
    }
    if (new_memview) {
        __Pyx_BufFmt_Init(&ctx, stack, dtype);
        if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
    }
    if ((unsigned) buf->itemsize != dtype->size) {
        PyErr_Format(PyExc_ValueError,
                     "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
                     "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
                     buf->itemsize,
                     (buf->itemsize > 1) ? "s" : "",
                     dtype->name,
                     dtype->size,
                     (dtype->size > 1) ? "s" : "");
        goto fail;
    }
    for (i = 0; i < ndim; i++) {
        spec = axes_specs[i];
        if (!__pyx_check_strides(buf, i, ndim, spec))
            goto fail;
        if (!__pyx_check_suboffsets(buf, i, ndim, spec))
            goto fail;
    }
    if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
                                         new_memview != NULL) == -1)) {
        goto fail;
    }
    retval = 0;
    goto no_fail;
fail:
    Py_XDECREF(new_memview);
    retval = -1;
no_fail:
    __Pyx_RefNannyFinishContext();
    return retval;
}

/* ObjectToMemviewSlice */
              static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_double(PyObject *obj) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 1,
                                                 &__Pyx_TypeInfo_double, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
              static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *obj) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 1,
                                                 &__Pyx_TypeInfo_long, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* ObjectToMemviewSlice */
              static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj) {
    __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
    __Pyx_BufFmt_StackElem stack[1];
    int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
    int retcode;
    if (obj == Py_None) {
        result.memview = (struct __pyx_memoryview_obj *) Py_None;
        return result;
    }
    retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
                                                 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 2,
                                                 &__Pyx_TypeInfo_double, stack,
                                                 &result, obj);
    if (unlikely(retcode == -1))
        goto __pyx_fail;
    return result;
__pyx_fail:
    result.memview = NULL;
    result.data = NULL;
    return result;
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
    const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(Py_intptr_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(Py_intptr_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
                                     little, !is_unsigned);
    }
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

/* MemviewDtypeToObject */
              static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) {
    return (PyObject *) PyFloat_FromDouble(*(double *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) {
    double value = __pyx_PyFloat_AsDouble(obj);
    if ((value == (double)-1) && PyErr_Occurred())
        return 0;
    *(double *) itemp = value;
    return 1;
}

/* MemviewDtypeToObject */
              static CYTHON_INLINE PyObject *__pyx_memview_get_long(const char *itemp) {
    return (PyObject *) __Pyx_PyInt_From_long(*(long *) itemp);
}
static CYTHON_INLINE int __pyx_memview_set_long(const char *itemp, PyObject *obj) {
    long value = __Pyx_PyInt_As_long(obj);
    if ((value == (long)-1) && PyErr_Occurred())
        return 0;
    *(long *) itemp = value;
    return 1;
}

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(unsigned int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(unsigned int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(unsigned int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(unsigned int),
                                     little, !is_unsigned);
    }
}

/* None */
              static CYTHON_INLINE long __Pyx_pow_long(long b, long e) {
    long t = b;
    switch (e) {
        case 3:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 2:
            t *= b;
        CYTHON_FALLTHROUGH;
        case 1:
            return t;
        case 0:
            return 1;
    }
    #if 1
    if (unlikely(e<0)) return 0;
    #endif
    t = 1;
    while (likely(e)) {
        t *= (b * (e&1)) | ((~e)&1);
        b *= b;
        e >>= 1;
    }
    return t;
}

/* Declarations */
              #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return ::std::complex< float >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      return x + y*(__pyx_t_float_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
      __pyx_t_float_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
              #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        __pyx_t_float_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabsf(b.real) >= fabsf(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                float r = b.imag / b.real;
                float s = 1.0 / (b.real + b.imag * r);
                return __pyx_t_float_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            float r = b.real / b.imag;
            float s = 1.0 / (b.imag + b.real * r);
            return __pyx_t_float_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
        if (b.imag == 0) {
            return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            float denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_float_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
        __pyx_t_float_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrtf(z.real*z.real + z.imag*z.imag);
          #else
            return hypotf(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
            __pyx_t_float_complex z;
            float r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    float denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(a, a);
                    case 3:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, a);
                    case 4:
                        z = __Pyx_c_prod_float(a, a);
                        return __Pyx_c_prod_float(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = powf(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2f(0, -1);
                }
            } else {
                r = __Pyx_c_abs_float(a);
                theta = atan2f(a.imag, a.real);
            }
            lnr = logf(r);
            z_r = expf(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cosf(z_theta);
            z.imag = z_r * sinf(z_theta);
            return z;
        }
    #endif
#endif

/* Declarations */
              #if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return ::std::complex< double >(x, y);
    }
  #else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      return x + y*(__pyx_t_double_complex)_Complex_I;
    }
  #endif
#else
    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
      __pyx_t_double_complex z;
      z.real = x;
      z.imag = y;
      return z;
    }
#endif

/* Arithmetic */
              #if CYTHON_CCOMPLEX
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
       return (a.real == b.real) && (a.imag == b.imag);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real + b.real;
        z.imag = a.imag + b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real - b.real;
        z.imag = a.imag - b.imag;
        return z;
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        __pyx_t_double_complex z;
        z.real = a.real * b.real - a.imag * b.imag;
        z.imag = a.real * b.imag + a.imag * b.real;
        return z;
    }
    #if 1
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else if (fabs(b.real) >= fabs(b.imag)) {
            if (b.real == 0 && b.imag == 0) {
                return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
            } else {
                double r = b.imag / b.real;
                double s = 1.0 / (b.real + b.imag * r);
                return __pyx_t_double_complex_from_parts(
                    (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
            }
        } else {
            double r = b.real / b.imag;
            double s = 1.0 / (b.imag + b.real * r);
            return __pyx_t_double_complex_from_parts(
                (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
        }
    }
    #else
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
        if (b.imag == 0) {
            return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
        } else {
            double denom = b.real * b.real + b.imag * b.imag;
            return __pyx_t_double_complex_from_parts(
                (a.real * b.real + a.imag * b.imag) / denom,
                (a.imag * b.real - a.real * b.imag) / denom);
        }
    }
    #endif
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real = -a.real;
        z.imag = -a.imag;
        return z;
    }
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
       return (a.real == 0) && (a.imag == 0);
    }
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
        __pyx_t_double_complex z;
        z.real =  a.real;
        z.imag = -a.imag;
        return z;
    }
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
          #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
            return sqrt(z.real*z.real + z.imag*z.imag);
          #else
            return hypot(z.real, z.imag);
          #endif
        }
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
            __pyx_t_double_complex z;
            double r, lnr, theta, z_r, z_theta;
            if (b.imag == 0 && b.real == (int)b.real) {
                if (b.real < 0) {
                    double denom = a.real * a.real + a.imag * a.imag;
                    a.real = a.real / denom;
                    a.imag = -a.imag / denom;
                    b.real = -b.real;
                }
                switch ((int)b.real) {
                    case 0:
                        z.real = 1;
                        z.imag = 0;
                        return z;
                    case 1:
                        return a;
                    case 2:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(a, a);
                    case 3:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, a);
                    case 4:
                        z = __Pyx_c_prod_double(a, a);
                        return __Pyx_c_prod_double(z, z);
                }
            }
            if (a.imag == 0) {
                if (a.real == 0) {
                    return a;
                } else if (b.imag == 0) {
                    z.real = pow(a.real, b.real);
                    z.imag = 0;
                    return z;
                } else if (a.real > 0) {
                    r = a.real;
                    theta = 0;
                } else {
                    r = -a.real;
                    theta = atan2(0, -1);
                }
            } else {
                r = __Pyx_c_abs_double(a);
                theta = atan2(a.imag, a.real);
            }
            lnr = log(r);
            z_r = exp(lnr * b.real - theta * b.imag);
            z_theta = theta * b.real + lnr * b.imag;
            z.real = z_r * cos(z_theta);
            z.imag = z_r * sin(z_theta);
            return z;
        }
    #endif
#endif

/* CIntToPy */
              static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
    const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(enum NPY_TYPES) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
                                     little, !is_unsigned);
    }
}

/* MemviewSliceCopyTemplate */
              static __Pyx_memviewslice
__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
                                 const char *mode, int ndim,
                                 size_t sizeof_dtype, int contig_flag,
                                 int dtype_is_object)
{
    __Pyx_RefNannyDeclarations
    int i;
    __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
    struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
    Py_buffer *buf = &from_memview->view;
    PyObject *shape_tuple = NULL;
    PyObject *temp_int = NULL;
    struct __pyx_array_obj *array_obj = NULL;
    struct __pyx_memoryview_obj *memview_obj = NULL;
    __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
    for (i = 0; i < ndim; i++) {
        if (from_mvs->suboffsets[i] >= 0) {
            PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
                                           "indirect dimensions (axis %d)", i);
            goto fail;
        }
    }
    shape_tuple = PyTuple_New(ndim);
    if (unlikely(!shape_tuple)) {
        goto fail;
    }
    __Pyx_GOTREF(shape_tuple);
    for(i = 0; i < ndim; i++) {
        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
        if(unlikely(!temp_int)) {
            goto fail;
        } else {
            PyTuple_SET_ITEM(shape_tuple, i, temp_int);
            temp_int = NULL;
        }
    }
    array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
    if (unlikely(!array_obj)) {
        goto fail;
    }
    __Pyx_GOTREF(array_obj);
    memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
                                    (PyObject *) array_obj, contig_flag,
                                    dtype_is_object,
                                    from_mvs->memview->typeinfo);
    if (unlikely(!memview_obj))
        goto fail;
    if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
        goto fail;
    if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
                                                dtype_is_object) < 0))
        goto fail;
    goto no_fail;
fail:
    __Pyx_XDECREF(new_mvs.memview);
    new_mvs.memview = NULL;
    new_mvs.data = NULL;
no_fail:
    __Pyx_XDECREF(shape_tuple);
    __Pyx_XDECREF(temp_int);
    __Pyx_XDECREF(array_obj);
    __Pyx_RefNannyFinishContext();
    return new_mvs;
}

/* CIntFromPy */
              static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = (int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
                            return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
                            return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
                            return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

/* CIntFromPy */
              static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = (long) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
                            return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
                            return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
                            return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (long) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (long) 0;
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

/* CIntFromPy */
              static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) {
    const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(unsigned int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (unsigned int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned int) 0;
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0])
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) {
                            return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) {
                            return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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])))
                        } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) {
                            return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (unsigned int) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (unsigned int) 0;
                case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(unsigned int,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                            return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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])))
                        } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(unsigned 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])))
                        } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) {
                            return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(unsigned int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            unsigned int val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (unsigned int) -1;
        }
    } else {
        unsigned int val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (unsigned int) -1;
        val = __Pyx_PyInt_As_unsigned_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to unsigned int");
    return (unsigned int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to unsigned int");
    return (unsigned int) -1;
}

/* CIntFromPy */
              static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
    const char neg_one = (char) -1, const_zero = (char) 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(char) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (char) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case  1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
                            return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
                            return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
                            return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
                        }
                    }
                    break;
            }
#endif
#if CYTHON_COMPILING_IN_CPYTHON
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
#else
            {
                int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
                if (unlikely(result < 0))
                    return (char) -1;
                if (unlikely(result == 1))
                    goto raise_neg_overflow;
            }
#endif
            if (sizeof(char) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
            }
        } else {
#if CYTHON_USE_PYLONG_INTERNALS
            const digit* digits = ((PyLongObject*)x)->ob_digit;
            switch (Py_SIZE(x)) {
                case  0: return (char) 0;
                case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
                case  1: __PYX_VERIFY_RETURN_INT(char,  digit, +digits[0])
                case -2:
                    if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                            return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
                            __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                            return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
                        if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
                            __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])))
                        } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
                            return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
                        }
                    }
                    break;
            }
#endif
            if (sizeof(char) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
            } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
                __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            char val;
            PyObject *v = __Pyx_PyNumber_IntOrLong(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (char) -1;
        }
    } else {
        char val;
        PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
        if (!tmp) return (char) -1;
        val = __Pyx_PyInt_As_char(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to char");
    return (char) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to char");
    return (char) -1;
}

/* FastTypeChecks */
              #if CYTHON_COMPILING_IN_CPYTHON
static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
    while (a) {
        a = a->tp_base;
        if (a == b)
            return 1;
    }
    return b == &PyBaseObject_Type;
}
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
    PyObject *mro;
    if (a == b) return 1;
    mro = a->tp_mro;
    if (likely(mro)) {
        Py_ssize_t i, n;
        n = PyTuple_GET_SIZE(mro);
        for (i = 0; i < n; i++) {
            if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
                return 1;
        }
        return 0;
    }
    return __Pyx_InBases(a, b);
}
#if PY_MAJOR_VERSION == 2
static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
    PyObject *exception, *value, *tb;
    int res;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&exception, &value, &tb);
    res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
    if (unlikely(res == -1)) {
        PyErr_WriteUnraisable(err);
        res = 0;
    }
    if (!res) {
        res = PyObject_IsSubclass(err, exc_type2);
        if (unlikely(res == -1)) {
            PyErr_WriteUnraisable(err);
            res = 0;
        }
    }
    __Pyx_ErrRestore(exception, value, tb);
    return res;
}
#else
static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
    int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
    if (!res) {
        res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
    }
    return res;
}
#endif
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    if (likely(err == exc_type1 || err == exc_type2)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
    }
    return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
}
#endif

/* CheckBinaryVersion */
              static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

/* ModuleImport */
              #ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

/* TypeImport */
              #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
            module_name, class_name, basicsize, size);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

/* InitStrings */
              static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        if (PyObject_Hash(*t->p) == -1)
            PyErr_Clear();
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
#if !CYTHON_PEP393_ENABLED
static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    char* defenc_c;
    PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
    if (!defenc) return NULL;
    defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    {
        char* end = defenc_c + PyBytes_GET_SIZE(defenc);
        char* c;
        for (c = defenc_c; c < end; c++) {
            if ((unsigned char) (*c) >= 128) {
                PyUnicode_AsASCIIString(o);
                return NULL;
            }
        }
    }
#endif
    *length = PyBytes_GET_SIZE(defenc);
    return defenc_c;
}
#else
static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
    if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
    if (likely(PyUnicode_IS_ASCII(o))) {
        *length = PyUnicode_GET_LENGTH(o);
        return PyUnicode_AsUTF8(o);
    } else {
        PyUnicode_AsASCIIString(o);
        return NULL;
    }
#else
    return PyUnicode_AsUTF8AndSize(o, length);
#endif
}
#endif
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
        return __Pyx_PyUnicode_AsStringAndSize(o, length);
    } else
#endif
#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
#if PY_MAJOR_VERSION >= 3
    if (PyLong_Check(result)) {
        if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
                "__int__ returned non-int (type %.200s).  "
                "The ability to return an instance of a strict subclass of int "
                "is deprecated, and may be removed in a future version of Python.",
                Py_TYPE(result)->tp_name)) {
            Py_DECREF(result);
            return NULL;
        }
        return result;
    }
#endif
    PyErr_Format(PyExc_TypeError,
                 "__%.4s__ returned non-%.4s (type %.200s)",
                 type_name, type_name, Py_TYPE(result)->tp_name);
    Py_DECREF(result);
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
#if CYTHON_USE_TYPE_SLOTS
  PyNumberMethods *m;
#endif
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_Check(x) || PyLong_Check(x)))
#else
  if (likely(PyLong_Check(x)))
#endif
    return __Pyx_NewRef(x);
#if CYTHON_USE_TYPE_SLOTS
  m = Py_TYPE(x)->tp_as_number;
  #if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = m->nb_int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = m->nb_long(x);
  }
  #else
  if (likely(m && m->nb_int)) {
    name = "int";
    res = m->nb_int(x);
  }
  #endif
#else
  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
    res = PyNumber_Int(x);
  }
#endif
  if (likely(res)) {
#if PY_MAJOR_VERSION < 3
    if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
#else
    if (unlikely(!PyLong_CheckExact(res))) {
#endif
        return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b))) {
    if (sizeof(Py_ssize_t) >= sizeof(long))
        return PyInt_AS_LONG(b);
    else
        return PyInt_AsSsize_t(x);
  }
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_USE_PYLONG_INTERNALS
    const digit* digits = ((PyLongObject*)b)->ob_digit;
    const Py_ssize_t size = Py_SIZE(b);
    if (likely(__Pyx_sst_abs(size) <= 1)) {
        ival = likely(size) ? digits[0] : 0;
        if (size == -1) ival = -ival;
        return ival;
    } else {
      switch (size) {
         case 2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -2:
           if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case -3:
           if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
             return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
           }
           break;
         case 4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
         case -4:
           if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
             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]));
           }
           break;
      }
    }
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
